diff --git a/blk/283 b/blk/283 index 25d763b..1b863e5 100644 --- a/blk/283 +++ b/blk/283 @@ -1,7 +1,7 @@ H@ ORG ! 0 JP, ( 00, main ) NOP, ( unused ) NOP, NOP, ( 04, BOOT ) -NOP, NOP, ( 06, uflw ) NOP, NOP, ( 08, LATEST ) -NOP, NOP, NOP, NOP, NOP, NOP, ( unused ) +NOP, NOP, ( 06, uflw ) NOP, NOP, ( 08, LATEST ) NOP, ( unused ) +0 A, 0 JP, ( 0b, EXIT ) NOP, ( unused ) 0 JP, ( RST 10 ) NOP, ( unused ) 0 JP, ( 14, popRS ) NOP, NOP, NOP, ( unused ) 0 JP, ( 1a, next ) NOP, NOP, NOP, ( unused ) diff --git a/blk/284 b/blk/284 index b9aa9a7..e54bce3 100644 --- a/blk/284 +++ b/blk/284 @@ -1,11 +1,5 @@ -( BOOT DICT: There are only 3 words in the boot dict, but - these words' offset need to be stable, so they're part of - the "stable ABI" ) +ORG @ 0x4c + HERE ! 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 ) L2 BSET ( used in CBR ) E 0 IY+ LDrIXY, D 1 IY+ LDrIXY, diff --git a/blk/304 b/blk/304 new file mode 100644 index 0000000..81d69c2 --- /dev/null +++ b/blk/304 @@ -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 ) diff --git a/blk/305 b/blk/305 index 81d69c2..4666016 100644 --- a/blk/305 +++ b/blk/305 @@ -1,12 +1,11 @@ -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 ) +( Native words ) +CODE EXECUTE + DE POP, + chkPS, + JR, lblexec BWR ( execute-B301 ) + +CODE EXIT +PC ORG @ 0x0d + ! ( stable ABI JP ) + 0x14 BCALL, ( popRS ) + HL PUSH, IY POP, ( --> IP ) + JPNEXT, diff --git a/blk/306 b/blk/306 index 6d6ed6c..fddc699 100644 --- a/blk/306 +++ b/blk/306 @@ -1,8 +1,3 @@ -( Native words ) -CODE EXECUTE - DE POP, - chkPS, - JR, lblexec BWR ( execute-B301 ) CODE (s) ( string literal ) PC ORG @ 0x2d + ! ( stable ABI JP ) ( Like (n) but instead of being followed by a 2 bytes diff --git a/blk/400 b/blk/400 index 3aded5f..1ad17ef 100644 --- a/blk/400 +++ b/blk/400 @@ -2,8 +2,7 @@ is not an IMMEDIATE yet and will not be treated properly by xcomp. ) : _ - 0x42 ( EXIT ) , - R> DROP ( exit : ) + 0x0b ( EXIT ) , R> DROP ( exit : ) ; IMMEDIATE ';' X' _ 4 - C! ( give ; its name ) ':' X' _ 4 - C! ( give : its name ) diff --git a/blk/805 b/blk/805 index b116fbf..a0c8dd4 100644 --- a/blk/805 +++ b/blk/805 @@ -2,10 +2,10 @@ VARIABLE lblexec VARIABLE lblnext H@ ORG ! JMPn, 0 A,, ( 00, main ) 0 A, ( 03, boot driveno ) 0 A,, ( 04, BOOT ) -0 A,, ( 06, uflw ) 0 A,, ( 08, LATEST ) -0 A, 0 A, 0 A,, ( unused ) -0 A, 0 A,, ( unused ) JMPn, 0 A,, ( 11, pushRS ) -JMPn, 0 A,, ( 14, popRS ) 0 A, 0 A,, ( unused ) +0 A,, ( 06, uflw ) 0 A,, ( 08, LATEST ) 0 A, ( unused ) +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 ) diff --git a/blk/806 b/blk/806 index 722444a..a55d30f 100644 --- a/blk/806 +++ b/blk/806 @@ -1,11 +1,5 @@ -( BOOT DICT: There are only 3 words in the boot dict, but - these words' offset need to be stable, so they're part of - 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, +ORG @ 0x4c + HERE ! +H@ 4 + XCURRENT ! ( make next CODE have 0 prev field ) CODE (br) ( 0x53 ) L2 BSET ( used in br? ) DI DX MOVxx, DI [DI] MOVx[], DX DI ADDxx, ;CODE NOP, NOP, diff --git a/blk/812 b/blk/812 index fef1638..d0adf9e 100644 --- a/blk/812 +++ b/blk/812 @@ -1,7 +1,10 @@ ( 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 CODE (s) ( string literal, see B287 ) PC 0x2f - ORG @ 0x2d + ! ( stable abi ) DI DX MOVxx, ( IP ) diff --git a/cvm/forth.bin b/cvm/forth.bin index 2991657..7848cc6 100644 Binary files a/cvm/forth.bin and b/cvm/forth.bin differ diff --git a/cvm/vm.c b/cvm/vm.c index f3aa6d5..0ae10e9 100644 --- a/cvm/vm.c +++ b/cvm/vm.c @@ -287,7 +287,6 @@ VM* VM_init() { native(SP_to_R_2); native(nlit); native(slit); - // End of stable ABI native(SP_to_R); native(R_to_SP); native(R_to_SP_2); diff --git a/cvm/xcomp.fs b/cvm/xcomp.fs index 5fb610a..5153b13 100644 --- a/cvm/xcomp.fs +++ b/cvm/xcomp.fs @@ -10,15 +10,13 @@ CREATE BIN( 0 , 270 LOAD ( xcomp overrides ) H@ ORG ! +ORG @ 0x0b + HERE ! +0 C, 0 C, ( EXIT ) ORG @ 0x2b + HERE ! 0 C, 0x06 C, ( (s) ) ORG @ 0x33 + HERE ! 0 C, 0x04 C, ( 2>R ) -ORG @ 0x3b + HERE ! -," EXIT" -0 , ( prev ) 4 C, -H@ XCURRENT ! ( set current tip of dict, 0x42 ) -0 C, 0 C, +H@ 4 + XCURRENT ! ( make next CODE have 0 prev field ) ORG @ 0x4c + HERE ! 0x01 CODE (br) ( 0x53 ) ORG @ 0x5f + HERE ! @@ -28,6 +26,7 @@ ORG @ 0x77 + HERE ! ORG @ 0xb9 + HERE ! 0x05 CODE (n) ( 0xbf ) ( END OF STABLE ABI ) +0x00 CODE EXIT 0x06 CODE (s) 0x04 CODE 2>R 0x07 CODE >R