diff --git a/apps/forth/dict.asm b/apps/forth/dict.asm index ccef6e4..44afe6e 100644 --- a/apps/forth/dict.asm +++ b/apps/forth/dict.asm @@ -108,3 +108,15 @@ INTERPRET: jp exit .msg: .db "not found", 0 + +; ( n -- ) +DOT: + .db "." + .fill 7 + .dw INTERPRET + .dw nativeWord + pop de + call pad + call fmtDecimalS + call printstr + jp exit diff --git a/apps/forth/glue.asm b/apps/forth/glue.asm index 32bcded..a88cc61 100644 --- a/apps/forth/glue.asm +++ b/apps/forth/glue.asm @@ -2,6 +2,8 @@ jp forthMain .inc "core.asm" +.inc "lib/ari.asm" +.inc "lib/fmt.asm" .equ FORTH_RAMSTART RAMSTART .inc "forth/main.asm" .inc "forth/util.asm" diff --git a/apps/forth/main.asm b/apps/forth/main.asm index 331885b..b1ad497 100644 --- a/apps/forth/main.asm +++ b/apps/forth/main.asm @@ -27,7 +27,7 @@ ENDPGM: forthMain: ld (INITIAL_SP), sp - ld hl, INTERPRET ; last entry in hardcoded dict + ld hl, DOT ; last entry in hardcoded dict ld (CURRENT), hl ld hl, FORTH_RAMEND ld (HERE), hl diff --git a/apps/forth/util.asm b/apps/forth/util.asm index daa78ba..4835bf8 100644 --- a/apps/forth/util.asm +++ b/apps/forth/util.asm @@ -1,8 +1,8 @@ ; Return address of scratchpad in HL pad: ld hl, (HERE) - ld de, PADDING - add hl, de + ld a, PADDING + call addHL ret ; Read word from (INPUTPOS) and return, in HL, a null-terminated word.