diff options
author | B. Watson <yalhcru@gmail.com> | 2021-04-19 15:26:48 -0400 |
---|---|---|
committer | B. Watson <yalhcru@gmail.com> | 2021-04-19 15:26:48 -0400 |
commit | 47f494288d0ab525ddc93efefaf08dfb084dd10c (patch) | |
tree | 5cb9e7fc31a7aa60b7a0ca5678dfdc521ce8af57 /timed_getch.s | |
parent | bd3b540db943c2ffdd246d88af212cfe41511d0f (diff) | |
download | taipan-47f494288d0ab525ddc93efefaf08dfb084dd10c.tar.gz |
Allow pressing Enter to abort buy/sell (costs 15 bytes)
Diffstat (limited to 'timed_getch.s')
-rw-r--r-- | timed_getch.s | 68 |
1 files changed, 47 insertions, 21 deletions
diff --git a/timed_getch.s b/timed_getch.s index 5c5ff7c..6ea1bff 100644 --- a/timed_getch.s +++ b/timed_getch.s @@ -1,6 +1,6 @@ .export _timed_getch, _set_jiffy_timer, _agetc, _numgetc - .export _yngetc, _lcgetc, _jsleep, _get_item, _tjsleep + .export _yngetc, _lcgetc, _jsleep, _get_item_port, _get_item_battle, _tjsleep .import _cgetc, _cblank, putchar, _rand, _turbo .include "atari.inc" @@ -175,28 +175,54 @@ _yngetc: beq _yngetc ; no default, get another keypress rts ; else return the default -; extern unsigned char get_item(unsigned char allow_all); -_get_item: - sta FR0 ; stash arg +; extern unsigned char get_item_port(void) +; return 0-3 for opium, silk, arms, general. +; return 5 for Enter key (nothing chosen) +_get_item_port: + lda #4 + .byte $2c + +; extern unsigned char get_item_battle(void) +; return 0-4 for opium, silk, arms, general, all. +_get_item_battle: + lda #5 + sta FR0 +@get_loop: + jsr get_item + cmp FR0 + beq @get_loop + rts + + +get_item: @getkey: jsr _lcgetc ; switch(lcgetc()) { - ldx #0 - cmp #'o' - beq @gi_done ; case 'o': return 0; - inx - cmp #'s' - beq @gi_done ; case 's': return 1; - inx - cmp #'a' - beq @gi_done ; case 'a': return 2; - inx - cmp #'g' - beq @gi_done ; case 'g': return 3; - ldy FR0 - beq @getkey ; if allow_all is false, get another key - inx - cmp #'*' ; case '*': return 4; - bne @getkey ; if none of the above, get another key + sta FR0+1 + +;;; ldx #0 +;;; cmp #'o' +;;; beq @gi_done ; case 'o': return 0; +;;; inx +;;; cmp #'s' +;;; beq @gi_done ; case 's': return 1; +;;; inx +;;; cmp #'a' +;;; beq @gi_done ; case 'a': return 2; +;;; inx +;;; cmp #'g' +;;; beq @gi_done ; case 'g': return 3; + + ldx #5 +@giloop: + lda items_tbl,x + cmp FR0+1 + beq @gi_done + dex + bpl @giloop + bmi @getkey @gi_done: txa rts + +.rodata + items_tbl: .byte "osag*",$9b |