mirror of
https://github.com/hsoft/collapseos.git
synced 2024-11-23 18:38:06 +11:00
Extract (n) code from stable ABI
This commit is contained in:
parent
a2f880b145
commit
daeb3b3c69
2
blk/283
2
blk/283
@ -6,7 +6,7 @@ NOP, NOP, ( 06, uflw ) NOP, NOP, ( 08, LATEST ) NOP, ( unused )
|
|||||||
NOP, NOP, NOP, ( unused )
|
NOP, NOP, NOP, ( unused )
|
||||||
0 JP, ( 1a, next ) NOP, NOP, NOP, ( unused )
|
0 JP, ( 1a, next ) NOP, NOP, NOP, ( unused )
|
||||||
0 JP, ( RST 20 )
|
0 JP, ( RST 20 )
|
||||||
NOP, NOP, NOP, NOP, NOP, ( unused )
|
0 A, 0 JP, ( 23, (n) ) NOP, ( unused )
|
||||||
0 JP, ( RST 28 )
|
0 JP, ( RST 28 )
|
||||||
0 A, 0 JP, ( 2b, (s) ) NOP, ( unused )
|
0 A, 0 JP, ( 2b, (s) ) NOP, ( unused )
|
||||||
0 JP, ( RST 30 )
|
0 JP, ( RST 30 )
|
||||||
|
1
blk/285
1
blk/285
@ -13,3 +13,4 @@ CODE (loop) ( 0x80 )
|
|||||||
A 1 IX+ LDrIXY, 1 IX- CP(IXY+), JRNZ, L2 BWR ( branch )
|
A 1 IX+ LDrIXY, 1 IX- CP(IXY+), JRNZ, L2 BWR ( branch )
|
||||||
( don't branch )
|
( don't branch )
|
||||||
IX DECd, IX DECd, IX DECd, IX DECd, JR, L1 BWR
|
IX DECd, IX DECd, IX DECd, IX DECd, JR, L1 BWR
|
||||||
|
( END OF STABLE ABI )
|
||||||
|
11
blk/286
11
blk/286
@ -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
20
blk/306
@ -1,11 +1,11 @@
|
|||||||
CODE (s) ( string literal )
|
CODE (n) ( number literal )
|
||||||
PC ORG @ 0x2d + ! ( stable ABI JP )
|
PC ORG @ 0x25 + ! ( stable ABI JP )
|
||||||
( Like (n) but instead of being followed by a 2 bytes
|
( Literal value to push to stack is next to (n) reference
|
||||||
number, it's followed by a string. When called, puts the
|
in the atom list. That is where IP is currently pointing.
|
||||||
string's address on PS )
|
Read, push, then advance IP. )
|
||||||
IY PUSH, HL POP, ( <-- IP )
|
E 0 IY+ LDrIXY,
|
||||||
E (HL) LDrr, D 0 LDri,
|
D 1 IY+ LDrIXY,
|
||||||
DE INCd,
|
IY INCd, IY INCd,
|
||||||
DE ADDIYd,
|
DE PUSH,
|
||||||
HL PUSH,
|
|
||||||
;CODE
|
;CODE
|
||||||
|
( END OF STABLE ABI )
|
||||||
|
23
blk/307
23
blk/307
@ -1,16 +1,11 @@
|
|||||||
CODE ROT ( a b c -- b c a )
|
CODE (s) ( string literal )
|
||||||
HL POP, ( C ) DE POP, ( B ) BC POP, ( A ) chkPS,
|
PC ORG @ 0x2d + ! ( stable ABI JP )
|
||||||
DE PUSH, ( B ) HL PUSH, ( C ) BC PUSH, ( A )
|
( Like (n) but instead of being followed by a 2 bytes
|
||||||
;CODE
|
number, it's followed by a string. When called, puts the
|
||||||
CODE DUP ( a -- a a )
|
string's address on PS )
|
||||||
HL POP, chkPS,
|
IY PUSH, HL POP, ( <-- IP )
|
||||||
HL PUSH, HL PUSH,
|
E (HL) LDrr, D 0 LDri,
|
||||||
;CODE
|
DE INCd,
|
||||||
CODE ?DUP
|
DE ADDIYd,
|
||||||
HL POP, chkPS,
|
|
||||||
HL PUSH,
|
HL PUSH,
|
||||||
HLZ, IFNZ, HL PUSH, THEN,
|
|
||||||
;CODE
|
|
||||||
CODE DROP ( a -- )
|
|
||||||
HL POP,
|
|
||||||
;CODE
|
;CODE
|
||||||
|
22
blk/308
22
blk/308
@ -1,8 +1,16 @@
|
|||||||
( a b -- b a )
|
CODE ROT ( a b c -- b c a )
|
||||||
CODE SWAP
|
HL POP, ( C ) DE POP, ( B ) BC POP, ( A ) chkPS,
|
||||||
HL POP, ( B )
|
DE PUSH, ( B ) HL PUSH, ( C ) BC PUSH, ( A )
|
||||||
DE POP, ( A )
|
;CODE
|
||||||
chkPS,
|
CODE DUP ( a -- a a )
|
||||||
HL PUSH, ( B )
|
HL POP, chkPS,
|
||||||
DE PUSH, ( A )
|
HL PUSH, HL PUSH,
|
||||||
|
;CODE
|
||||||
|
CODE ?DUP
|
||||||
|
HL POP, chkPS,
|
||||||
|
HL PUSH,
|
||||||
|
HLZ, IFNZ, HL PUSH, THEN,
|
||||||
|
;CODE
|
||||||
|
CODE DROP ( a -- )
|
||||||
|
HL POP,
|
||||||
;CODE
|
;CODE
|
||||||
|
16
blk/309
16
blk/309
@ -1,9 +1,11 @@
|
|||||||
( a b -- a b a )
|
CODE SWAP ( a b -- b a )
|
||||||
CODE OVER
|
HL POP, ( B ) DE POP, ( A )
|
||||||
HL POP, ( B )
|
|
||||||
DE POP, ( A )
|
|
||||||
chkPS,
|
chkPS,
|
||||||
DE PUSH, ( A )
|
HL PUSH, ( B ) DE PUSH, ( A )
|
||||||
HL PUSH, ( B )
|
;CODE
|
||||||
DE PUSH, ( A )
|
|
||||||
|
CODE OVER ( a b -- a b a )
|
||||||
|
HL POP, ( B ) DE POP, ( A )
|
||||||
|
chkPS,
|
||||||
|
DE PUSH, ( A ) HL PUSH, ( B ) DE PUSH, ( A )
|
||||||
;CODE
|
;CODE
|
||||||
|
4
blk/397
4
blk/397
@ -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 ;
|
: _bchk DUP 0x7f + 0xff > IF LIT< br-ovfl (print) ABORT THEN ;
|
||||||
: DO 0x33 ( 2>R ) , H@ ; IMMEDIATE
|
: DO 0x33 ( 2>R ) , H@ ; IMMEDIATE
|
||||||
: LOOP 0x80 ( loop ) , H@ - _bchk , ; IMMEDIATE
|
: LOOP 0x80 ( loop ) , H@ - _bchk , ; IMMEDIATE
|
||||||
( LEAVE is implemented in low xcomp )
|
( LEAVE is implemented in low xcomp )
|
||||||
: LITN 0xbf ( n ) , , ;
|
: LITN 0x23 ( n ) , , ;
|
||||||
( gets its name at the very end. can't comment afterwards )
|
( gets its name at the very end. can't comment afterwards )
|
||||||
: _ BEGIN LIT< ) WORD S= UNTIL ; IMMEDIATE
|
: _ BEGIN LIT< ) WORD S= UNTIL ; IMMEDIATE
|
||||||
: _ ( : will get its name almost at the very end )
|
: _ ( : will get its name almost at the very end )
|
||||||
|
7
blk/805
7
blk/805
@ -6,10 +6,9 @@ JMPn, 0 A,, ( 00, main ) 0 A, ( 03, boot driveno )
|
|||||||
0 A, JMPn, 0 A,, ( unused )
|
0 A, JMPn, 0 A,, ( unused )
|
||||||
0 A,, ( unused ) JMPn, 0 A,, ( unused )
|
0 A,, ( unused ) JMPn, 0 A,, ( unused )
|
||||||
JMPn, 0 A,, ( unused ) 0 A, 0 A,, ( unused )
|
JMPn, 0 A,, ( unused ) 0 A, 0 A,, ( unused )
|
||||||
JMPn, 0 A,, ( 1a, next ) 0 A, 0 A,, ( unused )
|
JMPn, 0 A,, ( 1a, next ) 0 A,, 0 A,, 0 A,, ( unused )
|
||||||
0 A, 0 A, 0 A, 0 A, ( unused )
|
0 A, JMPn, 0 A,, ( 23, (n) )
|
||||||
0 A, 0 A, 0 A, 0 A, ( unused )
|
0 A,, 0 A,, ( unused )
|
||||||
0 A, 0 A,, ( unused )
|
|
||||||
0 A, JMPn, 0 A,, ( 2b, (s) ) 0 A, ( unused )
|
0 A, JMPn, 0 A,, ( 2b, (s) ) 0 A, ( unused )
|
||||||
0 A, 0 A,, ( unused )
|
0 A, 0 A,, ( unused )
|
||||||
0 A, JMPn, 0 A,, ( 33, 2>R ) 0 A, 0 A, 0 A,, ( unused )
|
0 A, JMPn, 0 A,, ( 33, 2>R ) 0 A, 0 A, 0 A,, ( unused )
|
||||||
|
5
blk/807
5
blk/807
@ -5,9 +5,4 @@ CODE (loop) ( 0x80 )
|
|||||||
JNZ, L2 @ RPCs, ( branch )
|
JNZ, L2 @ RPCs, ( branch )
|
||||||
( don't branch )
|
( don't branch )
|
||||||
BP 4 SUBxi, JMPs, L1 @ RPCs,
|
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 )
|
( END OF STABLE ABI )
|
||||||
|
10
blk/810
10
blk/810
@ -3,3 +3,13 @@ lblchkPS BSET ( CX -> expected size )
|
|||||||
AX CX CMPxx,
|
AX CX CMPxx,
|
||||||
IFNC, ( we're good ) RETn, THEN,
|
IFNC, ( we're good ) RETn, THEN,
|
||||||
( underflow ) DI 0x06 MOVxm, JMPs, lblexec @ RPCs,
|
( 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
17
blk/811
@ -1,9 +1,8 @@
|
|||||||
PC 3 - ORG @ 1+ ! ( main )
|
( native words )
|
||||||
DX POPx, ( boot drive no ) 0x03 DL MOVmr,
|
CODE EXECUTE 1 chkPS,
|
||||||
SP PS_ADDR MOVxI, BP RS_ADDR MOVxI,
|
DI POPx, JMPn, lblexec @ RPCn,
|
||||||
DI 0x08 MOVxm, ( LATEST )
|
CODE EXIT
|
||||||
( HERE begins at CURRENT )
|
PC 0x0f - ORG @ 0x0d + ! ( stable abi )
|
||||||
SYSVARS 0x4 ( HERE ) + DI MOVmx,
|
DX [BP] 0 MOVx[]+, BP DECx, BP DECx, ( popRS )
|
||||||
SYSVARS 0x2 ( CURRENT ) + DI MOVmx,
|
;CODE
|
||||||
DI 0x04 ( BOOT ) MOVxm,
|
|
||||||
JMPn, lblexec @ RPCn, ( execute )
|
|
||||||
|
10
blk/812
10
blk/812
@ -1,9 +1,7 @@
|
|||||||
( native words )
|
CODE (n) ( number literal )
|
||||||
CODE EXECUTE 1 chkPS,
|
PC 0x27 - ORG @ 0x25 + ! ( stable abi )
|
||||||
DI POPx, JMPn, lblexec @ RPCn,
|
DI DX MOVxx, DI [DI] MOVx[], DI PUSHx,
|
||||||
CODE EXIT
|
DX INCx, DX INCx,
|
||||||
PC 0x0f - ORG @ 0x0d + ! ( stable abi )
|
|
||||||
DX [BP] 0 MOVx[]+, BP DECx, BP DECx, ( popRS )
|
|
||||||
;CODE
|
;CODE
|
||||||
CODE (s) ( string literal, see B287 )
|
CODE (s) ( string literal, see B287 )
|
||||||
PC 0x2f - ORG @ 0x2d + ! ( stable abi )
|
PC 0x2f - ORG @ 0x2d + ! ( stable abi )
|
||||||
|
BIN
cvm/forth.bin
BIN
cvm/forth.bin
Binary file not shown.
@ -12,6 +12,8 @@ CREATE BIN( 0 ,
|
|||||||
H@ ORG !
|
H@ ORG !
|
||||||
ORG @ 0x0b + HERE !
|
ORG @ 0x0b + HERE !
|
||||||
0 C, 0 C, ( EXIT )
|
0 C, 0 C, ( EXIT )
|
||||||
|
ORG @ 0x23 + HERE !
|
||||||
|
0 C, 0x05 C, ( (n) )
|
||||||
ORG @ 0x2b + HERE !
|
ORG @ 0x2b + HERE !
|
||||||
0 C, 0x06 C, ( (s) )
|
0 C, 0x06 C, ( (s) )
|
||||||
ORG @ 0x33 + HERE !
|
ORG @ 0x33 + HERE !
|
||||||
|
Loading…
Reference in New Issue
Block a user