mirror of
https://github.com/hsoft/collapseos.git
synced 2024-12-26 17:28:06 +11:00
forth: add word "."
This commit is contained in:
parent
49228e418c
commit
391ddb9984
@ -108,3 +108,15 @@ INTERPRET:
|
|||||||
jp exit
|
jp exit
|
||||||
.msg:
|
.msg:
|
||||||
.db "not found", 0
|
.db "not found", 0
|
||||||
|
|
||||||
|
; ( n -- )
|
||||||
|
DOT:
|
||||||
|
.db "."
|
||||||
|
.fill 7
|
||||||
|
.dw INTERPRET
|
||||||
|
.dw nativeWord
|
||||||
|
pop de
|
||||||
|
call pad
|
||||||
|
call fmtDecimalS
|
||||||
|
call printstr
|
||||||
|
jp exit
|
||||||
|
@ -2,6 +2,8 @@
|
|||||||
jp forthMain
|
jp forthMain
|
||||||
|
|
||||||
.inc "core.asm"
|
.inc "core.asm"
|
||||||
|
.inc "lib/ari.asm"
|
||||||
|
.inc "lib/fmt.asm"
|
||||||
.equ FORTH_RAMSTART RAMSTART
|
.equ FORTH_RAMSTART RAMSTART
|
||||||
.inc "forth/main.asm"
|
.inc "forth/main.asm"
|
||||||
.inc "forth/util.asm"
|
.inc "forth/util.asm"
|
||||||
|
@ -27,7 +27,7 @@ ENDPGM:
|
|||||||
|
|
||||||
forthMain:
|
forthMain:
|
||||||
ld (INITIAL_SP), sp
|
ld (INITIAL_SP), sp
|
||||||
ld hl, INTERPRET ; last entry in hardcoded dict
|
ld hl, DOT ; last entry in hardcoded dict
|
||||||
ld (CURRENT), hl
|
ld (CURRENT), hl
|
||||||
ld hl, FORTH_RAMEND
|
ld hl, FORTH_RAMEND
|
||||||
ld (HERE), hl
|
ld (HERE), hl
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
; Return address of scratchpad in HL
|
; Return address of scratchpad in HL
|
||||||
pad:
|
pad:
|
||||||
ld hl, (HERE)
|
ld hl, (HERE)
|
||||||
ld de, PADDING
|
ld a, PADDING
|
||||||
add hl, de
|
call addHL
|
||||||
ret
|
ret
|
||||||
|
|
||||||
; Read word from (INPUTPOS) and return, in HL, a null-terminated word.
|
; Read word from (INPUTPOS) and return, in HL, a null-terminated word.
|
||||||
|
Loading…
Reference in New Issue
Block a user