1
0
mirror of https://github.com/hsoft/collapseos.git synced 2024-11-27 13:08:07 +11:00

Extract EXIT code from stable ABI zone

This commit is contained in:
Virgil Dupras 2020-07-05 13:41:12 -04:00
parent 84202da6a6
commit 5705cd5c31
12 changed files with 41 additions and 47 deletions

View File

@ -1,7 +1,7 @@
H@ ORG ! H@ ORG !
0 JP, ( 00, main ) NOP, ( unused ) NOP, NOP, ( 04, BOOT ) 0 JP, ( 00, main ) NOP, ( unused ) NOP, NOP, ( 04, BOOT )
NOP, NOP, ( 06, uflw ) NOP, NOP, ( 08, LATEST ) NOP, NOP, ( 06, uflw ) NOP, NOP, ( 08, LATEST ) NOP, ( unused )
NOP, NOP, NOP, NOP, NOP, NOP, ( unused ) 0 A, 0 JP, ( 0b, EXIT ) NOP, ( unused )
0 JP, ( RST 10 ) NOP, ( unused ) 0 JP, ( 14, popRS ) 0 JP, ( RST 10 ) NOP, ( unused ) 0 JP, ( 14, popRS )
NOP, NOP, NOP, ( unused ) NOP, NOP, NOP, ( unused )
0 JP, ( 1a, next ) NOP, NOP, NOP, ( unused ) 0 JP, ( 1a, next ) NOP, NOP, NOP, ( unused )

View File

@ -1,11 +1,5 @@
( BOOT DICT: There are only 3 words in the boot dict, but ORG @ 0x4c + HERE !
these words' offset need to be stable, so they're part of
the "stable ABI" )
H@ 4 + XCURRENT ! ( make next CODE have 0 prev field ) H@ 4 + XCURRENT ! ( make next CODE have 0 prev field )
CODE EXIT ( 0x42 )
0x14 BCALL, ( popRS )
HL PUSH, IY POP, ( --> IP )
JPNEXT,
CODE (br) ( 0x53 ) CODE (br) ( 0x53 )
L2 BSET ( used in CBR ) L2 BSET ( used in CBR )
E 0 IY+ LDrIXY, D 1 IY+ LDrIXY, E 0 IY+ LDrIXY, D 1 IY+ LDrIXY,

12
blk/304 Normal file
View File

@ -0,0 +1,12 @@
lblchkPS BSET ( chkPS )
( Note that you only need to call this in words that push
back to PSP. If they don't, calling chkPS is redundant with
check in next )
EXX,
( We have the return address for this very call on the stack
and protected registers. 2- is to compensate that. )
HL PS_ADDR 2- LDdn,
SP SUBHLd,
EXX,
CNC RETc, ( PS_ADDR >= SP? good )
JR, lblofl BWR ( abortUnderflow-B298 )

23
blk/305
View File

@ -1,12 +1,11 @@
lblchkPS BSET ( chkPS ) ( Native words )
( Note that you only need to call this in words that push CODE EXECUTE
back to PSP. If they don't, calling chkPS is redundant with DE POP,
check in next ) chkPS,
EXX, JR, lblexec BWR ( execute-B301 )
( We have the return address for this very call on the stack
and protected registers. 2- is to compensate that. ) CODE EXIT
HL PS_ADDR 2- LDdn, PC ORG @ 0x0d + ! ( stable ABI JP )
SP SUBHLd, 0x14 BCALL, ( popRS )
EXX, HL PUSH, IY POP, ( --> IP )
CNC RETc, ( PS_ADDR >= SP? good ) JPNEXT,
JR, lblofl BWR ( abortUnderflow-B298 )

View File

@ -1,8 +1,3 @@
( Native words )
CODE EXECUTE
DE POP,
chkPS,
JR, lblexec BWR ( execute-B301 )
CODE (s) ( string literal ) CODE (s) ( string literal )
PC ORG @ 0x2d + ! ( stable ABI JP ) PC ORG @ 0x2d + ! ( stable ABI JP )
( Like (n) but instead of being followed by a 2 bytes ( Like (n) but instead of being followed by a 2 bytes

View File

@ -2,8 +2,7 @@
is not an IMMEDIATE yet and will not be treated properly by is not an IMMEDIATE yet and will not be treated properly by
xcomp. ) xcomp. )
: _ : _
0x42 ( EXIT ) , 0x0b ( EXIT ) , R> DROP ( exit : )
R> DROP ( exit : )
; IMMEDIATE ; IMMEDIATE
';' X' _ 4 - C! ( give ; its name ) ';' X' _ 4 - C! ( give ; its name )
':' X' _ 4 - C! ( give : its name ) ':' X' _ 4 - C! ( give : its name )

