From b5df9d8071b076e65c22d4080fa7394c73b2b660 Mon Sep 17 00:00:00 2001 From: "B. Watson" Date: Sat, 15 May 2021 12:18:41 -0400 Subject: Multiple sinking speeds (costs 13 bytes, now 8821) --- draw_lorcha.s | 19 ++++++++++++++----- taipan.c | 11 +++++++---- 2 files changed, 21 insertions(+), 9 deletions(-) diff --git a/draw_lorcha.s b/draw_lorcha.s index c3a5c38..07c4afe 100644 --- a/draw_lorcha.s +++ b/draw_lorcha.s @@ -3,6 +3,8 @@ ; Lorcha (boat), a type of sailing vessel having a Chinese ; junk rig on a Portuguese or European style hull. + .include "atari.inc" + .import _jsleep .export _draw_lorcha, _sink_lorcha, _damage_lorcha, _clear_lorcha, _flash_lorcha @@ -19,9 +21,6 @@ lorcha_pos_hi: .byte >320, >328, >336, >344, >352 .byte >640, >648, >656, >664, >672 -; Atari OS's pointer to start of screen RAM - SAVMSC = $58 - ; ZP working variables start at $d4, aka FR0 (floating point reg 0). temp = $d4 andmask = temp @@ -29,6 +28,7 @@ lorcha_pos_hi: destptr = $d6 lcount = $d8 which = $d9 + sinkdelay = $da ; clrtobot.s needs these: .exportzp destptr @@ -113,6 +113,15 @@ _sink_lorcha: lda #6 sta lcount + ; set sinkdelay to 3, 5, or 7 jiffies +@rnd: + lda RANDOM + eor RTCLOK+2 + and #$06 + beq @rnd + ora #1 + sta sinkdelay + sinkloop: ldx which jsr setup_destptr @@ -124,9 +133,9 @@ sinkloop: adc #0 sta destptr+1 - ; delay for several jiffies + ; delay for sinkdelay jiffies ldx #0 - lda #7 + lda sinkdelay jsr _jsleep ldx #6 ; line loop counter diff --git a/taipan.c b/taipan.c index 3d695a8..513c237 100644 --- a/taipan.c +++ b/taipan.c @@ -3406,11 +3406,14 @@ int main(void) { POKE(559, 34); // turn on the screen (normal playfield) #ifdef LORCHA_TEST - for(choice = 0; choice < 10; choice++) - draw_lorcha(choice); while(1) { - for(choice = 1; choice < 10; choice++) { - damage_lorcha(choice); + gotox0y(0); + clrtoeol(); + for(choice = 0; choice < 10; choice++) { + draw_lorcha(choice); + sink_lorcha(choice); + cprintuint(PEEK(0xda)); + cspace(); } agetc(); } -- cgit v1.2.3