-
Notifications
You must be signed in to change notification settings - Fork 2
/
x16.inc
209 lines (186 loc) · 4.49 KB
/
x16.inc
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
.ifndef X16_INC
X16_INC = 1
__CX16__ = 1
SD_DEVICE = 1
HOST_DEVICE = 8
DISK_DEVICE = HOST_DEVICE
; RAM Addresses
; Kernal Registers
r0 = $02
r0L = r0
r0H = r0+1
r1 = $04
r1L = r1
r1H = r1+1
r2 = $06
r2L = r2
r2H = r2+1
r3 = $08
r3L = r3
r3H = r3+1
r4 = $0A
r4L = r4
r4H = r4+1
r5 = $0C
r5L = r5
r5H = r5+1
r6 = $0E
r6L = r6
r6H = r6+1
r7 = $10
r7L = r7
r7H = r7+1
r8 = $12
r8L = r8
r8H = r8+1
r9 = $14
r9L = r9
r9H = r9+1
r10 = $16
r10L = r10
r10H = r10+1
r11 = $18
r11L = r11
r11H = r11+1
r12 = $1A
r12L = r12
r12H = r12+1
r13 = $1C
r13L = r13
r13H = r13+1
r14 = $1E
r14L = r14
r14H = r14+1
r15 = $20
r15L = r15
r15H = r15+1
; Zero-Page userspace
ZP_PTR_1 = $7E ; first four pointers for temporary use only
ZP_PTR_2 = $22
ZP_PTR_3 = $24
ZP_PTR_4 = $26
; I/O Registers
VERA_addr_low = $9F20
VERA_addr_high = $9F21
VERA_addr_bank = $9F22
VERA_data0 = $9F23
VERA_data1 = $9F24
VERA_ctrl = $9F25
VERA_ien = $9F26
VERA_isr = $9F27
VERA_irqline_l = $9F28
VERA_dc_video = $9F29
VERA_dc_hscale = $9F2A
VERA_dc_vscale = $9F2B
VERA_dc_border = $9F2C
VERA_dc_hstart = $9F29
VERA_dc_hstop = $9F2A
VERA_dc_vsstart = $9F2B
VERA_dc_vstop = $9F2C
VERA_L0_config = $9F2D
VERA_L0_mapbase = $9F2E
VERA_L0_tilebase = $9F2F
VERA_L0_hscroll_l = $9F30
VERA_L0_hscroll_h = $9F31
VERA_L0_vscroll_l = $9F32
VERA_L0_vscroll_h = $9F33
VERA_L1_config = $9F34
VERA_L1_mapbase = $9F35
VERA_L1_tilebase = $9F36
VERA_L1_hscroll_l = $9F37
VERA_L1_hscroll_h = $9F38
VERA_L1_vscroll_l = $9F39
VERA_L1_vscroll_h = $9F3A
VERA_audio_ctrl = $9F3B
VERA_audio_rate = $9F3C
VERA_audio_data = $9F3D
VERA_spi_data = $9F3E
VERA_spi_ctrl = $9F3F
ROM_BANK = $01
RAM_BANK = $00
YM_reg = $9F40
YM_data = $9F41
; Emulator Registers
GIF_ctrl = $9FB5
; ROM Banks
KERNAL_ROM_BANK = 0
BASIC_ROM_BANK = 4
; Banked Addresses
RAM_WIN = $A000
RAM_WIN_SIZE = $2000
ROM_WIN = $C000
; Kernal Subroutines
MEMORY_FILL := $FEE4
MEMORY_COPY := $FEE7
MEMORY_CRC := $FEEA
MEMORY_DECOMPRESS := $FEED
GRAPH_LL_init := $FEF6
GRAPH_LL_get_info := $FEF9
GRAPH_LL_set_palette := $FEFC
GRAPH_LL_cursor_position := $FEFF
GRAPH_LL_cursor_next_line := $FF02
GRAPH_LL_get_pixel := $FF05
GRAPH_LL_get_pixels := $FF08
GRAPH_LL_set_pixel := $FF0B
GRAPH_LL_set_pixels := $FF0E
GRAPH_LL_set_8_pixels := $FF11
GRAPH_LL_set_8_pixels_opaque := $FF14
GRAPH_LL_fill_pixels := $FF17
GRAPH_LL_filter_pixels := $FF1A
GRAPH_LL_move_pixels := $FF1D
CLOCK_SET_DATE_TIME := $FF4D
CLOCK_GET_DATE_TIME := $FF50
JOYSTICK_SCAN := $FF53
JOYSTICK_GET := $FF56
MOUSE_CONFIG := $FF68
MOUSE_GET := $FF6B
MOUSE_SCAN := $FF71
SCINIT := $FF81
IOINIT := $FF84
RAMTAS := $FF87
RESTOR := $FF8A
SETLFS := $FFBA
SETNAM := $FFBD
OPEN := $FFC0
CLOSE := $FFC3
CHKIN := $FFC6
CHKOUT := $FFC9
CLRCHN := $FFCC
CHRIN := $FFCF
CHROUT := $FFD2
LOAD := $FFD5
SAVE := $FFD8
SETTIM := $FFDB
RDTIM := $FFDE
STOP := $FFE1
GETIN := $FFE4
; BASIC Vectors
BASIC_PANIC := $C000
BASIC_INIT := $C003
; VRAM Addresses
VRAM_petscii = $0F800
VRAM_psg = $1F9C0
VRAM_palette = $1FA00
VRAM_sprattr = $1FC00
; IRQs
IRQVec := $0314
BRKVec := $0316
NMIVec := $0318
; Macros
.macro VERA_SET_ADDR addr, stride
.ifnblank stride
.if stride < 0
lda #((^addr) | $08 | ((0-stride) << 4))
.else
lda #((^addr) | (stride << 4))
.endif
.else
lda #(^addr) | $10
.endif
sta VERA_addr_bank
lda #(>addr)
sta VERA_addr_high
lda #(<addr)
sta VERA_addr_low
.endmacro
.endif