From 8889d0f1bb00b3bb52afb92a1069112817ddbb81 Mon Sep 17 00:00:00 2001 From: "B. Watson" Date: Sun, 28 Feb 2016 02:56:41 -0500 Subject: add procsizes target, rewrite get_item in asm, combine some functions, 7808 bytes free --- timed_getch.s | 27 ++++++++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) (limited to 'timed_getch.s') 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 -- cgit v1.2.3