diff --git a/apps/forth/dict.asm b/apps/forth/dict.asm index d8b33fa..99fdea3 100644 --- a/apps/forth/dict.asm +++ b/apps/forth/dict.asm @@ -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 diff --git a/apps/forth/dictionary.txt b/apps/forth/dictionary.txt index b02e2b9..c2562fb 100644 --- a/apps/forth/dictionary.txt +++ b/apps/forth/dictionary.txt @@ -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