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
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
|
; this file needs to be assembled with:
; cl65 -o newtitle.xex -t none newtitle.s
; It contains only an init routine, no run address.
.include "atari.inc"
; location sound code will look at to see whether sound
; is disabled (0 = enabled, !0 = disabled). If you
; change this here, change it in sounds.h also!
sound_disabled = $06ff
; where our screen was loaded (see newtitle.pl)
screendata = $9000
; homebrew atari xex header
.word $ffff
.word version
.word end-1
; needs to be above the BSS (see taipan.map). we'll place it right at
; the end of screendata.
.org $a800
version:
.incbin "ver.dat"
help:
.incbin "help.dat"
helphitbl:
.byte >version
.byte >help
.byte >(help+32)
.byte >(help+64)
.byte >(help+96)
.byte 0
helplotbl:
.byte <version
.byte <help
.byte <(help+32)
.byte <(help+64)
.byte <(help+96)
.byte 0
helpshowing = FR1
; N<space> or FF (inverse)
sounddisp = help + 78
colorchoices:
.byte $c0,$10,$00
colorcount = (*-colorchoices)-1
textchoices:
.byte $0c,$0e,$0a
textcount = (*-textchoices)-1
; executable code here
start:
; setup color registers
lda colorchoices
sta COLOR2 ; text bg
lda textchoices
sta COLOR1 ; text fg
; turn off screen, in case vblank happens while we work
lda #0
sta FR0
sta SDMCTL
; build our display list
; TODO, for now it's hardcoded (see 'dlist' below)
; wait for the next frame, to avoid graphics glitching
jsr wait1jiffy
; setup our display list
lda SDLSTL
sta FR0
lda SDLSTH
sta FR0+1
lda #<dlist
sta SDLSTL
lda #>dlist
sta SDLSTH
; switch to narrow playfield, enable screen
lda #$21
sta SDMCTL
; clear any keypress that happened during loading
lda #$ff
sta CH
ldx #0 ; X = index into bg color choices
ldy #0 ; Y = index into text color choices
; wait for user to press a key
wait4key:
lda colorchoices,x
sta COLOR2
lda textchoices,y
sta COLOR1
lda CH
cmp #$ff
beq wait4key
cmp #28 ; Escape key
bne not_esc
; show next line of help
showhelp:
stx FR1+1
ldx helpshowing
inx
loadhelp:
lda helphitbl,x
bne helpok
ldx #0
beq loadhelp
helpok:
sta help_lms+1
lda helplotbl,x
sta help_lms
stx helpshowing
ldx FR1+1
clc
bcc x_ok
not_esc:
cmp #62 ; S key
bne not_s
jsr enable_disable_sound
clc
bcc showhelp
not_s:
cmp #21 ; B key
bne not_b
dex
bpl x_ok
ldx #colorcount
bne x_ok
not_b:
cmp #45 ; T key
bne keyok
dey
bpl x_ok
ldy #textcount
x_ok:
lda #$ff
sta CH
bne wait4key
keyok:
; eat the keypress
lda #$ff
sta CH
rts ; return to DOS (which loads the rest of the game)
wait1jiffy:
lda RTCLOK+2
wait:
cmp RTCLOK+2
beq wait
rts
enable_disable_sound:
lda #2
sta helpshowing
lda sound_disabled
eor #$01
sta sound_disabled
beq now_on
lda #166 ; inverse F screen code
sta sounddisp
sta sounddisp+1
rts
now_on:
lda #174 ; inverse N screen code
sta sounddisp
lda #128 ; inverse space screen code
sta sounddisp+1
rts
; display list here
dlist:
.byte $70 ; 24 scanlines of blanks
.byte $70
.byte $70
; .byte $30 ; 4 more since image is only 184 lines tall
.byte $0f | $40 ; LMS, BASIC mode 8
.word screendata
.repeat 127
.byte $0f ; 127 more scanlines of mode 8
.endrepeat
.byte $0f | $40 ; Hit 4K boundary, LMS again
.word screendata+$1000
.repeat 55
.byte $0f ; 55 more scanlines of mode 8
.endrepeat
; .byte $30 ; blank 4 lines to match GR.8 (does it even matter?)
.byte $02 | $40 ; LMS, 1 line of GR.0 for the version
help_lms:
.word version
.byte $41 ; JVB, jump & wait for vblank
.word dlist
end:
.word INITAD
.word INITAD+1
.word start
|