junglejourney

view loader.oph @ 199:aa9f05624182

Ensured that the keyboard controls cannot be used if the game is started with the joystick's Fire button. Fixed use of incorrectly initialised zero page memory when moving the projectile - this could cause an enemy to be destroyed if the player stood by a wall and fired a projectile at it. Added a *TAPE call to the loader to ensure that DFS workspace is no longer in use.
author David Boddie <david@boddie.org.uk>
date Sun Oct 02 19:45:54 2011 +0200
parents d0b47e8eaed2
children 2e43c7e90f42
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 lda #140
87 jsr $fff4 ; *TAPE
89 jsr copy_title_down
90 jsr move_completed_screen_down
92 jmp $1e00
94 sprites_file_name: .byte "SPRITES", 13
95 chars_file_name: .byte "CHARS", 13
96 title_file_name: .byte "TITLE", 13
97 code_file_name: .byte "CODE", 13
99 sprites_block: .byte <sprites_file_name, >sprites_file_name
100 .byte 0, $54, 0, 0
101 .byte 0, $54, 0, 0
102 .byte $60, $03, 0, 0
103 .byte $60, $57, 0, 0
105 chars_block: .byte <chars_file_name, >chars_file_name
106 .byte $00, $3f, 0, 0
107 .byte $00, $3f, 0, 0
108 .byte $80, $12, 0, 0
109 .byte $80, $51, 0, 0
111 title_block: .byte <title_file_name, >title_file_name
112 .byte $00, $30, 0, 0
113 .byte $00, $30, 0, 0
114 .byte $00, $15, 0, 0
115 .byte $00, $45, 0, 0
117 code_block: .byte <code_file_name, >code_file_name
118 .byte $00, $1e, 0, 0
119 .byte $00, $1e, 0, 0
120 .byte $32, $20, 0, 0
121 .byte $32, $3e, 0, 0
123 init_load_window_vdu_bytes: .byte 28,0,30,19,27
125 set_hidden_palette:
127 lda #1
128 sta $70
129 lda #0
130 sta $71
131 jsr set_palette
133 ; Run on into the next routine.
135 set_core_palette:
137 lda #2
138 sta $70
139 lda #2
140 sta $71
141 jsr set_palette
143 lda #3
144 sta $70
145 lda #3
146 sta $71
147 jsr set_palette
149 rts
151 set_palette:
152 ; $70=logical colour
153 ; $71=physical colour
154 lda $70
155 sta $3dfb
156 lda $71
157 sta $3dfc
158 lda #0
159 sta $3dfd
160 sta $3dfe
161 sta $3dff
163 lda #$c
164 ldx #$fb
165 ldy #$3d
166 jsr $fff1
167 rts
169 envelopes_low: .byte <explosion_envelope, <damage_envelope, <item_envelope, <key_envelope
170 envelopes_high: .byte >explosion_envelope, >damage_envelope, >item_envelope, >key_envelope
172 explosion_envelope: .byte 1,1,252,0,0,10,0,0,126,0,0,130,126,126
173 damage_envelope: .byte 2,4,8,0,248,2,0,2,126,0,0,130,126,126
174 item_envelope: .byte 3,2,8,4,2,10,10,10,126,0,0,130,126,126
175 key_envelope: .byte 4,2,4,40,0,8,1,3,126,0,0,130,126,126
177 copy_title_up:
179 lda #$00
180 sta $70
181 lda #$30
182 sta $71
184 lda #$a0
185 sta $72
186 lda #$5a
187 sta $73
189 ldx #$17
191 copy_title_up_loop1:
193 ldy #0
194 copy_title_up_loop2:
196 lda ($70),y
197 sta ($72),y
198 iny
199 cpy #0
200 bne copy_title_up_loop2
202 clc
203 lda $72
204 adc #$40
205 sta $72
206 lda $73
207 adc #$01
208 sta $73
209 clc
211 lda $71
212 adc #$01
213 sta $71
215 dex
216 bpl copy_title_up_loop1
218 clc
219 rts
221 copy_title_down:
223 lda #$a0
224 sta $70
225 lda #$5a
226 sta $71
228 lda #$00
229 sta $72
230 lda #$18
231 sta $73
233 ldx #$05
235 copy_title_down_loop1:
237 ldy #0
238 copy_title_down_loop2:
240 lda ($70),y
241 sta ($72),y
242 iny
243 cpy #0
244 bne copy_title_down_loop2
246 clc
247 lda $70
248 adc #$40
249 sta $70
250 lda $71
251 adc #$01
252 sta $71
253 clc
255 lda $73
256 adc #$01
257 sta $73
259 dex
260 bpl copy_title_down_loop1
262 clc
263 rts
265 move_completed_screen_down:
267 lda #$20
268 sta $70
269 lda #$62
270 sta $71
272 lda #$00
273 sta $72
274 lda #$0f
275 sta $73
277 ldx #128
279 move_completed_screen_loop:
281 ldy #1
282 lda ($70),y
283 and #$0f
284 asl
285 asl
286 asl
287 asl
288 sta $80
289 dey
290 lda ($70),y
291 and #$0f
292 ora $80
293 sta ($72),y
295 lda #0
296 sta ($70),y
297 iny
298 sta ($70),y
300 clc
301 lda $70
302 adc #2
303 sta $70
304 lda $71
305 adc #0
306 sta $71
307 clc
309 lda $72
310 adc #1
311 sta $72
312 lda $73
313 adc #0
314 sta $73
315 clc
317 dex
318 cpx #0
319 bne move_completed_screen_next
321 ldx #128
323 clc
324 lda $70
325 adc #$40
326 sta $70
327 lda $71
328 adc #$00
329 sta $71
330 clc
332 move_completed_screen_next:
333 clc
335 lda $72
336 cmp #$00
337 bne move_completed_screen_loop
339 lda $73
340 cmp #$18
341 bne move_completed_screen_loop
343 clc
344 rts