1
0
mirror of https://github.com/hsoft/collapseos.git synced 2024-11-23 22:48:05 +11:00

forth: Forth-ify SYSVNXT

This commit is contained in:
Virgil Dupras 2020-03-30 14:19:47 -04:00
parent 162ff2c5cb
commit e984efe6c3
2 changed files with 11 additions and 21 deletions

View File

@ -86,9 +86,14 @@
: (sysv) : (sysv)
(entry) (entry)
( JTBL+0 == sysvarWord )
[ JTBL LITN ] , [ JTBL LITN ] ,
SYSVNXT @ , ( JTBL+42 == SYSVNXT )
2 SYSVNXT +! [ JTBL 42 + @ LITN ] DUP ( a a )
( Get new sysv addr )
@ , ( a )
( increase current sysv counter )
2 SWAP +!
; ;
: ." : ."

View File

@ -127,6 +127,7 @@ LIT:
jp strcmp jp strcmp
.dw RS_ADDR .dw RS_ADDR
.dw CINPTR .dw CINPTR
.dw SYSVNXT
; *** Code *** ; *** Code ***
forthMain: forthMain:
@ -163,19 +164,11 @@ forthMain:
.bootName: .bootName:
.db "BOOT", 0 .db "BOOT", 0
.fill 93 .fill 91
; STABLE ABI ; STABLE ABI
; Offset: 00cd ; Offset: 00cd
.out $ .out $
; *** Collapse OS lib copy ***
; 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
; transition, I make, right now, a copy of the routines actually used by Forth's
; native core. This also has the effect of reducing binary size right now and
; give us an idea of Forth's compactness.
; These routines below are copy/paste from apps/lib and stdio.
; copy (HL) into DE, then exchange the two, utilising the optimised HL instructions. ; copy (HL) into DE, then exchange the two, utilising the optimised HL instructions.
; ld must be done little endian, so least significant byte first. ; ld must be done little endian, so least significant byte first.
intoHL: intoHL:
@ -834,18 +827,10 @@ FLAGS_:
.dw sysvarWord .dw sysvarWord
.dw FLAGS .dw FLAGS
.db "SYSVNXT" .fill 65
.dw $-FLAGS_
.db 7
SYSVNXT_:
.dw sysvarWord
.dw SYSVNXT
.fill 51
.db "_bend" .db "_bend"
.dw $-SYSVNXT_ .dw $-FLAGS_
.db 5 .db 5
; Offset: 0647 ; Offset: 0647
.out $ .out $