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

Extract (n) code from stable ABI

This commit is contained in:
Virgil Dupras 2020-07-05 14:13:01 -04:00
parent a2f880b145
commit daeb3b3c69
15 changed files with 74 additions and 76 deletions

View File

@ -6,7 +6,7 @@ NOP, NOP, ( 06, uflw ) NOP, NOP, ( 08, LATEST ) NOP, ( unused )
NOP, NOP, NOP, ( unused )
0 JP, ( 1a, next ) NOP, NOP, NOP, ( unused )
0 JP, ( RST 20 )
NOP, NOP, NOP, NOP, NOP, ( unused )
0 A, 0 JP, ( 23, (n) ) NOP, ( unused )
0 JP, ( RST 28 )
0 A, 0 JP, ( 2b, (s) ) NOP, ( unused )
0 JP, ( RST 30 )

View File

@ -13,3 +13,4 @@ CODE (loop) ( 0x80 )
A 1 IX+ LDrIXY, 1 IX- CP(IXY+), JRNZ, L2 BWR ( branch )
( don't branch )
IX DECd, IX DECd, IX DECd, IX DECd, JR, L1 BWR
( END OF STABLE ABI )

11
blk/286
View File

@ -1,11 +0,0 @@
ORG @ 0xb9 + HERE !
CODE (n) ( 0xbf, number literal )
( Literal value to push to stack is next to (n) reference
in the atom list. That is where IP is currently pointing.
Read, push, then advance IP. )
E 0 IY+ LDrIXY,
D 1 IY+ LDrIXY,
IY INCd, IY INCd,
DE PUSH,
;CODE
( END OF STABLE ABI )

20
blk/306
View File

@ -1,11 +1,11 @@
CODE (s) ( string literal )
PC ORG @ 0x2d + ! ( stable ABI JP )
( Like (n) but instead of being followed by a 2 bytes
number, it's followed by a string. When called, puts the
string's address on PS )
IY PUSH, HL POP, ( <-- IP )
E (HL) LDrr, D 0 LDri,
DE INCd,
DE ADDIYd,
HL PUSH,
CODE (n) ( number literal )
PC ORG @ 0x25 + ! ( stable ABI JP )
( Literal value to push to stack is next to (n) reference
in the atom list. That is where IP is currently pointing.
Read, push, then advance IP. )
E 0 IY+ LDrIXY,
D 1 IY+ LDrIXY,
IY INCd, IY INCd,
DE PUSH,
;CODE
( END OF STABLE ABI )

23
blk/307
View File

@ -1,16 +1,11 @@
CODE ROT ( a b c -- b c a )
HL POP, ( C ) DE POP, ( B ) BC POP, ( A ) chkPS,
DE PUSH, ( B ) HL PUSH, ( C ) BC PUSH, ( A )
;CODE
CODE DUP ( a -- a a )
HL POP, chkPS,
HL PUSH, HL PUSH,
;CODE
CODE ?DUP
HL POP, chkPS,
CODE (s) ( string literal )
PC ORG @ 0x2d + ! ( stable ABI JP )
( Like (n) but instead of being followed by a 2 bytes
number, it's followed by a string. When called, puts the
string's address on PS )
IY PUSH, HL POP, ( <-- IP )
E (HL) LDrr, D 0 LDri,
DE INCd,
DE ADDIYd,
HL PUSH,
HLZ, IFNZ, HL PUSH, THEN,
;CODE
CODE DROP ( a -- )
HL POP,
;CODE

22
blk/308
View File

@ -1,8 +1,16 @@
( a b -- b a )
CODE SWAP
HL POP, ( B )
DE POP, ( A )
chkPS,
HL PUSH, ( B )
DE PUSH, ( A )
CODE ROT ( a b c -- b c a )
HL POP, ( C ) DE POP, ( B ) BC POP, ( A ) chkPS,
DE PUSH, ( B ) HL PUSH, ( C ) BC PUSH, ( A )
;CODE
CODE DUP ( a -- a a )
HL POP, chkPS,
HL PUSH, HL PUSH,
;CODE
CODE ?DUP
HL POP, chkPS,
HL PUSH,
HLZ, IFNZ, HL PUSH, THEN,
;CODE
CODE DROP ( a -- )
HL POP,
;CODE

16
blk/309
View File

@ -1,9 +1,11 @@
( a b -- a b a )
CODE OVER
HL POP, ( B )
DE POP, ( A )
CODE SWAP ( a b -- b a )
HL POP, ( B ) DE POP, ( A )
chkPS,
DE PUSH, ( A )
HL PUSH, ( B )
DE PUSH, ( A )
HL PUSH, ( B ) DE PUSH, ( A )
;CODE
CODE OVER ( a b -- a b a )
HL POP, ( B ) DE POP, ( A )
chkPS,
DE PUSH, ( A ) HL PUSH, ( B ) DE PUSH, ( A )
;CODE

View File

@ -1,9 +1,9 @@
( Now we have "as late as possible" stuff. See B70 and B270. )
( Now we have "as late as possible" stuff. See B70 and B260. )
: _bchk DUP 0x7f + 0xff > IF LIT< br-ovfl (print) ABORT THEN ;
: DO 0x33 ( 2>R ) , H@ ; IMMEDIATE
: LOOP 0x80 ( loop ) , H@ - _bchk , ; IMMEDIATE
( LEAVE is implemented in low xcomp )
: LITN 0xbf ( n ) , , ;
: LITN 0x23 ( n ) , , ;
( gets its name at the very end. can't comment afterwards )
: _ BEGIN LIT< ) WORD S= UNTIL ; IMMEDIATE
: _ ( : will get its name almost at the very end )

View File

@ -6,10 +6,9 @@ JMPn, 0 A,, ( 00, main ) 0 A, ( 03, boot driveno )
0 A, JMPn, 0 A,, ( unused )
0 A,, ( unused ) JMPn, 0 A,, ( unused )
JMPn, 0 A,, ( unused ) 0 A, 0 A,, ( unused )
JMPn, 0 A,, ( 1a, next ) 0 A, 0 A,, ( unused )
0 A, 0 A, 0 A, 0 A, ( unused )
0 A, 0 A, 0 A, 0 A, ( unused )
0 A, 0 A,, ( unused )
JMPn, 0 A,, ( 1a, next ) 0 A,, 0 A,, 0 A,, ( unused )
0 A, JMPn, 0 A,, ( 23, (n) )
0 A,, 0 A,, ( unused )
0 A, JMPn, 0 A,, ( 2b, (s) ) 0 A, ( unused )
0 A, 0 A,, ( unused )
0 A, JMPn, 0 A,, ( 33, 2>R ) 0 A, 0 A, 0 A,, ( unused )

View File

@ -5,9 +5,4 @@ CODE (loop) ( 0x80 )
JNZ, L2 @ RPCs, ( branch )
( don't branch )
BP 4 SUBxi, JMPs, L1 @ RPCs,
ORG @ 0xb9 + HERE !
CODE (n) ( 0xbf, number literal )
DI DX MOVxx, DI [DI] MOVx[], DI PUSHx,
DX INCx, DX INCx,
;CODE
( END OF STABLE ABI )

10
blk/810
View File

@ -3,3 +3,13 @@ lblchkPS BSET ( CX -> expected size )
AX CX CMPxx,
IFNC, ( we're good ) RETn, THEN,
( underflow ) DI 0x06 MOVxm, JMPs, lblexec @ RPCs,
PC 3 - ORG @ 1+ ! ( main )
DX POPx, ( boot drive no ) 0x03 DL MOVmr,
SP PS_ADDR MOVxI, BP RS_ADDR MOVxI,
DI 0x08 MOVxm, ( LATEST )
( HERE begins at CURRENT )
SYSVARS 0x4 ( HERE ) + DI MOVmx,
SYSVARS 0x2 ( CURRENT ) + DI MOVmx,
DI 0x04 ( BOOT ) MOVxm,
JMPn, lblexec @ RPCn, ( execute )

17
blk/811
View File

@ -1,9 +1,8 @@
PC 3 - ORG @ 1+ ! ( main )
DX POPx, ( boot drive no ) 0x03 DL MOVmr,
SP PS_ADDR MOVxI, BP RS_ADDR MOVxI,
DI 0x08 MOVxm, ( LATEST )
( HERE begins at CURRENT )
SYSVARS 0x4 ( HERE ) + DI MOVmx,
SYSVARS 0x2 ( CURRENT ) + DI MOVmx,
DI 0x04 ( BOOT ) MOVxm,
JMPn, lblexec @ RPCn, ( execute )
( native words )
CODE EXECUTE 1 chkPS,
DI POPx, JMPn, lblexec @ RPCn,
CODE EXIT
PC 0x0f - ORG @ 0x0d + ! ( stable abi )
DX [BP] 0 MOVx[]+, BP DECx, BP DECx, ( popRS )
;CODE

10
blk/812
View File

@ -1,9 +1,7 @@
( native words )
CODE EXECUTE 1 chkPS,
DI POPx, JMPn, lblexec @ RPCn,
CODE EXIT
PC 0x0f - ORG @ 0x0d + ! ( stable abi )
DX [BP] 0 MOVx[]+, BP DECx, BP DECx, ( popRS )
CODE (n) ( number literal )
PC 0x27 - ORG @ 0x25 + ! ( stable abi )
DI DX MOVxx, DI [DI] MOVx[], DI PUSHx,
DX INCx, DX INCx,
;CODE
CODE (s) ( string literal, see B287 )
PC 0x2f - ORG @ 0x2d + ! ( stable abi )

Binary file not shown.

View File

@ -12,6 +12,8 @@ CREATE BIN( 0 ,
H@ ORG !
ORG @ 0x0b + HERE !
0 C, 0 C, ( EXIT )
ORG @ 0x23 + HERE !
0 C, 0x05 C, ( (n) )
ORG @ 0x2b + HERE !
0 C, 0x06 C, ( (s) )
ORG @ 0x33 + HERE !