diff --git a/blk/265 b/blk/265 index 905ce9b..534dbcb 100644 --- a/blk/265 +++ b/blk/265 @@ -1,7 +1,8 @@ : X: (xentry) 1 ( compiled ) C, BEGIN - WORD DUP LIT" ;" S= IF DROP 0x0b , EXIT THEN + WORD DUP LIT" ;" S= IF + DROP LIT" EXIT" XFIND , EXIT THEN XCURRENT @ SWAP ( xcur w ) _find ( a f ) IF ( a ) DUP IMMED? IF ABORT THEN @@ -11,5 +12,4 @@ IF DUP IMMED? NOT IF ABORT THEN EXECUTE ELSE (parse) XLITN THEN THEN - AGAIN -; + AGAIN ; diff --git a/blk/280 b/blk/280 index ace73f8..9892f73 100644 --- a/blk/280 +++ b/blk/280 @@ -9,8 +9,7 @@ is IP. SP points to PSP TOS, but you can still use the stack in native code. you just have to make sure you've restored it before "next". -STABLE ABI: The boot binary starts with a list of references. -The address of these references have to stay to those addr- -esses. The rest of the Collapse OS code depend on it. In fact, -up until 0x67, the (?br) wordref, pretty much everything has -to stay put. (cont.) +The boot binary is loaded in 2 parts. The first part, "decla- +rations", are loaded after xcomp, before xcomp overrides, with +"282 LOAD". The rest, after xcomp overrides, with "283 335 +LOADR". diff --git a/blk/281 b/blk/281 deleted file mode 100644 index 5c2b1c8..0000000 --- a/blk/281 +++ /dev/null @@ -1,4 +0,0 @@ -The boot binary is loaded in 2 parts. The first part, "decla- -rations", are loaded after xcomp, before xcomp overrides, with -"282 LOAD". The rest, after xcomp overrides, with "283 335 -LOADR". diff --git a/blk/283 b/blk/283 index cf18906..de4815d 100644 --- a/blk/283 +++ b/blk/283 @@ -1,7 +1,7 @@ H@ ORG ! ( STABLE ABI ) 0 JP, ( 00, main ) NOP, ( unused ) NOP, NOP, ( 04, BOOT ) -NOP, NOP, ( 06, uflw ) NOP, NOP, ( 08, LATEST ) NOP, ( unused ) -0 A, 0 JP, ( 0b, EXIT ) NOP, ( unused ) +NOP, NOP, ( 06, uflw ) NOP, NOP, ( 08, LATEST ) +NOP, NOP, NOP, NOP, NOP, NOP, ( unused ) 0 JP, ( RST 10 ) NOP, NOP, ( 13, oflw ) NOP, NOP, NOP, NOP, NOP, ( unused ) 0 JP, ( 1a, next ) NOP, NOP, NOP, ( unused ) diff --git a/blk/287 b/blk/287 index 43dbbae..9f66c93 100644 --- a/blk/287 +++ b/blk/287 @@ -1,10 +1,5 @@ lblexec BSET L1 FSET ( B284 ) L2 FSET ( B286 ) ( DE -> wordref ) - ( When we have a BIN( offset, we need to adjust stable - ABI offsets. ) - BIN( @ [IF] - A XORr, D ORr, IFZ, D BIN( @ 256 / LDri, THEN, - [THEN] LDA(DE), DE INCd, A ORr, IFZ, EXDEHL, JP(HL), THEN, A DECr, JRZ, L1 FWR ( compiled B289 ) diff --git a/blk/305 b/blk/305 index df45427..26fb37a 100644 --- a/blk/305 +++ b/blk/305 @@ -4,7 +4,6 @@ CODE EXECUTE lblexec @ JP, CODE EXIT -PC ORG @ 0x0d + ! ( stable ABI JP ) C 0 IX+ LDrIXY, B 1 IX+ LDrIXY, IX DECd, IX DECd, diff --git a/blk/397 b/blk/397 index 81bc1a9..b1af1cd 100644 --- a/blk/397 +++ b/blk/397 @@ -9,7 +9,7 @@ : _ ( : will get its name almost at the very end ) (entry) 1 ( compiled ) C, BEGIN - WORD DUP LIT" ;" S= IF DROP 0x0b , EXIT THEN + WORD DUP LIT" ;" S= IF DROP COMPILE EXIT EXIT THEN FIND IF ( is word ) DUP IMMED? IF EXECUTE ELSE , THEN ELSE ( maybe number ) (parse) LITN THEN AGAIN ; diff --git a/blk/805 b/blk/805 index 6db43f3..dbc7e12 100644 --- a/blk/805 +++ b/blk/805 @@ -3,7 +3,7 @@ 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,, ( unused ) -JMPn, 0 A,, ( 0b, EXIT ) +0 A, 0 A,, ( 0b, EXIT ) 0 A,, 0 A,, ( unused ) 0 A,, ( 13, oflw ) 0 A,, 0 A,, 0 A, ( unused ) JMPn, 0 A,, ( 1a, next ) diff --git a/blk/811 b/blk/811 index cabbdca..f4a2892 100644 --- a/blk/811 +++ b/blk/811 @@ -2,7 +2,6 @@ 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 diff --git a/cvm/forth.bin b/cvm/forth.bin index 5f03494..1062b4b 100644 Binary files a/cvm/forth.bin and b/cvm/forth.bin differ diff --git a/cvm/xcomp.fs b/cvm/xcomp.fs index eb33c22..1ca494b 100644 --- a/cvm/xcomp.fs +++ b/cvm/xcomp.fs @@ -11,9 +11,7 @@ CREATE BIN( 0 , 270 LOAD ( xcomp overrides ) H@ ORG ! -0x0b ALLOT0 -0 C, 0 C, ( EXIT ) -0x08 ALLOT0 +0x15 ALLOT0 ( END OF STABLE ABI ) H@ 4 + XCURRENT ! ( make next CODE have 0 prev field ) 0x00 CODE EXIT diff --git a/doc/impl.txt b/doc/impl.txt index 1e015bd..97113d0 100644 --- a/doc/impl.txt +++ b/doc/impl.txt @@ -195,28 +195,13 @@ otherwise be difficult to access. Here's the complete list of these references: 04 BOOT addr 06 (uflw) addr 08 LATEST -0b EXIT wordref 13 (oflw) addr 1a next addr +13 (oflw) addr 1a next addr BOOT, (uflw) and (oflw) exist because they are referred to before those words are defined (in core words). LATEST is a critical part of the initialization sequence. -Stable wordrefs are there for more complicated reasons. When -cross-compiling Collapse OS, we use immediate words from the -host and some of them compile wordrefs (LITN compiles (n), -";" compiles EXIT). These compiled wordref need to be stable -across binaries, so they're part of the stable ABI. - -Another layer of complexity is the fact that some binaries -don't begin at offset 0. In that case, the stable ABI doesn't -begin at 0 either. The EXECUTE word has a special handling of -those case where any wordref < 0x100 has the binary offset -applied to it. - -But that's not the end of our problems. If an offsetted binary -cross compiles a binary with a different offset, stable ABI -references will be > 0x100 and be broken. - -For this reason, any stable wordref compiled in the "hot zone" -(B397-B400) has to be compiled by direct offset reference to -avoid having any binary offset applied to it. +All Collapse OS binaries, regardless of architecture, have +those values at those offsets of them. Some binaries are built +to run at offset different than zero. This stable ABI lives at +that offset, not 0.