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

forth: add words "PC!" and "PC@"

This commit is contained in:
Virgil Dupras 2020-03-10 13:00:57 -04:00
parent e95614755b
commit aac0a57a68
2 changed files with 26 additions and 1 deletions

View File

@ -211,10 +211,33 @@ EMIT:
call stdioPutC
jp exit
; ( c port -- )
.db "PC!"
.fill 5
.dw EMIT
PSTORE:
.dw nativeWord
pop bc
pop hl
out (c), l
jp exit
; ( port -- c )
.db "PC@"
.fill 5
.dw PSTORE
PFETCH:
.dw nativeWord
pop bc
ld h, 0
in l, (c)
push hl
jp exit
; ( addr -- )
.db "EXECUTE"
.db 0
.dw EMIT
.dw PFETCH
EXECUTE:
.dw nativeWord
pop iy ; is a wordref

View File

@ -70,4 +70,6 @@ HERE -- a Push HERE's address
. n -- Print n in its decimal form
EMIT c -- Spit char c to stdout
KEY -- c Get char c from stdin
PC! c a -- Spit c to port a
PC@ a -- c Fetch c from port a