1
0
mirror of https://github.com/hsoft/collapseos.git synced 2024-12-26 05:18:05 +11:00

forth: Forth-ify "(sysv)"

This commit is contained in:
Virgil Dupras 2020-03-25 08:39:44 -04:00
parent 3a08fa7e74
commit 04a6784de4
2 changed files with 22 additions and 34 deletions

View File

@ -71,3 +71,16 @@
COMPILE R> COMPILE DROP COMPILE R> COMPILE DROP COMPILE R> COMPILE DROP COMPILE R> COMPILE DROP
; IMMEDIATE ; IMMEDIATE
( WARNING: there are no limit checks. We must be cautious, in
core code, not to create more than SYSV_BUFSIZE/2 sys vars.
Also: SYSV shouldn't be used during runtime: SYSVNXT won't
point at the right place. It should only be used during
stage1 compilation. This is why this word is not documented
in dictionary.txt )
: (sysv)
(entry)
ROUTINE Y [LITN] ,
SYSVNXT @ ,
2 SYSVNXT +!
;

View File

@ -1269,41 +1269,9 @@ ENTRYHEAD:
jp next jp next
; WARNING: there are no limit checks. We must be cautious, in core code, not
; to create more than SYSV_BUFSIZE/2 sys vars.
; Also: SYSV shouldn't be used during runtime: SYSVNXT won't point at the
; right place. It should only be used during stage1 compilation. This is why
; this word is not documented in dictionary.txt
.db "(sysv)"
.fill 1
.dw $-ENTRYHEAD
.db 0
SYSV:
.dw compiledWord
.dw ENTRYHEAD
.dw NUMBER
.dw sysvarWord
.dw WR
.dw NUMBER
.dw SYSVNXT
.dw FETCH
.dw WR
; word written, now let's INC SYSVNXT
.dw NUMBER ; a
.dw SYSVNXT
.dw DUP ; a a
.dw FETCH ; a a@
.dw NUMBER ; a a@ 2
.dw 2
.dw PLUS ; a a@+2
.dw SWAP ; a@+2 a
.dw STORE
.dw EXIT
.db "HERE" .db "HERE"
.fill 3 .fill 3
.dw $-SYSV .dw $-ENTRYHEAD
.db 0 .db 0
HERE_: ; Caution: conflicts with actual variable name HERE_: ; Caution: conflicts with actual variable name
.dw sysvarWord .dw sysvarWord
@ -1331,10 +1299,17 @@ FLAGS_:
.dw sysvarWord .dw sysvarWord
.dw FLAGS .dw FLAGS
.db "SYSVNXT"
.dw $-FLAGS_
.db 0
SYSVNXT_:
.dw sysvarWord
.dw SYSVNXT
; ( n a -- ) ; ( n a -- )
.db "!" .db "!"
.fill 6 .fill 6
.dw $-FLAGS_ .dw $-SYSVNXT_
.db 0 .db 0
STORE: STORE:
.dw nativeWord .dw nativeWord