mirror of
https://github.com/hsoft/collapseos.git
synced 2024-11-27 18:58:05 +11:00
forth: Word-ified "(print)"
This commit is contained in:
parent
42abbe75aa
commit
d1f572d2ed
@ -696,16 +696,36 @@ EMIT:
|
|||||||
.dw $-EMIT
|
.dw $-EMIT
|
||||||
.db 7
|
.db 7
|
||||||
PRINT:
|
PRINT:
|
||||||
|
.dw compiledWord ; a
|
||||||
|
; BBR mark
|
||||||
|
.dw DUP ; a a
|
||||||
|
.dw .getc ; a c
|
||||||
|
.dw DUP ; a c f
|
||||||
|
.dw CSKIP ; a c
|
||||||
|
; zero, end of string
|
||||||
|
.dw FBR
|
||||||
|
.db 12
|
||||||
|
.dw EMIT ; a
|
||||||
|
.dw NUMBER ; a 1
|
||||||
|
.dw 1
|
||||||
|
.dw PLUS ; a+1
|
||||||
|
.dw BBR
|
||||||
|
.db 21
|
||||||
|
; FBR mark
|
||||||
|
.dw DROP
|
||||||
|
.dw DROP
|
||||||
|
.dw EXIT
|
||||||
|
|
||||||
|
; Yes, very much like C@, but it has already been Forth-ified...
|
||||||
|
.getc:
|
||||||
.dw nativeWord
|
.dw nativeWord
|
||||||
pop hl
|
pop hl
|
||||||
call chkPS
|
call chkPS
|
||||||
.loop:
|
ld l, (hl)
|
||||||
ld a, (hl) ; load character to send
|
ld h, 0
|
||||||
or a ; is it zero?
|
push hl
|
||||||
jp z, next ; if yes, we're finished
|
jp next
|
||||||
call PUTC
|
|
||||||
inc hl
|
|
||||||
jr .loop
|
|
||||||
|
|
||||||
.db "C,"
|
.db "C,"
|
||||||
.dw $-PRINT
|
.dw $-PRINT
|
||||||
|
Loading…
Reference in New Issue
Block a user