-
Notifications
You must be signed in to change notification settings - Fork 17
/
trs.h
216 lines (188 loc) · 6.62 KB
/
trs.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
/*
* Copyright (C) 1992 Clarendon Hill Software.
*
* Permission is granted to any individual or institution to use, copy,
* or redistribute this software, provided this copyright notice is retained.
*
* This software is provided "as is" without any expressed or implied
* warranty. If this software brings on any sort of damage -- physical,
* monetary, emotional, or brain -- too bad. You've got no one to blame
* but yourself.
*
* The software may be modified for your own purposes, but modified versions
* must retain this notice.
*/
/*
* Portions copyright (c) 1996-2020, Timothy P. Mann
*
* Permission is hereby granted, free of charge, to any person
* obtaining a copy of this software and associated documentation
* files (the "Software"), to deal in the Software without
* restriction, including without limitation the rights to use, copy,
* modify, merge, publish, distribute, sublicense, and/or sell copies
* of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
* BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
* ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
/*
* trs.h
*/
#ifndef _TRS_H
#define _TRS_H
#include "z80.h"
#include "time.h"
#define NORMAL 0
#define EXPANDED 1
#define INVERSE 2
#define ALTERNATE 4
extern char *program_name;
extern char *romfile1;
extern char *romfile1x;
extern char *romfile3;
extern char *romfile4p;
extern int trs_model; /* 1, 3, 4, 5(=4p) */
extern int trs_paused;
extern int trs_autodelay;
void trs_suspend_delay(void);
void trs_restore_delay(void);
extern int trs_continuous; /* 1= run continuously,
0= enter debugger after instruction,
-1= suppress interrupt and enter debugger */
extern int trs_disk_debug_flags;
extern int trs_io_debug_flags;
extern int trs_emtsafe;
int trs_parse_command_line(int argc, char **argv, int *debug);
void trs_screen_init(void);
void trs_screen_write_char(int position, int char_index);
void trs_screen_expanded(int flag);
void trs_screen_alternate(int flag);
void trs_screen_80x24(int flag);
void trs_screen_inverse(int flag);
void trs_screen_scroll(void);
void trs_screen_refresh(void);
extern int trs_lowercase;
void trs_reset(int poweron);
void trs_exit(void);
void trs_kb_reset(void);
void trs_kb_bracket(int shifted);
int trs_kb_mem_read(int address);
int trs_next_key(int wait);
void trs_kb_heartbeat(void);
void trs_xlate_keysym(int keysym);
void queue_key(int key);
int dequeue_key(void);
void clear_key_queue(void);
void trs_skip_next_kbwait(void);
extern int stretch_amount;
extern int trs_keydelay;
void trs_get_event(int wait);
extern volatile int x_poll_count;
void trs_printer_write(int value);
int trs_printer_read(void);
void trs_cassette_motor(int value);
void trs_cassette_out(int value);
int trs_cassette_in(void);
void trs_cassette_select(int value);
void trs_sound_out(int value);
int trs_joystick_in(void);
extern int trs_rom_size;
extern int trs_rom1_size;
extern int trs_rom1x_size;
extern int trs_rom3_size;
extern int trs_rom4p_size;
extern unsigned char trs_rom1[];
extern unsigned char trs_rom1x[];
extern unsigned char trs_rom3[];
extern unsigned char trs_rom4p[];
unsigned char trs_interrupt_latch_read(void);
unsigned char trs_nmi_latch_read(void);
void trs_interrupt_mask_write(unsigned char);
void trs_nmi_mask_write(unsigned char);
void trs_reset_button_interrupt(int state);
void trs_disk_intrq_interrupt(int state);
void trs_disk_drq_interrupt(int state);
void trs_disk_motoroff_interrupt(int state);
void trs_uart_err_interrupt(int state);
void trs_uart_rcv_interrupt(int state);
void trs_uart_snd_interrupt(int state);
void trs_timer_interrupt(int state);
void trs_timer_init(void);
void trs_timer_off(void);
void trs_timer_on(void);
void trs_timer_speed(int flag);
void trs_cassette_rise_interrupt(int dummy);
void trs_cassette_fall_interrupt(int dummy);
void trs_cassette_clear_interrupts(void);
int trs_cassette_interrupts_enabled(void);
void trs_cassette_update(int dummy);
extern int cassette_default_sample_rate;
void trs_orch90_out(int chan, int value);
void trs_cassette_reset(void);
extern time_t trs_timeoffset;
void trs_inityear(int year);
const char *trs_disk_get_name(int drive);
int trs_disk_set_name(int drive, const char *newname);
int trs_disk_create(const char *newname);
void trs_disk_change_all(void);
void trs_disk_debug(void);
int trs_disk_motoroff(void);
void trs_change_all(void);
void mem_video_page(int which);
void mem_bank(int which);
void mem_map(int which);
void mem_romin(int state);
void trs_debug(void);
typedef void (*trs_event_func)(int arg);
void trs_schedule_event(trs_event_func f, int arg, int tstates);
void trs_schedule_event_us(trs_event_func f, int arg, int us);
void trs_do_event(void);
void trs_cancel_event(void);
trs_event_func trs_event_scheduled(void);
void grafyx_write_x(int value);
void grafyx_write_y(int value);
void grafyx_write_data(int value);
int grafyx_read_data(void);
void grafyx_write_mode(int value);
void grafyx_write_xoffset(int value);
void grafyx_write_yoffset(int value);
void grafyx_write_overlay(int value);
void grafyx_set_microlabs(int on_off);
int grafyx_get_microlabs(void);
void grafyx_m3_reset();
int grafyx_m3_active(); /* true if currently intercepting video i/o */
void grafyx_m3_write_mode(int value);
unsigned char grafyx_m3_read_byte(int position);
int grafyx_m3_write_byte(int position, int value);
void hrg_onoff(int enable);
void hrg_write_addr(int addr, int mask);
void hrg_write_data(int data);
int hrg_read_data(void);
void trs_get_mouse_pos(int *x, int *y, unsigned int *buttons);
void trs_set_mouse_pos(int x, int y);
void trs_get_mouse_max(int *x, int *y, unsigned int *sens);
void trs_set_mouse_max(int x, int y, unsigned int sens);
int trs_get_mouse_type(void);
void stringy_init(void);
const char *stringy_get_name(int unit);
int stringy_set_name(int unit, const char *name);
int stringy_create(const char *name);
int stringy_in(int unit);
void stringy_out(int unit, int value);
void stringy_reset(void);
void stringy_change_all(void);
int put_twobyte(Ushort n, FILE* f);
int put_fourbyte(Uint n, FILE* f);
int get_twobyte(Ushort *n, FILE* f);
int get_fourbyte(Uint *n, FILE* f);
#endif /*_TRS_H*/