junglejourney

view romloader.oph @ 243:dae2a8efc58f

Corrected the instructions slightly. Added the missing instructions for the ROM cartridge version of the game.
author David Boddie <david@boddie.org.uk>
date Sun Apr 06 00:01:57 2014 +0200
parents 59f37c9e74e4
children
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 $8000
17 rom_start:
18 jmp language_entry
19 jmp service_entry
21 ; ROM type
22 .byte $c2 ; 6502 code (2), language ($40), service ($80)
24 copyright_offset:
25 .byte [copyright_string - rom_start - 1]
27 ; Version
28 .byte 1
30 ; Title string
31 .byte "Jungle Journey (loader)", 0
33 ; Version string
34 .byte "1.0", 0
36 copyright_string:
37 .byte "(C) 2011 David Boddie", 0
39 ; Second processor relocation address
40 .byte 0, $80, 0, 0
42 language_entry:
44 jmp jungle_code
46 service_entry:
48 cmp #4
49 beq service_command
51 service_entry_exit:
52 rts
54 rom_name: .byte "JUNGLE", 13
56 service_command:
58 tya ; push Y and X registers onto the stack
59 pha
60 txa
61 pha
63 ldx #0
64 service_command_loop:
66 lda ($f2),y
67 cmp rom_name,x
68 bne service_command_exit
69 inx
70 iny
71 cpx #7
72 bne service_command_loop
74 jsr jungle_code
75 lda #0
76 rts
78 service_command_exit:
79 pla ; pop Y and X registers off the stack
80 tax
81 pla
82 tay
83 lda #4 ; restore A
84 rts
86 jungle_code:
88 lda #22 ; MODE 5
89 jsr $ffee
90 lda #5
91 jsr $ffee
93 lda #23 ; disable flashing cursor
94 jsr $ffee
95 lda #1
96 jsr $ffee
97 ldx #7
98 cursor_loop:
99 lda #0
100 jsr $ffee
101 dex
102 bpl cursor_loop
104 jsr set_hidden_palette
106 ; Define ENVELOPEs.
107 lda #0
108 sta $70
109 define_envelopes_loop:
111 ldx $70
112 lda envelopes_high,x
113 tay
114 lda envelopes_low,x
115 tax
116 lda #8
117 jsr $fff1
119 inc $70
120 lda $70
121 cmp #4
122 bne define_envelopes_loop
124 jsr copy_title_from_rom
126 lda #140
127 jsr $fff4 ; *TAPE
129 jsr copy_title_down
131 ldx #0
132 show_input_message_loop:
134 lda input_message,x
135 jsr $ffee
136 inx
137 cpx #21
138 bne show_input_message_loop
140 wait_loop:
142 lda #128
143 ldx #0
144 jsr $fff4
145 cpx #0 ; fire button pressed?
146 beq wait_no_joystick
147 jmp continue
149 wait_no_joystick:
151 lda #129 ; returns y=255 or 0
152 ldx #157 ; SPACE
153 ldy #255
154 jsr $fff4
155 cpy #255
156 bne wait_loop
158 continue:
159 clc
161 jsr move_completed_screen_down
162 jsr copy_launch_code
164 jmp $1e00
166 input_message: .byte 17,3, 31,2,28, "Press SPACE/FIRE"
168 set_hidden_palette:
170 lda #1
171 sta $70
172 lda #0
173 sta $71
174 jsr set_palette
176 ; Run on into the next routine.
178 set_core_palette:
180 lda #2
181 sta $70
182 lda #2
183 sta $71
184 jsr set_palette
186 lda #3
187 sta $70
188 lda #3
189 sta $71
190 jsr set_palette
192 rts
194 set_palette:
195 ; $70=logical colour
196 ; $71=physical colour
197 lda $70
198 sta $3dfb
199 lda $71
200 sta $3dfc
201 lda #0
202 sta $3dfd
203 sta $3dfe
204 sta $3dff
206 lda #$c
207 ldx #$fb
208 ldy #$3d
209 jsr $fff1
210 rts
212 envelopes_low: .byte <explosion_envelope, <damage_envelope, <item_envelope, <key_envelope
213 envelopes_high: .byte >explosion_envelope, >damage_envelope, >item_envelope, >key_envelope
215 explosion_envelope: .byte 1,1,252,0,0,10,0,0,126,0,0,130,126,126
216 damage_envelope: .byte 2,4,8,0,248,2,0,2,126,0,0,130,126,126
217 item_envelope: .byte 3,2,8,4,2,10,10,10,126,0,0,130,126,126
218 key_envelope: .byte 4,2,4,40,0,8,1,3,126,0,0,130,126,126
220 copy_title_from_rom:
222 lda #$00
223 sta $70
224 lda #$84
225 sta $71
227 lda #$a0
228 sta $72
229 lda #$5a
230 sta $73
232 ldx #$17
234 copy_title_from_rom_loop1:
236 ldy #0
237 copy_title_from_rom_loop2:
239 lda ($70),y
240 sta ($72),y
241 iny
242 cpy #0
243 bne copy_title_from_rom_loop2
245 clc
246 lda $72
247 adc #$40
248 sta $72
249 lda $73
250 adc #$01
251 sta $73
252 clc
254 lda $71
255 adc #$01
256 sta $71
258 dex
259 bpl copy_title_from_rom_loop1
261 clc
262 rts
264 copy_title_down:
266 lda #$a0
267 sta $70
268 lda #$5a
269 sta $71
271 lda #$00
272 sta $72
273 lda #$18
274 sta $73
276 ldx #$05
278 copy_title_down_loop1:
280 ldy #0
281 copy_title_down_loop2:
283 lda ($70),y
284 sta ($72),y
285 iny
286 cpy #0
287 bne copy_title_down_loop2
289 clc
290 lda $70
291 adc #$40
292 sta $70
293 lda $71
294 adc #$01
295 sta $71
296 clc
298 lda $73
299 adc #$01
300 sta $73
302 dex
303 bpl copy_title_down_loop1
305 clc
306 rts
308 move_completed_screen_down:
310 lda #$20
311 sta $70
312 lda #$62
313 sta $71
315 lda #$00
316 sta $72
317 lda #$0f
318 sta $73
320 ldx #128
322 move_completed_screen_loop:
324 ldy #1
325 lda ($70),y
326 and #$0f
327 asl
328 asl
329 asl
330 asl
331 sta $80
332 dey
333 lda ($70),y
334 and #$0f
335 ora $80
336 sta ($72),y
338 lda #0
339 sta ($70),y
340 iny
341 sta ($70),y
343 clc
344 lda $70
345 adc #2
346 sta $70
347 lda $71
348 adc #0
349 sta $71
350 clc
352 lda $72
353 adc #1
354 sta $72
355 lda $73
356 adc #0
357 sta $73
358 clc
360 dex
361 cpx #0
362 bne move_completed_screen_next
364 ldx #128
366 clc
367 lda $70
368 adc #$40
369 sta $70
370 lda $71
371 adc #$00
372 sta $71
373 clc
375 move_completed_screen_next:
376 clc
378 lda $72
379 cmp #$00
380 bne move_completed_screen_loop
382 lda $73
383 cmp #$18
384 bne move_completed_screen_loop
386 clc
387 rts
389 copy_sprites_from_rom:
391 lda #$80
392 sta $70
393 lda #$ae
394 sta $71
396 lda #$00
397 sta $72
398 lda #$54
399 sta $73
401 ldx #$35
403 copy_sprites_from_rom_loop1:
405 ldy #0
406 copy_sprites_from_rom_loop2:
408 lda ($70),y
409 sta ($72),y
410 iny
411 cpy #16
412 bne copy_sprites_from_rom_loop2
414 clc
415 lda $70
416 adc #$10
417 sta $70
418 lda $71
419 adc #$00
420 sta $71
421 clc
423 lda $72
424 adc #$10
425 sta $72
426 lda $73
427 adc #$00
428 sta $73
429 clc
431 dex
432 bpl copy_sprites_from_rom_loop1
434 clc
435 rts
437 copy_chars_from_rom:
439 lda #$00
440 sta $70
441 lda #$9c
442 sta $71
444 lda #$00
445 sta $72
446 lda #$3f
447 sta $73
449 copy_chars_from_rom_loop1:
451 ldy #0
452 copy_chars_from_rom_loop2:
454 lda ($70),y
455 sta ($72),y
456 iny
457 cpy #$80
458 bne copy_chars_from_rom_loop2
460 clc
461 lda $70
462 adc #$80
463 sta $70
464 lda $71
465 adc #$00
466 sta $71
467 clc
469 lda $72
470 adc #$80
471 sta $72
472 lda $73
473 adc #$00
474 sta $73
475 clc
477 cmp #$51
478 bne copy_chars_from_rom_loop1
479 lda $72
480 cmp #$80
481 bne copy_chars_from_rom_loop1
483 clc
484 rts
486 launch_code:
488 ldx #[start_game - launch_code]
489 ldy #$1e
490 jsr $fff7
492 start_game: .byte "*JUNGLECODE", 13, 0
494 copy_launch_code: ; copy the launch code to $1e00
496 lda #<launch_code
497 sta $70
498 lda #>launch_code
499 sta $71
501 lda #$00
502 sta $72
503 lda #$1e
504 sta $73
506 ldy #[copy_launch_code - launch_code - 1]
508 copy_launch_code_loop:
510 lda ($70),y
511 sta ($72),y
512 dey
513 bpl copy_launch_code_loop
515 clc
516 rts