1
0
mirror of https://github.com/hsoft/collapseos.git synced 2025-04-04 16:38:40 +11:00

Extract (s) code from stable ABI zone

Only its jump addr remains.
This commit is contained in:
Virgil Dupras 2020-07-05 08:54:22 -04:00
parent b626944273
commit 4a91ee5c9c
17 changed files with 74 additions and 77 deletions

View File

@ -5,9 +5,9 @@ sets that don't change (well, not without some binary manipu-
lation). Here's the complete list of these references: lation). Here's the complete list of these references:
04 BOOT addr 06 (uflw) addr 08 LATEST 04 BOOT addr 06 (uflw) addr 08 LATEST
33 2>R wordref 42 EXIT wordref 53 (br) wordref 2b (s) wordref 33 2>R wordref 42 EXIT wordref
67 (?br) wordref 80 (loop) wordref bf (n) wordref 53 (br) wordref 67 (?br) wordref 80 (loop) wordref
d4 (s) wordref bf (n) wordref
BOOT and (uflw) exist because they are referred to before those BOOT and (uflw) exist because they are referred to before those
words are defined (in core words). LATEST is a critical part words are defined (in core words). LATEST is a critical part

View File

@ -8,7 +8,7 @@ NOP, NOP, NOP, ( unused )
NOP, NOP, NOP, NOP, ( unused ) NOP, NOP, NOP, NOP, ( unused )
NOP, NOP, NOP, NOP, ( unused ) NOP, NOP, NOP, NOP, ( unused )
0 JP, ( RST 28 ) 0 JP, ( RST 28 )
NOP, NOP, NOP, NOP, NOP, ( unused ) 0 A, 0 JP, ( 2b, (s) ) NOP, ( unused )
0 JP, ( RST 30 ) 0 JP, ( RST 30 )
0 A, 0 JP, ( 33, 2>R ) NOP, ( unused ) 0 A, 0 JP, ( 33, 2>R ) NOP, ( unused )
0 JP, ( RST 38 ) 0 JP, ( RST 38 )

View File

@ -8,3 +8,4 @@ CODE (n) ( 0xbf, number literal )
IY INCd, IY INCd, IY INCd, IY INCd,
DE PUSH, DE PUSH,
;CODE ;CODE
( END OF STABLE ABI )

11
blk/287
View File

@ -1,11 +0,0 @@
CODE (s) ( 0xd4, string literal )
( 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
( END OF STABLE ABI )

20
blk/306
View File

@ -1,14 +1,16 @@
( Core words ) ( Native words )
( KEY and EMIT are not defined here. There're
expected to be defined in platform-specific code. )
CODE EXECUTE CODE EXECUTE
DE POP, DE POP,
chkPS, chkPS,
JR, lblexec BWR ( execute-B301 ) JR, lblexec BWR ( execute-B301 )
CODE (s) ( string literal )
CODE ROT ( a b c -- b c a ) PC ORG @ 0x2d + ! ( stable ABI JP )
HL POP, ( C ) DE POP, ( B ) BC POP, ( A ) ( Like (n) but instead of being followed by a 2 bytes
chkPS, number, it's followed by a string. When called, puts the
DE PUSH, ( B ) HL PUSH, ( C ) BC PUSH, ( A ) string's address on PS )
IY PUSH, HL POP, ( <-- IP )
E (HL) LDrr, D 0 LDri,
DE INCd,
DE ADDIYd,
HL PUSH,
;CODE ;CODE

View File

@ -1,14 +1,16 @@
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 ) CODE DUP ( a -- a a )
HL POP, chkPS, HL POP, chkPS,
HL PUSH, HL PUSH, HL PUSH, HL PUSH,
;CODE ;CODE
CODE ?DUP CODE ?DUP
HL POP, chkPS, HL POP, chkPS,
HL PUSH, HL PUSH,
HLZ, IFNZ, HL PUSH, THEN, HLZ, IFNZ, HL PUSH, THEN,
;CODE ;CODE
CODE DROP ( a -- ) CODE DROP ( a -- )
HL POP, HL POP,
;CODE ;CODE

View File

@ -1,4 +1,4 @@
: LIT< 0xd4 ( s ) , WORD DUP C@ 1+ MOVE, ; IMMEDIATE : LIT< 0x2b ( s ) , WORD DUP C@ 1+ MOVE, ; IMMEDIATE
: BEGIN H@ ; IMMEDIATE : BEGIN H@ ; IMMEDIATE
: AGAIN 0x53 ( br ) , H@ - _bchk , ; IMMEDIATE : AGAIN 0x53 ( br ) , H@ - _bchk , ; IMMEDIATE
: UNTIL 0x67 ( ?br ) , H@ - _bchk , ; IMMEDIATE : UNTIL 0x67 ( ?br ) , H@ - _bchk , ; IMMEDIATE

View File

@ -10,6 +10,6 @@ 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, 0 A, 0 A, ( unused ) 0 A, 0 A, 0 A, 0 A, ( unused )
0 A, 0 A,, ( unused ) 0 A, 0 A,, ( unused )
0 A, 0 A,, 0 A, 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 )

View File

@ -9,4 +9,5 @@ ORG @ 0xb9 + HERE !
CODE (n) ( 0xbf, number literal ) CODE (n) ( 0xbf, number literal )
DI DX MOVxx, DI [DI] MOVx[], DI PUSHx, DI DX MOVxx, DI [DI] MOVx[], DI PUSHx,
DX INCx, DX INCx, DX INCx, DX INCx,
;CODE NOP, NOP, NOP, NOP, ;CODE
( END OF STABLE ABI )

