git @ Cat's Eye Technologies SixtyPical / 4f919c1
Slightly frustrating, but illuminating, attempt to title screen. Chris Pressey 4 years ago
2 changed file(s) with 54 addition(s) and 15 deletion(s). Raw diff Collapse all Expand all
44 // ----------------------------------------------------------------
55 // Global Variables and System Locations
66 // ----------------------------------------------------------------
7
8 byte vic_border @ 53280
9 byte vic_bg @ 53281
710
811 byte table screen1 @ 1024
912 byte table screen2 @ 1274
2124 pointer ptr @ 254
2225 word pos
2326 word delta
27
28 //
29 // Points to the routine that implements the current game state.
30 //
31
32 vector dispatch_game_state
33 inputs joy2, pos
34 outputs delta, pos, screen, vic_border, vic_bg, screen1
35 trashes a, x, y, c, z, n, v, ptr
2436
2537 //
2638 // The constraints on these 2 vectors are kind-of sort-of big fibs.
3648
3749 vector cinv
3850 inputs joy2, pos
39 outputs delta, pos, screen
51 outputs delta, pos, screen, vic_border, vic_bg, screen1
4052 trashes a, x, y, c, z, n, v, ptr
4153 @ 788
4254
4355 vector save_cinv
4456 inputs joy2, pos
45 outputs delta, pos, screen
46 trashes a, x, y, c, z, n, v, ptr
47
48 // (This one is less fibby.)
49
50 vector dispatch_game_state
51 inputs joy2, pos
52 outputs delta, pos, screen
53 trashes a, x, y, c, z, n, v, ptr
57 outputs delta, pos, screen, vic_border, vic_bg, screen1
58 trashes a, x, y, c, z, n, v, ptr
59
5460
5561 // ----------------------------------------------------------------
5662 // Utility Routines
118124
119125 routine game_state_play
120126 inputs joy2, pos
121 outputs delta, pos, screen
127 outputs delta, pos, screen, vic_border, vic_bg, screen1
122128 trashes a, x, y, c, z, n, v, ptr
123129 {
124130 call read_stick
136142 goto save_cinv
137143 }
138144
145 routine game_state_title_screen
146 inputs joy2, pos
147 outputs delta, pos, screen, vic_border, vic_bg, screen1
148 trashes a, x, y, c, z, n, v, ptr
149 {
150 ld a, 5
151 st a, vic_border
152 ld a, 0
153 st a, vic_bg
154 ld y, 0
155
156 repeat {
157 ld a, 82
158 st a, screen1 + y
159 inc y
160 cmp y, 18
161 } until not z
162
163 st off, c
164 // jsr check_button
165
166 if c {
167 // call clear_screen
168 // jsr init_game
169 // FIXME various reasons we can't do this, mainly that self-reference
170 // is disallowed: we would need to put "outputs dispatch_game_state" in
171 // the signature of dispatch_game_state!
172 // copy game_state_play, dispatch_game_state
173 }
174
175 goto save_cinv
176 }
177
139178 // *************************
140179 // * Main Game Loop Driver *
141180 // *************************
142181
143182 routine our_cinv
144183 inputs joy2, pos
145 outputs delta, pos, screen
184 outputs delta, pos, screen, vic_border, vic_bg, screen1
146185 trashes a, x, y, c, z, n, v, ptr
147186 {
148187 goto dispatch_game_state
152191 inputs cinv
153192 outputs cinv, save_cinv, pos, dispatch_game_state,
154193 screen1, screen2, screen3, screen4, colormap1, colormap2, colormap3, colormap4
155 trashes a, y, n, c, z
194 trashes a, y, n, c, z, vic_border, vic_bg
156195 {
157196 call clear_screen
158 copy game_state_play, dispatch_game_state
197 copy game_state_title_screen, dispatch_game_state
159198
160199 copy word 0, pos
161200 with interrupts off {
11
22 SRC=$1
33 OUT=/tmp/a-out.prg
4 bin/sixtypical --analyze --compile --basic-prelude $SRC > $OUT || exit 1
4 bin/sixtypical --traceback --analyze --compile --basic-prelude $SRC > $OUT || exit 1
55 if [ -e vicerc ]; then
66 x64 -config vicerc $OUT
77 else