-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathburn.asm
180 lines (156 loc) · 2.68 KB
/
burn.asm
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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
; *********************************************
; Burn! - 256b Atari mini-demo
; Kane / Suspect
; Luton, 25-27/10/2018
; Copyright (C) 2021 Pawel Matusz. Distributed under the terms of the GNU GPL-3.0.
;
; One-off after 27 years away from the Atari...
; *********************************************
start = $4000
scr = $5000
charset = $e000+32*8
width = 32 ; narrow playfield
heigth = 56
sync = 20
seccnt = $90
temp1 = $91
icl "registers.asm"
org start
// create display list
ldx #heigth+>scr-1
dlcreate
jsr dl_elem_add
jsr dl_elem_add
dex
cpx #>scr
bpl dlcreate
dec SDMCTL ; $21 = narrow playfield
lda #<dl
sta SDLSTL
lda #$40
sta SDLSTH
sta GPRIOR
sta RTCLOKM
sta RTCLOKL
// main loop
mainloop
ldy #sync
vsync
cpy VCOUNT
bne vsync
lda RTCLOKM ; move increment time counter approx every second
and #$0f
sta seccnt
inc RTCLOKL ; speed up clock ticks
ldx #0
eventcheck
lda text,x ; valid time: from
inx
cmp seccnt ; A-mem
bpl e1
lda text,x ; valid time: to
inx
cmp seccnt
bmi e2
// print char
lda text,x ;color, column
inx
ldy text,x ; char
stx temp1
sty printline+1
tay
and #$0f
asl
sta scrptr1
tya
and #$f0
sta COLOR4
lda #>scr
sta scrptr1+1
printchar
ldy #7
printline ; print one font pixel line
lda charset,y
ldx #7
printdot ; print single font "pixel"
lsr
bcc nodot
pha
lda #$ff
scrptr1 = *+1
sta scr,x
pla
nodot
dex
bpl printdot
inc scrptr1+1
dey
bpl printline
ldx temp1
bne e3
e1 inx
e2 inx
e3 inx
cpx #textend-text
bmi eventcheck
.proc fire ; overlay the fire effect on the screen
ldy #heigth+>scr-1
fire1
sty f1+2
sty f5+2
iny
sty f6+2
dey
dey
sty f2+2
sty f3+2
sty f4+2
ldx #width-2
fire2 ; average of 4 neighbours
f1 lda scr,x
inx
f2 adc scr+$100,x
dex
f3 adc scr+$100,x
dex
f4 adc scr+$100,x
lsr
lsr
inx
f5 sta scr,x
; bit RTCLOKL
; beq f7
bit RANDOM
bpl f7
; bne f7
f6 sta scr,x
f7
dex
bne fire2
cpy #>scr
bne fire1
.endp ; end of fire
jmp mainloop
// add Display List element - one mode 15 line and one blank line
dl_elem_add
lda #$4f
jsr s1
txa
s1 sta dl1 ; for this to work, "dl" must start on an even address
inc s1+1
bne s2
inc s1+2
s2
inc s1+1
rts
text
.byte $00, $03, $13, ["S"-32]*8, $01, $04, $19, ["V"-32]*8
.byte $05, $0A, $52, ["R"-32]*8, $06, $0B, $AA, ["Z"-32]*8, $07, $0C, $96, ["L"-32]*8, $0C, $0E, $06, [63-32]*8
textend
dl .byte $70
; .align 2,0
dl1
;.byte $4F, a(scr), 0, $4F, a(scr), 0, $41, a(dl)
org dl1+[2*4*heigth]
dl2 .byte $41, a(dl)
; .byte $4B, $41, $4E, $45