-
Notifications
You must be signed in to change notification settings - Fork 0
/
scr-screen.s65
246 lines (175 loc) · 5.86 KB
/
scr-screen.s65
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
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
;-------------------------------------------------------------------------
; This code is free software: you can redistribute it and/or modify it
; under the terms of the GNU General Public License as published by
; the Free Software Foundation, either version 3 of the License, or
; (at your option) any later version.
; This code is distributed in the hope that it will be useful, but
; WITHOUT ANY WARRANTY; without even the implied warranty of
; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
; General Public License for more details.
; You should have received a copy of the GNU General Public License
; along with this code. If not, see <https://www.gnu.org/licenses/>.
;-------------------------------------------------------------------------
draw_timer_adjustment=0
.include "framework.s65"
;-------------------------------------------------------------------------
.section zp
main_crtc_addr: .fill 2
ptr: .fill 2
counter: .fill 1
.send zp
.section code
fx_init_1: .proc
; cheekily fill in $3000...$57ff with blue...
lda #22
jsr oswrch
lda #1
jsr oswrch
lda #17
jsr oswrch
lda #130
jsr oswrch
lda #12
jsr oswrch
lda #22
jsr oswrch
lda #5
jsr oswrch
lda #17
jsr oswrch
lda #129
jsr oswrch
lda #12
jsr oswrch
.set_crtc 12,$0c
.set_crtc 13,$00
.set_crtc 6,25
; .set_crtc 7,31
ldx #<load_scr_hud
ldy #>load_scr_hud
jsr oscli
ldx #2
ldy #4
jsr vdu19
ldx #3
ldy #3
jsr vdu19
rts
vdu19:
lda #19
jsr oswrch
txa
jsr oswrch
tya
jsr oswrch
lda #0
jsr oswrch
jsr oswrch
jmp oswrch
load_scr_hud:
.text "LOAD SCR-HU2 FFFF6000",13
.pend
;-------------------------------------------------------------------------
fx_init_2: .proc
lda #<crtc_addr(main_addr_0)
sta main_crtc_addr+0
lda #>crtc_addr(main_addr_0)
sta main_crtc_addr+1
rts
.pend
;-------------------------------------------------------------------------
wait_roughly_x_scanlines: .proc
loop:
.nops 128-5
dex
bne loop
rts
.pend
top_addr=$6000
main_addr_0=$6280
main_addr_1=$3280
dashboard_addr=$6000+19*320
fx_update: .proc
; .set_crtc 12,$0c
; .set_crtc 13,$00
inc counter
lda counter
and #31
bne +
lda main_crtc_addr+0
eor #(<crtc_addr(main_addr_0))^(<crtc_addr(main_addr_1))
sta main_crtc_addr+0
lda main_crtc_addr+1
eor #(>crtc_addr(main_addr_0))^(>crtc_addr(main_addr_1))
sta main_crtc_addr+1
+
; prepare for start of next screen
.set_crtc 13,<crtc_addr(top_addr)
.set_crtc 12,>crtc_addr(top_addr)
.set_crtc 7,$ff
.set_crtc 6,$ff
rts
.pend
third_split=true
fx_draw: .proc
; 2/2 rows of HUD part, and prepare address for game
; part
lda #$01
sta $fe21 ;6
.set_crtc 4,1 ;22
lda #12 ;2
sta $fe00 ;8
lda main_crtc_addr+1 ;11
sta $fe01 ;18
lda #13 ;20
sta $fe00 ;26
lda main_crtc_addr+0 ;29
sta $fe01 ;36 52
lda #$07
sta $fe21
; wait until in game part
jsr cycles_wait_1024
jsr cycles_wait_1024
jsr cycles_wait_128
.nops 60
; 18/18 rows of game part, and prepare address for
; dashboard part
lda #$02
sta $fe21
.if third_split
.set_crtc 4,16
.set_crtc 12,>crtc_addr(dashboard_addr)
.set_crtc 13,<crtc_addr(dashboard_addr)
.else
.set_crtc 4,36
.set_crtc 6,23
.set_crtc 7,32
.endif
lda #$07
sta $fe21
ldx #134
jsr wait_roughly_x_scanlines
lda #$03
sta $fe21
.if third_split
; 6/19 rows of dashboard part.
.set_crtc 4,19
.set_crtc 6,6
.set_crtc 7,13
; jsr cycles_wait_128
; .set_crtc 6,23
; .set_crtc 7,32
.endif
jsr cycles_wait_128
lda #$07
sta $fe21
; wait for vsync
lda #2
-
bit $fe4d
beq -
sta $fe4d
rts
.pend
;-------------------------------------------------------------------------
.send code