View File

@ -2,10 +2,10 @@ VARIABLE lblexec VARIABLE lblnext
H@ ORG ! H@ ORG !
JMPn, 0 A,, ( 00, main ) 0 A, ( 03, boot driveno ) JMPn, 0 A,, ( 00, main ) 0 A, ( 03, boot driveno )
0 A,, ( 04, BOOT ) 0 A,, ( 04, BOOT )
0 A,, ( 06, uflw ) 0 A,, ( 08, LATEST ) 0 A,, ( 06, uflw ) 0 A,, ( 08, LATEST ) 0 A, ( unused )
0 A, 0 A, 0 A,, ( unused ) 0 A, JMPn, 0 A,, ( unused )
0 A, 0 A,, ( unused ) JMPn, 0 A,, ( 11, pushRS ) 0 A,, ( unused ) JMPn, 0 A,, ( unused )
JMPn, 0 A,, ( 14, popRS ) 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,, ( 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 )

10
blk/806
View File

@ -1,11 +1,5 @@
( BOOT DICT: There are only 3 words in the boot dict, but ORG @ 0x4c + HERE !
these words' offset need to be stable, so they're part of H@ 4 + XCURRENT ! ( make next CODE have 0 prev field )
the "stable ABI" )
'E' A, 'X' A, 'I' A, 'T' A, 0 A,, ( prev ) 4 A, ( len )
H@ XCURRENT ! ( set current tip of dict, 0x42 )
0 A, ( native )
DX [BP] 0 MOVx[]+, BP DECx, BP DECx, ( popRS )
;CODE NOP,
CODE (br) ( 0x53 ) L2 BSET ( used in br? ) CODE (br) ( 0x53 ) L2 BSET ( used in br? )
DI DX MOVxx, DI [DI] MOVx[], DX DI ADDxx, DI DX MOVxx, DI [DI] MOVx[], DX DI ADDxx,
;CODE NOP, NOP, ;CODE NOP, NOP,

View File

@ -1,7 +1,10 @@
( native words ) ( native words )
CODE EXECUTE 1 chkPS, CODE EXECUTE 1 chkPS,
DI POPx, JMPn, lblexec @ RPCn, DI POPx, JMPn, lblexec @ RPCn,
CODE EXIT
PC 0x0f - ORG @ 0x0d + ! ( stable abi )
DX [BP] 0 MOVx[]+, BP DECx, BP DECx, ( popRS )
;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 )
DI DX MOVxx, ( IP ) DI DX MOVxx, ( IP )

Binary file not shown.

View File

@ -287,7 +287,6 @@ VM* VM_init() {
native(SP_to_R_2); native(SP_to_R_2);
native(nlit); native(nlit);
native(slit); native(slit);
// End of stable ABI
native(SP_to_R); native(SP_to_R);
native(R_to_SP); native(R_to_SP);
native(R_to_SP_2); native(R_to_SP_2);

View File

@ -10,15 +10,13 @@ CREATE BIN( 0 ,
270 LOAD ( xcomp overrides ) 270 LOAD ( xcomp overrides )
H@ ORG ! H@ ORG !
ORG @ 0x0b + HERE !
0 C, 0 C, ( EXIT )
ORG @ 0x2b + HERE ! ORG @ 0x2b + HERE !
0 C, 0x06 C, ( (s) ) 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 ! H@ 4 + XCURRENT ! ( make next CODE have 0 prev field )
," EXIT"
0 , ( prev ) 4 C,
H@ XCURRENT ! ( set current tip of dict, 0x42 )
0 C, 0 C,
ORG @ 0x4c + HERE ! ORG @ 0x4c + HERE !
0x01 CODE (br) ( 0x53 ) 0x01 CODE (br) ( 0x53 )
ORG @ 0x5f + HERE ! ORG @ 0x5f + HERE !
@ -28,6 +26,7 @@ ORG @ 0x77 + HERE !
ORG @ 0xb9 + HERE ! ORG @ 0xb9 + HERE !
0x05 CODE (n) ( 0xbf ) 0x05 CODE (n) ( 0xbf )
( END OF STABLE ABI ) ( END OF STABLE ABI )
0x00 CODE EXIT
0x06 CODE (s) 0x06 CODE (s)
0x04 CODE 2>R 0x04 CODE 2>R
0x07 CODE >R 0x07 CODE >R