aboutsummaryrefslogtreecommitdiff
path: root/explosion.s
blob: dbc000d5eec008f8392452b219cd5dadb930d05e (plain)
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
; explosion seen when we're hit by enemy fire.

; flash the part of the screen where the lorchas are displayed.
; previously this flashed the whole screen, but it gave me a
; headache.

 .export _explosion
 .include "atari.inc"
 .importzp tmp1, tmp2
 .import _jsleep

counter = tmp1
color2save = tmp2

; extern void explosion(void);
_explosion:
; {
 ldy #3 ; loop counter, counts 3 2 1

 lda COLOR1
 and #$0f
 sta tmp2
;   {
@loop:
 lda #$0a
 sta counter

;     {
@wait4scanline:
;       {
 lda VCOUNT
 cmp #(4+8)*4
 bne @wait4scanline
;       }

 sta WSYNC

;       {
@scanlines:
 lda COLOR2
 and #$f0
 ora tmp2
 sta WSYNC
 sta COLPF2
 lda #0
 sta COLPF1

 lda VCOUNT
 cmp #(4+23)*4
 bne @scanlines ; stop changing color 2 lines after the bottom row of lorchas
;       }

 lda COLOR2 ; put colors back like they were for the rest of the frame
 sta COLPF2
 lda COLOR1
 sta COLPF1

 dec counter
 bne @wait4scanline
;     }

 ldx #0      ;\
 lda #$0a    ; | jsleep(10);
 jsr _jsleep ;/

 dey
 bne @loop ; we're done if Y==0
;   }

 rts
; }