mirror of
https://github.com/hsoft/collapseos.git
synced 2025-04-13 04:28:16 +10:00
forth: Forth-ify "EMIT"
This commit is contained in:
parent
2db6ebc247
commit
1227ee7155
@ -2,7 +2,7 @@
|
|||||||
stdio port is 0
|
stdio port is 0
|
||||||
)
|
)
|
||||||
|
|
||||||
CODE (emit)
|
CODE EMIT
|
||||||
HL POPqq,
|
HL POPqq,
|
||||||
chkPS,
|
chkPS,
|
||||||
A L LDrr,
|
A L LDrr,
|
||||||
|
Binary file not shown.
@ -58,8 +58,6 @@
|
|||||||
; interface in Forth, which we plug in during init. If "(c<)" exists in the
|
; interface in Forth, which we plug in during init. If "(c<)" exists in the
|
||||||
; dict, CINPTR is set to it. Otherwise, we set KEY
|
; dict, CINPTR is set to it. Otherwise, we set KEY
|
||||||
.equ CINPTR @+2
|
.equ CINPTR @+2
|
||||||
; Pointer to (emit) word
|
|
||||||
.equ EMITPTR @+2
|
|
||||||
.equ WORDBUF @+2
|
.equ WORDBUF @+2
|
||||||
; Sys Vars are variables with their value living in the system RAM segment. We
|
; Sys Vars are variables with their value living in the system RAM segment. We
|
||||||
; need this mechanisms for core Forth source needing variables. Because core
|
; need this mechanisms for core Forth source needing variables. Because core
|
||||||
@ -146,10 +144,6 @@ forthMain:
|
|||||||
ld hl, .parseName
|
ld hl, .parseName
|
||||||
call find
|
call find
|
||||||
ld (PARSEPTR), de
|
ld (PARSEPTR), de
|
||||||
; Set up EMITPTR
|
|
||||||
ld hl, .emitName
|
|
||||||
call find
|
|
||||||
ld (EMITPTR), de
|
|
||||||
; Set up CINPTR
|
; Set up CINPTR
|
||||||
; do we have a (c<) impl?
|
; do we have a (c<) impl?
|
||||||
ld hl, .cinName
|
ld hl, .cinName
|
||||||
@ -172,8 +166,6 @@ forthMain:
|
|||||||
.db "(parse)", 0
|
.db "(parse)", 0
|
||||||
.cinName:
|
.cinName:
|
||||||
.db "(c<)", 0
|
.db "(c<)", 0
|
||||||
.emitName:
|
|
||||||
.db "(emit)", 0
|
|
||||||
.keyName:
|
.keyName:
|
||||||
.db "KEY", 0
|
.db "KEY", 0
|
||||||
.bootName:
|
.bootName:
|
||||||
@ -187,8 +179,11 @@ INTERPRET:
|
|||||||
.dw DROP
|
.dw DROP
|
||||||
.dw EXECUTE
|
.dw EXECUTE
|
||||||
|
|
||||||
.fill 41
|
.fill 58
|
||||||
|
|
||||||
|
; STABLE ABI
|
||||||
|
; Offset: 00cd
|
||||||
|
.out $
|
||||||
; *** Collapse OS lib copy ***
|
; *** Collapse OS lib copy ***
|
||||||
; In the process of Forth-ifying Collapse OS, apps will be slowly rewritten to
|
; In the process of Forth-ifying Collapse OS, apps will be slowly rewritten to
|
||||||
; Forth and the concept of ASM libs will become obsolete. To facilitate this
|
; Forth and the concept of ASM libs will become obsolete. To facilitate this
|
||||||
@ -660,28 +655,10 @@ abortUnderflow:
|
|||||||
.name:
|
.name:
|
||||||
.db "(uflw)", 0
|
.db "(uflw)", 0
|
||||||
|
|
||||||
.fill 50
|
.fill 140
|
||||||
|
|
||||||
; STABLE ABI
|
|
||||||
; Offset: 02aa
|
|
||||||
.out $
|
|
||||||
; ( c -- )
|
|
||||||
.db "EMIT"
|
|
||||||
.dw $-QUIT
|
|
||||||
.db 4
|
|
||||||
EMIT:
|
|
||||||
.dw compiledWord
|
|
||||||
.dw NUMBER
|
|
||||||
.dw EMITPTR
|
|
||||||
.dw FETCH
|
|
||||||
.dw EXECUTE
|
|
||||||
.dw EXIT
|
|
||||||
|
|
||||||
|
|
||||||
.fill 71
|
|
||||||
|
|
||||||
.db ","
|
.db ","
|
||||||
.dw $-EMIT
|
.dw $-QUIT
|
||||||
.db 1
|
.db 1
|
||||||
WR:
|
WR:
|
||||||
.dw nativeWord
|
.dw nativeWord
|
||||||
|
@ -83,7 +83,7 @@
|
|||||||
_c C@ ( a c )
|
_c C@ ( a c )
|
||||||
( exit if null )
|
( exit if null )
|
||||||
DUP NOT IF DROP DROP EXIT THEN
|
DUP NOT IF DROP DROP EXIT THEN
|
||||||
EMIT ( a )
|
_c EMIT ( a )
|
||||||
1 + ( a+1 )
|
1 + ( a+1 )
|
||||||
AGAIN
|
AGAIN
|
||||||
;
|
;
|
||||||
|
Loading…
Reference in New Issue
Block a user