aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Makefile2
-rw-r--r--jsleep.s11
-rw-r--r--timed_getch.s26
3 files changed, 24 insertions, 15 deletions
diff --git a/Makefile b/Makefile
index 6d14f27..319e67d 100644
--- a/Makefile
+++ b/Makefile
@@ -89,7 +89,7 @@ XEX=taipan.xex
# All the C and asm sources for taimain.xex:
TAIMAIN_HDRS=sounds.h
TAIMAIN_C_SRC=taipan.c
-TAIMAIN_ASM_SRC=rand.s draw_lorcha.s timed_getch.s jsleep.s portstat.s clrtobot.s ultostr.s soundasm.s
+TAIMAIN_ASM_SRC=rand.s draw_lorcha.s timed_getch.s portstat.s clrtobot.s ultostr.s soundasm.s
# Comment these lines out to build without big number support.
# This will stop being possible at some point.
diff --git a/jsleep.s b/jsleep.s
deleted file mode 100644
index e052ddd..0000000
--- a/jsleep.s
+++ /dev/null
@@ -1,11 +0,0 @@
-
- .export _jsleep
- .import _set_jiffy_timer
-
-_jsleep:
- jsr _set_jiffy_timer
-wait:
- lda 540
- ora 541
- bne wait
- rts
diff --git a/timed_getch.s b/timed_getch.s
index ba3b0a9..1c5b418 100644
--- a/timed_getch.s
+++ b/timed_getch.s
@@ -1,16 +1,33 @@
- .export _timed_getch, _set_jiffy_timer, _agetc, _numgetc, _yngetc, _lcgetc
+ .export _timed_getch, _set_jiffy_timer, _agetc, _numgetc
+ .export _yngetc, _lcgetc, _jsleep
.import _cgetc, _cblank, _cursor
.include "atari.inc"
+; keyboard and timer functions for taipan.
+
+; sleep for j jiffies.
+; extern void __fastcall__ jsleep(unsigned int j);
+_jsleep:
+ jsr _set_jiffy_timer
+jiffy_wait:
+ lda CDTMV3
+ ora CDTMV3+1
+ bne jiffy_wait
+ rts
+
+; extern void __fastcall__ set_jiffy_timer(unsigned int jiffies);
_set_jiffy_timer: ; called by jsleep() also.
- sei ; disable IRQ while setting timer
+ sei ; disable IRQ while setting timer (probably overkill)
sta CDTMV3
stx CDTMV3+1
cli
rts
+; like curses timeout() followed by getch(): sleep until either
+; a key is pressed or the timer expires.
+; extern int __fastcall__ timed_getch(unsigned int jiffies);
_timed_getch:
jsr _set_jiffy_timer
wait4key:
@@ -40,7 +57,7 @@ done:
; a control key is pressed, it turns it into the non-control version
; (e.g. ^A = lowercase a). Keys that can't be mapped to regular ASCII
; (such as clear, delete, escape) are replaced with a space.
-; extern char lcgetc();
+; extern unsigned char agetc(void);
_agetc:
lda #1 ; show cursor
jsr _cursor
@@ -81,6 +98,7 @@ ok:
ldx #0
rts
+; extern unsigned char lcgetc(void);
_lcgetc:
jsr _agetc
cmp #'A'
@@ -90,6 +108,7 @@ _lcgetc:
eor #$20 ; lowercase it
bcc ok
+; extern unsigned char numgetc(void);
_numgetc:
jsr _agetc
cmp #$9b
@@ -110,6 +129,7 @@ _numgetc:
bcc ok
bcs _numgetc
+; extern unsigned char __fastcall__ yngetc(char dflt);
_yngetc:
sta FR0 ; stash default arg
jsr _lcgetc