git @ Cat's Eye Technologies SixtyPical / 3bee722
The "union rule" lets us clean up some of these redundant trashes. Chris Pressey 3 years ago
2 changed file(s) with 54 addition(s) and 84 deletion(s). Raw diff Collapse all Expand all
306306 st off, c
307307 } else {
308308 st on, c
309 trash n
310 trash a
311 trash z
309 }
310
311 // FIXME these trashes, strictly speaking, probably shouldn't be needed,
312 // but currently the compiler cares a little too much about values that are
313 // initialized in one branch of an `if`, but not the other, but are trashed
314 // at the end of the routine anyway.
315 trash ptr
316 trash y
317 trash v
318 } else {
319 st off, c
320 }
321 }
322
323 define enemy_logic logic_routine
324 {
325 call calculate_new_position
326 call check_new_position_in_bounds
327
328 if c {
329 copy ^screen, ptr
330 st off, c
331 add ptr, new_pos
332 ld y, 0
333
334 // check collision.
335 ld a, [ptr] + y
336 // if "collision" is with your own self, treat it as if it's blank space!
337 cmp a, 82
338 if z {
339 ld a, 32
340 }
341 cmp a, 32
342 if z {
343 copy ^screen, ptr
344 st off, c
345 add ptr, pos
346 copy 32, [ptr] + y
347
348 copy new_pos, pos
349
350 copy ^screen, ptr
351 st off, c
352 add ptr, pos
353 copy 82, [ptr] + y
354
355 st off, c
356 } else {
357 st on, c
312358 }
313359
314360 // FIXME these trashes, strictly speaking, probably shouldn't be needed,
317363 // at the end of the routine anyway.
318364 trash ptr
319365 trash y
320 trash a
321 trash v
322 } else {
323 st off, c
324 }
325 }
326
327 define enemy_logic logic_routine
328 {
329 call calculate_new_position
330 call check_new_position_in_bounds
331
332 if c {
333 copy ^screen, ptr
334 st off, c
335 add ptr, new_pos
336 ld y, 0
337
338 // check collision.
339 ld a, [ptr] + y
340 // if "collision" is with your own self, treat it as if it's blank space!
341 cmp a, 82
342 if z {
343 ld a, 32
344 }
345 cmp a, 32
346 if z {
347 copy ^screen, ptr
348 st off, c
349 add ptr, pos
350 copy 32, [ptr] + y
351
352 copy new_pos, pos
353
354 copy ^screen, ptr
355 st off, c
356 add ptr, pos
357 copy 82, [ptr] + y
358
359 st off, c
360 } else {
361 st on, c
362 trash n
363 trash a
364 trash z
365 }
366
367 // FIXME these trashes, strictly speaking, probably shouldn't be needed,
368 // but currently the compiler cares too much about values that are
369 // initialized in one branch of an `if`, but not the other, but trashed
370 // at the end of the routine anyway.
371 trash ptr
372 trash y
373 trash a
374366 } else {
375367 copy delta, compare_target
376368 st on, c
411403 call clear_screen
412404 call init_game
413405 copy forward game_state_play, dispatch_game_state
414
415 // FIXME these trashes, strictly speaking, probably shouldn't be needed,
416 // but currently the compiler cares too much about values that are
417 // initialized in one branch of an `if`, but not the other, but trashed
418 // at the end of the routine anyway.
419 trash a
420 trash n
421 trash z
422 } else {
423 trash y
424 trash c
425 trash v
426406 }
427407
428408 goto save_cinv
447427 ld x, 15
448428 } else {
449429 ld x, save_x
450 trash c
451430 }
452431
453432 copy pos, actor_pos + x
469448 call clear_screen
470449 call init_game
471450 copy game_state_title_screen, dispatch_game_state
472
473 // FIXME these trashes, strictly speaking, probably shouldn't be needed,
474 // but currently the compiler cares too much about values that are
475 // initialized in one branch of an `if`, but not the other, but trashed
476 // at the end of the routine anyway.
477 trash a
478 trash n
479 trash z
480 } else {
481 trash y
482 trash c
483 trash v
484451 }
485452
486453 goto save_cinv
00 #!/bin/sh
11
2 if [ "X$X64" = "X" ]; then
3 X64=x64
4 fi
25 SRC=$1
36 if [ "X$1" = "X" ]; then
47 echo "Usage: ./loadngo.sh <source.60p>"
710 OUT=/tmp/a-out.prg
811 bin/sixtypical --traceback --basic-prelude $SRC > $OUT || exit 1
912 if [ -e vicerc ]; then
10 x64 -config vicerc $OUT
13 $X64 -config vicerc $OUT
1114 else
12 x64 $OUT
15 $X64 $OUT
1316 fi
1417 rm -f $OUT