junglejourney
view loader.oph @ 194:d0b47e8eaed2
Made changes to the joystick handling code based on the result of
modifying Elkulator to use constants for joystick input.
| author | David Boddie <david@boddie.org.uk> |
|---|---|
| date | Thu Sep 29 23:00:56 2011 +0200 |
| parents | 5502cf6e30cb |
| children | aa9f05624182 |
line source
1 ; Copyright (C) 2011 David Boddie <david@boddie.org.uk>
2 ;
3 ; This program is free software: you can redistribute it and/or modify
4 ; it under the terms of the GNU General Public License as published by
5 ; the Free Software Foundation, either version 3 of the License, or
6 ; (at your option) any later version.
7 ;
8 ; This program is distributed in the hope that it will be useful,
9 ; but WITHOUT ANY WARRANTY; without even the implied warranty of
10 ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 ; GNU General Public License for more details.
12 ;
13 ; You should have received a copy of the GNU General Public License
14 ; along with this program. If not, see <http://www.gnu.org/licenses/>.
16 .org $5180
18 init:
19 lda #22 ; MODE 5
20 jsr $ffee
21 lda #5
22 jsr $ffee
24 lda #23 ; disable flashing cursor
25 jsr $ffee
26 lda #1
27 jsr $ffee
28 ldx #7
29 cursor_loop:
30 lda #0
31 jsr $ffee
32 dex
33 bpl cursor_loop
35 jsr set_hidden_palette
37 ; Define ENVELOPEs.
38 lda #0
39 sta $70
40 define_envelopes_loop:
42 ldx $70
43 lda envelopes_high,x
44 tay
45 lda envelopes_low,x
46 tax
47 lda #8
48 jsr $fff1
50 inc $70
51 lda $70
52 cmp #4
53 bne define_envelopes_loop
55 ldx #0
56 init_load_window_loop:
58 lda init_load_window_vdu_bytes,x
59 jsr $ffee
60 inx
61 cpx #5
62 bne init_load_window_loop
64 lda #255
65 ldx #<title_block
66 ldy #>title_block
67 jsr $ffdd
69 jsr copy_title_up
71 lda #255
72 ldx #<sprites_block
73 ldy #>sprites_block
74 jsr $ffdd
76 lda #255
77 ldx #<chars_block
78 ldy #>chars_block
79 jsr $ffdd
81 lda #255
82 ldx #<code_block
83 ldy #>code_block
84 jsr $ffdd
86 jsr copy_title_down
87 jsr move_completed_screen_down
89 jmp $1e00
91 sprites_file_name: .byte "SPRITES", 13
92 chars_file_name: .byte "CHARS", 13
93 title_file_name: .byte "TITLE", 13
94 code_file_name: .byte "CODE", 13
96 sprites_block: .byte <sprites_file_name, >sprites_file_name
97 .byte 0, $54, 0, 0
98 .byte 0, $54, 0, 0
99 .byte $60, $03, 0, 0
100 .byte $60, $57, 0, 0
102 chars_block: .byte <chars_file_name, >chars_file_name
103 .byte $00, $3f, 0, 0
104 .byte $00, $3f, 0, 0
105 .byte $80, $12, 0, 0
106 .byte $80, $51, 0, 0
108 title_block: .byte <title_file_name, >title_file_name
109 .byte $00, $30, 0, 0
110 .byte $00, $30, 0, 0
111 .byte $00, $15, 0, 0
112 .byte $00, $45, 0, 0
114 code_block: .byte <code_file_name, >code_file_name
115 .byte $00, $1e, 0, 0
116 .byte $00, $1e, 0, 0
117 .byte $22, $20, 0, 0
118 .byte $22, $3e, 0, 0
120 init_load_window_vdu_bytes: .byte 28,0,30,19,27
122 set_hidden_palette:
124 lda #1
125 sta $70
126 lda #0
127 sta $71
128 jsr set_palette
130 ; Run on into the next routine.
132 set_core_palette:
134 lda #2
135 sta $70
136 lda #2
137 sta $71
138 jsr set_palette
140 lda #3
141 sta $70
142 lda #3
143 sta $71
144 jsr set_palette
146 rts
148 set_palette:
149 ; $70=logical colour
150 ; $71=physical colour
151 lda $70
152 sta $3dfb
153 lda $71
154 sta $3dfc
155 lda #0
156 sta $3dfd
157 sta $3dfe
158 sta $3dff
160 lda #$c
161 ldx #$fb
162 ldy #$3d
163 jsr $fff1
164 rts
166 envelopes_low: .byte <explosion_envelope, <damage_envelope, <item_envelope, <key_envelope
167 envelopes_high: .byte >explosion_envelope, >damage_envelope, >item_envelope, >key_envelope
169 explosion_envelope: .byte 1,1,252,0,0,10,0,0,126,0,0,130,126,126
170 damage_envelope: .byte 2,4,8,0,248,2,0,2,126,0,0,130,126,126
171 item_envelope: .byte 3,2,8,4,2,10,10,10,126,0,0,130,126,126
172 key_envelope: .byte 4,2,4,40,0,8,1,3,126,0,0,130,126,126
174 copy_title_up:
176 lda #$00
177 sta $70
178 lda #$30
179 sta $71
181 lda #$a0
182 sta $72
183 lda #$5a
184 sta $73
186 ldx #$17
188 copy_title_up_loop1:
190 ldy #0
191 copy_title_up_loop2:
193 lda ($70),y
194 sta ($72),y
195 iny
196 cpy #0
197 bne copy_title_up_loop2
199 clc
200 lda $72
201 adc #$40
202 sta $72
203 lda $73
204 adc #$01
205 sta $73
206 clc
208 lda $71
209 adc #$01
210 sta $71
212 dex
213 bpl copy_title_up_loop1
215 clc
216 rts
218 copy_title_down:
220 lda #$a0
221 sta $70
222 lda #$5a
223 sta $71
225 lda #$00
226 sta $72
227 lda #$18
228 sta $73
230 ldx #$05
232 copy_title_down_loop1:
234 ldy #0
235 copy_title_down_loop2:
237 lda ($70),y
238 sta ($72),y
239 iny
240 cpy #0
241 bne copy_title_down_loop2
243 clc
244 lda $70
245 adc #$40
246 sta $70
247 lda $71
248 adc #$01
249 sta $71
250 clc
252 lda $73
253 adc #$01
254 sta $73
256 dex
257 bpl copy_title_down_loop1
259 clc
260 rts
262 move_completed_screen_down:
264 lda #$20
265 sta $70
266 lda #$62
267 sta $71
269 lda #$00
270 sta $72
271 lda #$0f
272 sta $73
274 ldx #128
276 move_completed_screen_loop:
278 ldy #1
279 lda ($70),y
280 and #$0f
281 asl
282 asl
283 asl
284 asl
285 sta $80
286 dey
287 lda ($70),y
288 and #$0f
289 ora $80
290 sta ($72),y
292 lda #0
293 sta ($70),y
294 iny
295 sta ($70),y
297 clc
298 lda $70
299 adc #2
300 sta $70
301 lda $71
302 adc #0
303 sta $71
304 clc
306 lda $72
307 adc #1
308 sta $72
309 lda $73
310 adc #0
311 sta $73
312 clc
314 dex
315 cpx #0
316 bne move_completed_screen_next
318 ldx #128
320 clc
321 lda $70
322 adc #$40
323 sta $70
324 lda $71
325 adc #$00
326 sta $71
327 clc
329 move_completed_screen_next:
330 clc
332 lda $72
333 cmp #$00
334 bne move_completed_screen_loop
336 lda $73
337 cmp #$18
338 bne move_completed_screen_loop
340 clc
341 rts