15
blk/808
View File

@ -1,6 +1,9 @@
CODE (s) ( 0xd4, string literal, see B287 ) lblnext BSET PC 0x1d - ORG @ 0x1b + ! ( next )
DI DX MOVxx, ( IP ) ( RSP check )
AH AH XORrr, AL [DI] MOVr[], ( slen ) AX RS_ADDR MOVxI, BP AX CMPxx,
DX PUSHx, DX INCx, DX AX ADDxx, IFC, ( BP < RS_ADDR )
;CODE DI 0x06 MOVxm, JMPs, L1 FWRs ( execute )
( END OF STABLE ABI ) THEN,
DI DX MOVxx, ( <-- IP ) DX INCx, DX INCx,
DI [DI] MOVx[], ( wordref )
( continue to execute ) L1 FSET

23
blk/809
View File

@ -1,9 +1,14 @@
lblnext BSET PC 0x1d - ORG @ 0x1b + ! ( next ) lblexec BSET ( DI -> wordref )
( RSP check ) AL [DI] MOVr[], DI INCx, ( PFA )
AX RS_ADDR MOVxI, BP AX CMPxx, AL AL ORrr, IFZ, DI JMPr, THEN, ( native )
IFC, ( BP < RS_ADDR ) AL DECr, IFNZ, ( cell or does )
DI 0x06 MOVxm, JMPs, L1 FWRs ( execute ) DI PUSHx, ( push PFA )
THEN, AL DECr, IFZ, ( cell ) JMPs, lblnext @ RPCs, THEN,
DI DX MOVxx, ( <-- IP ) DX INCx, DX INCx, ( does, see B302 )
DI [DI] MOVx[], ( wordref ) DI INCx, DI INCx, DI [DI] MOVx[],
( continue to execute ) L1 FSET THEN, ( continue to compiled )
( compiled )
BP INCx, BP INCx, [BP] 0 DX MOV[]+x, ( pushRS )
DX DI MOVxx, DX INCx, DX INCx, ( --> IP )
DI [DI] MOVx[],
JMPs, lblexec @ RPCs,

19
blk/810
View File

@ -1,14 +1,5 @@
lblexec BSET ( DI -> wordref ) lblchkPS BSET ( CX -> expected size )
AL [DI] MOVr[], DI INCx, ( PFA ) AX PS_ADDR MOVxI, AX SP SUBxx, 2 SUBAXI, ( CALL adjust )
AL AL ORrr, IFZ, DI JMPr, THEN, ( native ) AX CX CMPxx,
AL DECr, IFNZ, ( cell or does ) IFNC, ( we're good ) RETn, THEN,
DI PUSHx, ( push PFA ) ( underflow ) DI 0x06 MOVxm, JMPs, lblexec @ RPCs,
AL DECr, IFZ, ( cell ) JMPs, lblnext @ RPCs, THEN,
( does, see B302 )
DI INCx, DI INCx, DI [DI] MOVx[],
THEN, ( continue to compiled )
( compiled )
BP INCx, BP INCx, [BP] 0 DX MOV[]+x, ( pushRS )
DX DI MOVxx, DX INCx, DX INCx, ( --> IP )
DI [DI] MOVx[],
JMPs, lblexec @ RPCs,

14
blk/811
View File

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

19
blk/812
View File

@ -1,9 +1,10 @@
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 )
( HERE begins at CURRENT ) CODE (s) ( string literal, see B287 )
SYSVARS 0x4 ( HERE ) + DI MOVmx, PC 0x2f - ORG @ 0x2d + ! ( stable abi )
SYSVARS 0x2 ( CURRENT ) + DI MOVmx, DI DX MOVxx, ( IP )
DI 0x04 ( BOOT ) MOVxm, AH AH XORrr, AL [DI] MOVr[], ( slen )
JMPn, lblexec @ RPCn, ( execute ) DX PUSHx, DX INCx, DX AX ADDxx,
;CODE

View File

@ -1,6 +1,3 @@
( native words )
CODE EXECUTE 1 chkPS,
DI POPx, JMPn, lblexec @ RPCn,
CODE >R 1 chkPS, CODE >R 1 chkPS,
BP INCx, BP INCx, [BP] 0 POP[w]+, BP INCx, BP INCx, [BP] 0 POP[w]+,
;CODE NOP, NOP, NOP, ;CODE NOP, NOP, NOP,

Binary file not shown.

View File

@ -10,6 +10,8 @@ CREATE BIN( 0 ,
270 LOAD ( xcomp overrides ) 270 LOAD ( xcomp overrides )
H@ ORG ! H@ ORG !
ORG @ 0x2b + HERE !
0 C, 0x06 C, ( (s) )
ORG @ 0x33 + HERE ! ORG @ 0x33 + HERE !
0 C, 0x04 C, ( 2>R ) 0 C, 0x04 C, ( 2>R )
ORG @ 0x3b + HERE ! ORG @ 0x3b + HERE !
@ -25,9 +27,8 @@ ORG @ 0x77 + HERE !
0x03 CODE (loop) ( 0x80 ) 0x03 CODE (loop) ( 0x80 )
ORG @ 0xb9 + HERE ! ORG @ 0xb9 + HERE !
0x05 CODE (n) ( 0xbf ) 0x05 CODE (n) ( 0xbf )
ORG @ 0xce + HERE !
0x06 CODE (s) ( 0xd4 )
( END OF STABLE ABI ) ( END OF STABLE ABI )
0x06 CODE (s)
0x04 CODE 2>R 0x04 CODE 2>R
0x07 CODE >R 0x07 CODE >R
0x08 CODE R> 0x08 CODE R>