aboutsummaryrefslogtreecommitdiff
path: root/timed_getch.s
diff options
context:
space:
mode:
authorB. Watson <yalhcru@gmail.com>2016-02-28 02:56:41 -0500
committerB. Watson <yalhcru@gmail.com>2016-02-28 02:56:41 -0500
commit8889d0f1bb00b3bb52afb92a1069112817ddbb81 (patch)
tree5200ddcb3d06cf87332b7f8117fbc147c642d317 /timed_getch.s
parent9d60dc2142964aa7cb0e18049170455036a7b1d1 (diff)
downloadtaipan-8889d0f1bb00b3bb52afb92a1069112817ddbb81.tar.gz
add procsizes target, rewrite get_item in asm, combine some functions, 7808 bytes free
Diffstat (limited to 'timed_getch.s')
-rw-r--r--timed_getch.s27
1 files changed, 26 insertions, 1 deletions
diff --git a/timed_getch.s b/timed_getch.s
index 40a2722..eaf7ab3 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
+ .export _yngetc, _lcgetc, _jsleep, _get_item
.import _cgetc, _cblank, putchar, _rand
.include "atari.inc"
@@ -166,3 +166,28 @@ _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
+@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
+@gi_done:
+ txa
+ rts