aboutsummaryrefslogtreecommitdiff
path: root/explosion.s
blob: a803d5e393c152f6482ec710781c1f527bbf2ac3 (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
72
73
74
75
76
77
78
; explosion seen when we're hit by enemy fire.
; currently just flashes the screen. the apple version is
; kinda funky-looking, best way I can describe it is that it
; looks like TV static. would be hard to imitate that on the
; atari. maybe there should be screen-shaking going on?

; original code was in C, and looked like:
;; for(i = 0; i < 3; i++) {
;; 	unsigned char color = PEEK(710) & 0xf0;
;; 	unsigned char textcolor = PEEK(709);
;; 	POKE(709,0);
;; 	POKE(710, color | 0x0c);
;; 	jsleep(10);
;; 	POKE(710, color & 0xf0);
;; 	jsleep(10);
;; 	POKE(709,textcolor);
;; }

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

iloop_count = tmp1

; extern void explosion(void);
_explosion:
; {

 ldy #3 ; loop counter, counts 3 2 1

;   {
@loop:
 lda #$03
 sta iloop_count

@iloop:
 ldx #0         ; jsleep(2)
 lda #$02
 jsr _jsleep

 ldx #2
@b:
 lda VCOUNT
 cmp #(4+8)*4
 bne @b

@d:
 sta WSYNC
 lda RANDOM
 lsr ; avoid reading I/O registers, I think it can lock up SDX
 sta CHBASE
 lda VCOUNT
 cmp #(4+23)*4
 bne @d
 lda #$e0
 sta CHBASE

 lda RTCLOK+2
@c:
cmp RTCLOK+2
 beq @c
 dex
 bne @b

 dec iloop_count
 bne @iloop

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

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

 rts
; }