1
0
mirror of https://github.com/hsoft/collapseos.git synced 2024-11-27 12:38:05 +11:00

forth: Forth-ify "KEY"

This commit is contained in:
Virgil Dupras 2020-03-26 12:12:11 -04:00
parent 636407969d
commit 966f6df0c5
4 changed files with 12 additions and 22 deletions

View File

@ -8,3 +8,10 @@ CODE (emit)
A L LDrr,
0 OUTnA,
;CODE
CODE KEY
0 INAn,
H 0 LDrn,
L A LDrr,
HL PUSHqq,
;CODE

View File

@ -9,11 +9,3 @@ init:
ld sp, 0xffff
call forthMain
halt
emulGetC:
; Blocks until a char is returned
in a, (STDIO_PORT)
cp a ; ensure Z
ret
.equ GETC emulGetC

Binary file not shown.

View File

@ -141,7 +141,8 @@ forthMain:
call find
jr z, .skip
; no? then use KEY
ld de, KEY
ld hl, .keyName
call find
.skip:
ld (CINPTR), de
; Set up SYSVNXT
@ -157,6 +158,8 @@ forthMain:
.db "(c<)", 0
.emitName:
.db "(emit)", 0
.keyName:
.db "KEY", 0
BEGIN:
.dw compiledWord
@ -985,22 +988,10 @@ FIND_:
push de
jp next
; ( -- c )
.db "KEY"
.dw $-FIND_
.db 3
KEY:
.dw nativeWord
call GETC
ld h, 0
ld l, a
push hl
jp next
; This is an indirect word that can be redirected through "CINPTR"
; code: it is replaced in readln.fs.
.db "C<"
.dw $-KEY
.dw $-FIND_
.db 2
CIN:
.dw compiledWord