-
Notifications
You must be signed in to change notification settings - Fork 0
/
vcs.a
154 lines (143 loc) · 1.74 KB
/
vcs.a
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
VSYNC = $00
VBLANK = $01
WSYNC = $02
RSYNC = $03
NUSIZ0 = $04
NUSIZ1 = $05
COLUP0 = $06
COLUP1 = $07
COLUPF = $08
COLUBK = $09
CTRLPF = $0A
REFP0 = $0B
REFP1 = $0C
PF0 = $0D
PF1 = $0E
PF2 = $0F
RESP0 = $10
RESP1 = $11
RESM0 = $12
RESM1 = $13
RESBL = $14
AUDC0 = $15
AUDC1 = $16
AUDF0 = $17
AUDF1 = $18
AUDV0 = $19
AUDV1 = $1A
GRP0 = $1B
GRP1 = $1C
ENAM0 = $1D
ENAM1 = $1E
ENABL = $1F
HMP0 = $20
HMP1 = $21
HMM0 = $22
HMM1 = $23
HMBL = $24
VDELP0 = $25
VDELP1 = $26
VDELBL = $27
RESMP0 = $28
RESMP1 = $29
HMOVE = $2A
HMCLR = $2B
CXCLR = $2C
CXM0P = $30
CXM1P = $31
CXP0FB = $32
CXP1FB = $33
CXM0FB = $34
CXM1FB = $35
CXBLPF = $36
CXPPMM = $37
INPT0 = $38
INPT1 = $39
INPT2 = $3A
INPT3 = $3B
INPT4 = $3C
INPT5 = $3D
SWCHA = $0280
SWACNT = $0281
SWCHB = $0282
SWBCNT = $0283
INTIM = $0284
INSTAT = $0285
TIM1T = $0294
TIM8T = $0295
TIM64T = $0296
T1024T = $0297
!macro PAL {
VBLANK_LINES = 45
PICTURE_LINES = 228
OVERSCAN_LINES = 36
VBLANK_TIMER = VBLANK_LINES*75/64
OVERSCAN_TIMER = OVERSCAN_LINES*75/64
}
!macro NTSC {
VBLANK_LINES = 37
PICTURE_LINES = 192
OVERSCAN_LINES = 30
VBLANK_TIMER = VBLANK_LINES*75/64
OVERSCAN_TIMER = OVERSCAN_LINES*75/64
}
!macro VSync {
lda #2
sta VSYNC
sta WSYNC
sta WSYNC
sta WSYNC
lda #0
sta VSYNC
sta WSYNC
}
!macro VBlankBegin {
lda #VBLANK_TIMER
sta TIM64T
}
!macro VBlankEnd {
.wait
lda TIM64T
bne .wait
sta WSYNC
lda #0
sta VBLANK
}
!macro OverscanBegin {
sta WSYNC
lda #2
sta VBLANK
lda #OVERSCAN_TIMER
sta TIM64T
sta WSYNC
}
!macro OverscanEnd {
.wait
lda TIM64T
bne .wait
sta WSYNC
}
!macro End .size {
!if .size = 2 {
* = $f7fc
}
!if .size = 4 {
* = $fffc
}
!word _vcs_init
!word _vcs_init
}
!macro Init {
* = $f000
_vcs_init
sei
cld
ldx #$ff
txs
inx
lda #0
.clr
sta 0,x
dex
bne .clr
}