mirror of
https://github.com/hsoft/collapseos.git
synced 2024-11-02 08:20:57 +11:00
Compare commits
6 Commits
7c20501f27
...
33d37d4ce9
Author | SHA1 | Date | |
---|---|---|---|
|
33d37d4ce9 | ||
|
bd1e76ec5b | ||
|
9b85961093 | ||
|
76037ca1e7 | ||
|
bb77cd0759 | ||
|
0434d02818 |
7
blk/001
7
blk/001
@ -5,11 +5,10 @@ MASTER INDEX
|
|||||||
120 Linker 140 Addressed devices
|
120 Linker 140 Addressed devices
|
||||||
150 Extra words
|
150 Extra words
|
||||||
200 Z80 assembler 260 Cross compilation
|
200 Z80 assembler 260 Cross compilation
|
||||||
280 Z80 boot code 350 ACIA driver
|
280 Z80 boot code 390 Cross-compiled core
|
||||||
370 SD Card driver 390 Cross-compiled core
|
439 XPACKed core
|
||||||
439 Core words 480 AT28 Driver
|
|
||||||
490 TRS-80 Recipe 520 Fonts
|
490 TRS-80 Recipe 520 Fonts
|
||||||
550 TI-84+ Recipe
|
550 TI-84+ Recipe 580 RC2014 Recipe
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
1
blk/081
1
blk/081
@ -7,6 +7,7 @@ RAMSTART FUTURE USES +55 (key) override
|
|||||||
+0c C<* +70 DRIVERS
|
+0c C<* +70 DRIVERS
|
||||||
+0e WORDBUF +80 RAMEND
|
+0e WORDBUF +80 RAMEND
|
||||||
+2e BOOT C< PTR
|
+2e BOOT C< PTR
|
||||||
|
+30 FUTURE USES
|
||||||
+4e INTJUMP
|
+4e INTJUMP
|
||||||
+51 CURRENTPTR
|
+51 CURRENTPTR
|
||||||
+53 (emit) override
|
+53 (emit) override
|
||||||
|
14
blk/089
14
blk/089
@ -1,16 +1,16 @@
|
|||||||
Initialization sequence
|
Initialization sequence
|
||||||
|
|
||||||
On boot, we jump to the "main" routine in boot.fs which does
|
On boot, we jump to the "main" routine in B289 which does
|
||||||
very few things.
|
very few things.
|
||||||
|
|
||||||
1. Set SP to 0x10000-6
|
1. Set SP to PS_ADDR and IX to RS_ADDR
|
||||||
2. Sets HERE to RAMEND (RAMSTART+0x80).
|
2. Sets HERE to RAMEND (RAMSTART+0x80).
|
||||||
3. Sets CURRENT to value of LATEST field in stable ABI.
|
3. Sets CURRENT to value of LATEST field in stable ABI.
|
||||||
4. Look for the word "BOOT" and calls it.
|
4. Look for the word "BOOT" and calls it.
|
||||||
|
|
||||||
In a normal system, BOOT is in icore and does a few things:
|
In a normal system, BOOT is in xcomp core (B411) and does a
|
||||||
|
few things:
|
||||||
|
|
||||||
1. Find "(c<)" a set CINPTR to it (what C< calls).
|
1. Initialize all overrides to 0.
|
||||||
2. Initialize all overrides to 0.
|
2. Write LATEST in BOOT C< PTR ( see below )
|
||||||
3. Write LATEST in BOOT C< PTR ( see below )
|
3. Set "C<*", the word that C< calls to (boot<). (cont.)
|
||||||
4. Find "INIT". If found, execute. Otherwise, "INTERPRET"(cont)
|
|
||||||
|
27
blk/090
27
blk/090
@ -1,16 +1,15 @@
|
|||||||
On a bare system (only boot+icore), this sequence will result
|
4. Call INTERPRET
|
||||||
in (c<) reading characters from memory starting from CURRENT
|
|
||||||
(this is why we put CURRENT in BOOT C< PTR, it tracks current
|
|
||||||
pos ).
|
|
||||||
|
|
||||||
This means that you can put initialization code in source form
|
In other words, BOOT interprets bytes directly following
|
||||||
right into your binary, right after your last compiled dict
|
CURRENT as Forth source code. This code will typically
|
||||||
entry and it's going to be executed as such until you set a new
|
initialize all subsystems and then call RDLN$. As soon as
|
||||||
(c<).
|
this is called, INTERPRET will begin reading from RDLN< which
|
||||||
|
reads from KEY.
|
||||||
|
|
||||||
Note that there is no EMIT in a bare system. You have to take
|
In the "/emul" binaries, "HERE" is readjusted to "CURRENT @" so
|
||||||
care of supplying one before your load core.fs and its higher
|
that we don't have to relocate compiled dicts. Note that in
|
||||||
levels.
|
this context, the initialization code is fighting for space
|
||||||
|
with HERE: New entries to the dict will overwrite that code!
|
||||||
|
Also, because we're barebone, we can't have comments. This can
|
||||||
(cont.)
|
lead to peculiar code in this area where we try to "waste"
|
||||||
|
space in initialization code.
|
||||||
|
16
blk/091
16
blk/091
@ -1,16 +0,0 @@
|
|||||||
(cont.) In the "/emul" binaries, "HERE" is readjusted to
|
|
||||||
"CURRENT @" so that we don't have to relocate compiled dicts.
|
|
||||||
Note that in this context, the initialization code is fighting
|
|
||||||
for space with HERE: New entries to the dict will overwrite
|
|
||||||
that code! Also, because we're barebone, we can't have
|
|
||||||
comments. This can lead to peculiar code in this area where we
|
|
||||||
try to "waste" space in initialization code.
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
2
blk/260
2
blk/260
@ -2,7 +2,7 @@ Cross compilation program
|
|||||||
|
|
||||||
This programs allows cross compilation of boot binary and
|
This programs allows cross compilation of boot binary and
|
||||||
icore. Run "262 LOAD" right before your cross compilation and
|
icore. Run "262 LOAD" right before your cross compilation and
|
||||||
then set XCURRENT to CURRENT.
|
then "270 LOAD" to apply xcomp overrides.
|
||||||
|
|
||||||
This unit depends on a properly initialized z80a with ORG and
|
This unit depends on a properly initialized z80a with ORG and
|
||||||
BIN( set. That is how we determine compilation offsets.
|
BIN( set. That is how we determine compilation offsets.
|
||||||
|
1
blk/263
1
blk/263
@ -9,6 +9,7 @@ VARIABLE XCURRENT
|
|||||||
: XIMM XCON IMMEDIATE XCOFF ;
|
: XIMM XCON IMMEDIATE XCOFF ;
|
||||||
: _xapply ( a -- a-off )
|
: _xapply ( a -- a-off )
|
||||||
DUP ORG @ > IF ORG @ - BIN( @ + THEN ;
|
DUP ORG @ > IF ORG @ - BIN( @ + THEN ;
|
||||||
|
: X['] XCON ' _xapply LITA XCOFF ;
|
||||||
: XCOMPILE
|
: XCOMPILE
|
||||||
XCON ' _xapply LITA
|
XCON ' _xapply LITA
|
||||||
LIT< , (find) DROP _xapply , XCOFF ;
|
LIT< , (find) DROP _xapply , XCOFF ;
|
||||||
|
11
blk/270
Normal file
11
blk/270
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
: CODE XCODE ;
|
||||||
|
: ['] X['] ; IMMEDIATE
|
||||||
|
: COMPILE XCOMPILE ; IMMEDIATE
|
||||||
|
: [COMPILE] X[COMPILE] ; IMMEDIATE
|
||||||
|
: IMMEDIATE XIMM ;
|
||||||
|
: (entry) (xentry) ;
|
||||||
|
: CREATE XCREATE ;
|
||||||
|
: : [ ' X: , ] ;
|
||||||
|
|
||||||
|
CURRENT @ XCURRENT !
|
||||||
|
|
5
blk/405
5
blk/405
@ -1,7 +1,4 @@
|
|||||||
( The NOT is to normalize the negative/positive numbers to 1
|
: WS? 33 < ;
|
||||||
or 0. Hadn't we wanted to normalize, we'd have written:
|
|
||||||
32 CMP 1 - )
|
|
||||||
: WS? 33 CMP 1+ NOT ;
|
|
||||||
|
|
||||||
: TOWORD
|
: TOWORD
|
||||||
BEGIN
|
BEGIN
|
||||||
|
4
blk/406
4
blk/406
@ -1,5 +1,5 @@
|
|||||||
( Read word from C<, copy to WORDBUF, null-terminate, and
|
( Read word from C<, copy to WORDBUF, null-terminate, and
|
||||||
return, make HL point to WORDBUF. )
|
return WORDBUF. )
|
||||||
: WORD
|
: WORD
|
||||||
0x0e RAM+ ( 0e == WORDBUF )
|
0x0e RAM+ ( 0e == WORDBUF )
|
||||||
TOWORD ( a c )
|
TOWORD ( a c )
|
||||||
@ -8,7 +8,7 @@
|
|||||||
always zero to pre-write our null-termination )
|
always zero to pre-write our null-termination )
|
||||||
OVER ! 1+ ( a+1 )
|
OVER ! 1+ ( a+1 )
|
||||||
C< ( a c )
|
C< ( a c )
|
||||||
DUP WS?
|
OVER 0x2d ( 2e-1 for NULL ) RAM+ = OVER WS? OR
|
||||||
UNTIL
|
UNTIL
|
||||||
( a this point, PS is: a WS )
|
( a this point, PS is: a WS )
|
||||||
( null-termination is already written )
|
( null-termination is already written )
|
||||||
|
4
blk/409
4
blk/409
@ -5,10 +5,10 @@
|
|||||||
NOT IF (parse) ELSE EXECUTE THEN
|
NOT IF (parse) ELSE EXECUTE THEN
|
||||||
C<? NOT IF LIT< (ok) (find) IF EXECUTE THEN THEN
|
C<? NOT IF LIT< (ok) (find) IF EXECUTE THEN THEN
|
||||||
AGAIN ;
|
AGAIN ;
|
||||||
XCURRENT @ _xapply ( to PSP )
|
|
||||||
( Drop RSP until I-2 == INTERPRET. )
|
( Drop RSP until I-2 == INTERPRET. )
|
||||||
: EXIT!
|
: EXIT!
|
||||||
[ LITN ] ( I, from PSP )
|
['] INTERPRET ( I )
|
||||||
BEGIN ( I )
|
BEGIN ( I )
|
||||||
DUP ( I I )
|
DUP ( I I )
|
||||||
R> DROP I 2- @ ( I I a )
|
R> DROP I 2- @ ( I I a )
|
||||||
|
5
blk/411
5
blk/411
@ -6,10 +6,9 @@
|
|||||||
0 0x55 RAM+ ! ( 55 == (key) override )
|
0 0x55 RAM+ ! ( 55 == (key) override )
|
||||||
0 0x0a RAM+ ! ( NLPTR )
|
0 0x0a RAM+ ! ( NLPTR )
|
||||||
( 0c == C<* )
|
( 0c == C<* )
|
||||||
LIT< (boot<) (find) DROP 0x0c RAM+ !
|
['] (boot<) 0x0c RAM+ !
|
||||||
( boot< always has a char waiting. 06 == C<?* )
|
( boot< always has a char waiting. 06 == C<?* )
|
||||||
1 0x06 RAM+ !
|
1 0x06 RAM+ !
|
||||||
LIT< INIT (find)
|
INTERPRET
|
||||||
IF EXECUTE ELSE DROP INTERPRET THEN
|
|
||||||
;
|
;
|
||||||
|
|
||||||
|
2
blk/430
2
blk/430
@ -6,7 +6,7 @@
|
|||||||
the last typed 0x0a and one for the following NULL. )
|
the last typed 0x0a and one for the following NULL. )
|
||||||
IN) IN> - 2+ ALLOT
|
IN) IN> - 2+ ALLOT
|
||||||
(infl)
|
(infl)
|
||||||
LIT< RDLN< (find) DROP 0x0c RAM+ !
|
['] RDLN< 0x0c RAM+ !
|
||||||
1 0x06 RAM+ ! ( 06 == C<? )
|
1 0x06 RAM+ ! ( 06 == C<? )
|
||||||
;
|
;
|
||||||
|
|
||||||
|
1
blk/432
1
blk/432
@ -9,7 +9,6 @@
|
|||||||
EXIT!
|
EXIT!
|
||||||
THEN
|
THEN
|
||||||
;
|
;
|
||||||
XCURRENT @ _xapply ( to PSP, for LOAD )
|
|
||||||
( pre-comment for tight LOAD: The 0x08==I check after INTERPRET
|
( pre-comment for tight LOAD: The 0x08==I check after INTERPRET
|
||||||
is to check whether we're restoring to "_", the word above.
|
is to check whether we're restoring to "_", the word above.
|
||||||
if yes, then we're in a nested load. Also, the 1 in 0x06 is
|
if yes, then we're in a nested load. Also, the 1 in 0x06 is
|
||||||
|
2
blk/433
2
blk/433
@ -5,7 +5,7 @@
|
|||||||
0x2e RAM+ @ >R ( boot ptr )
|
0x2e RAM+ @ >R ( boot ptr )
|
||||||
BLK@
|
BLK@
|
||||||
BLK( 0x2e RAM+ ! ( Point to beginning of BLK )
|
BLK( 0x2e RAM+ ! ( Point to beginning of BLK )
|
||||||
[ LITN ( from PSP, B432 ) ] 0x08 RAM+ !
|
['] _ 0x08 RAM+ !
|
||||||
1 0x06 RAM+ ! ( 06 == C<? )
|
1 0x06 RAM+ ! ( 06 == C<? )
|
||||||
INTERPRET
|
INTERPRET
|
||||||
R> 0x2e RAM+ ! R> 0x06 RAM+ !
|
R> 0x2e RAM+ ! R> 0x06 RAM+ !
|
||||||
|
22
blk/439
22
blk/439
@ -1,12 +1,14 @@
|
|||||||
Core words
|
XPACKed core
|
||||||
|
|
||||||
These words follow cross-compiled words, but unlike them, these
|
Most of Collapse OS' core words are cross compiled (B390).
|
||||||
are self-bootstrapping and don't depend on the Cross Compiler.
|
However, some of them are too dynamically referenced to be
|
||||||
They will typically be included in source form right after a
|
cross-compiled without great pain, so we XPACK (B267) them,
|
||||||
stage1 binary which will interpret it on boot and bootstrap
|
that is, we put them in source form in the target's
|
||||||
itself to a full intepreter, which can then be relinked with
|
initialization section (see B89).
|
||||||
the Relinker. There is no loader for these libraries because
|
|
||||||
you will typically XPACK (B267) them.
|
|
||||||
|
|
||||||
440 core 447 readln
|
These words will be compiled into RAM at initialization, which
|
||||||
453 blk
|
is a bit wasteful both in RAM and in boot time, so we will
|
||||||
|
typically relink (B120) that newly compiled binary and append
|
||||||
|
it to our existing binary for optimal resource usage.
|
||||||
|
|
||||||
|
Load range: 440-446
|
||||||
|
7
blk/580
Normal file
7
blk/580
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
RC2014 Recipe
|
||||||
|
|
||||||
|
Support code for the RC2014 recipe. Contains drivers for the
|
||||||
|
ACIA, SD card and AT28 EEPROM.
|
||||||
|
|
||||||
|
581 ACIA 590 AT28 EEPROM
|
||||||
|
600 SD card
|
@ -13,4 +13,4 @@ ACIA_MEM: Address in memory that can be used variables shared
|
|||||||
with ACIA's native words. 8 bytes used.
|
with ACIA's native words. 8 bytes used.
|
||||||
|
|
||||||
The whole driver is cross-compilable and is loaded with
|
The whole driver is cross-compilable and is loaded with
|
||||||
"352 LOAD"
|
"582 LOAD"
|
@ -3,4 +3,4 @@ AT28 Driver
|
|||||||
Write to an AT28 EEPROM while making sure that proper timing
|
Write to an AT28 EEPROM while making sure that proper timing
|
||||||
is followed and verify data integrity.
|
is followed and verify data integrity.
|
||||||
|
|
||||||
Load with "481 LOAD"
|
Load with "591 LOAD"
|
BIN
emul/forth.bin
BIN
emul/forth.bin
Binary file not shown.
@ -20,9 +20,9 @@
|
|||||||
RDLN$
|
RDLN$
|
||||||
LIT< _sys [entry]
|
LIT< _sys [entry]
|
||||||
." Collapse OS" NL
|
." Collapse OS" NL
|
||||||
INTERPRET
|
|
||||||
;
|
;
|
||||||
|
|
||||||
(entry) _
|
(entry) _
|
||||||
H@ 256 /MOD 2 PC! 2 PC!
|
|
||||||
H@ 0x08 BIN+ ! ( update LATEST )
|
H@ 0x08 BIN+ ! ( update LATEST )
|
||||||
|
," INIT "
|
||||||
|
H@ 256 /MOD 2 PC! 2 PC!
|
||||||
|
@ -3,14 +3,7 @@
|
|||||||
0xfffa CONSTANT PS_ADDR
|
0xfffa CONSTANT PS_ADDR
|
||||||
212 LOAD ( z80 assembler )
|
212 LOAD ( z80 assembler )
|
||||||
262 LOAD ( xcomp )
|
262 LOAD ( xcomp )
|
||||||
: CODE XCODE ;
|
270 LOAD ( xcomp overrides )
|
||||||
: COMPILE XCOMPILE ; IMMEDIATE
|
|
||||||
: [COMPILE] X[COMPILE] ; IMMEDIATE
|
|
||||||
: IMMEDIATE XIMM ;
|
|
||||||
: (entry) (xentry) ;
|
|
||||||
: : [ ' X: , ] ;
|
|
||||||
|
|
||||||
CURRENT @ XCURRENT !
|
|
||||||
|
|
||||||
282 LOAD ( boot.z80 )
|
282 LOAD ( boot.z80 )
|
||||||
393 LOAD ( xcomp core low )
|
393 LOAD ( xcomp core low )
|
||||||
|
@ -46,7 +46,7 @@ Addressed devices are at B140. To know what you have to paste, open the loader
|
|||||||
block (B142) and see what blocks it loads. For each of the blocks, copy/paste
|
block (B142) and see what blocks it loads. For each of the blocks, copy/paste
|
||||||
the code in your interpreter.
|
the code in your interpreter.
|
||||||
|
|
||||||
Do the same thing with the AT28 driver (B480)
|
Do the same thing with the AT28 driver (B590)
|
||||||
|
|
||||||
If you're doing the real thing and not using the emulator, pasting so much code
|
If you're doing the real thing and not using the emulator, pasting so much code
|
||||||
at once might freeze up the RC2014, so it is recommended that you use
|
at once might freeze up the RC2014, so it is recommended that you use
|
||||||
|
@ -72,13 +72,13 @@ instead.
|
|||||||
|
|
||||||
Your Collapse OS binary needs the SDC drivers which need to be inserted during
|
Your Collapse OS binary needs the SDC drivers which need to be inserted during
|
||||||
Cross Compilation, which needs you need to recompile it from stage 1. First,
|
Cross Compilation, which needs you need to recompile it from stage 1. First,
|
||||||
look at B370. You'll see that it indicates a block range for the driver. That
|
look at B600. You'll see that it indicates a block range for the driver. That
|
||||||
needs to be loaded.
|
needs to be loaded.
|
||||||
|
|
||||||
Open xcomp.fs from base recipe and locate acia loading. You'll insert a line
|
Open xcomp.fs from base recipe and locate acia loading. You'll insert a line
|
||||||
right after that that will look like:
|
right after that that will look like:
|
||||||
|
|
||||||
372 387 LOADR ( sdc )
|
602 616 LOADR ( sdc )
|
||||||
|
|
||||||
Normally, that's all you need to do. However, you have a little problem: You're
|
Normally, that's all you need to do. However, you have a little problem: You're
|
||||||
busting the 8K ROM limit. But it's ok, you can remove the linker's XPACKing
|
busting the 8K ROM limit. But it's ok, you can remove the linker's XPACKing
|
||||||
|
@ -9,19 +9,11 @@
|
|||||||
RAMSTART 0x70 + CONSTANT ACIA_MEM
|
RAMSTART 0x70 + CONSTANT ACIA_MEM
|
||||||
212 LOAD ( z80 assembler )
|
212 LOAD ( z80 assembler )
|
||||||
262 LOAD ( xcomp )
|
262 LOAD ( xcomp )
|
||||||
: CODE XCODE ;
|
270 LOAD ( xcomp overrides )
|
||||||
: COMPILE XCOMPILE ; IMMEDIATE
|
|
||||||
: [COMPILE] X[COMPILE] ; IMMEDIATE
|
|
||||||
: IMMEDIATE XIMM ;
|
|
||||||
: (entry) (xentry) ;
|
|
||||||
: CREATE XCREATE ;
|
|
||||||
: : [ ' X: , ] ;
|
|
||||||
|
|
||||||
CURRENT @ XCURRENT !
|
|
||||||
|
|
||||||
282 LOAD ( boot.z80 )
|
282 LOAD ( boot.z80 )
|
||||||
393 LOAD ( xcomp core low )
|
393 LOAD ( xcomp core low )
|
||||||
352 LOAD ( acia )
|
582 LOAD ( acia )
|
||||||
420 LOAD ( xcomp core high )
|
420 LOAD ( xcomp core high )
|
||||||
(entry) _
|
(entry) _
|
||||||
( Update LATEST )
|
( Update LATEST )
|
||||||
|
@ -8,13 +8,7 @@ RAMSTART 0x72 + CONSTANT KBD_MEM
|
|||||||
: ZFILL, ( u ) 0 DO 0 A, LOOP ;
|
: ZFILL, ( u ) 0 DO 0 A, LOOP ;
|
||||||
262 LOAD ( xcomp )
|
262 LOAD ( xcomp )
|
||||||
522 LOAD ( font compiler )
|
522 LOAD ( font compiler )
|
||||||
: CODE XCODE ;
|
270 LOAD ( xcomp overrides )
|
||||||
: COMPILE XCOMPILE ; IMMEDIATE
|
|
||||||
: [COMPILE] X[COMPILE] ; IMMEDIATE
|
|
||||||
: IMMEDIATE XIMM ;
|
|
||||||
: (entry) (xentry) ;
|
|
||||||
: CREATE XCREATE ; ( for KBD tbls )
|
|
||||||
: : [ ' X: , ] ;
|
|
||||||
|
|
||||||
( TI-84+ requires specific code at specific offsets which
|
( TI-84+ requires specific code at specific offsets which
|
||||||
come in conflict with Collapse OS' stable ABI. We thus
|
come in conflict with Collapse OS' stable ABI. We thus
|
||||||
|
@ -3,14 +3,7 @@
|
|||||||
RS_ADDR 0x80 - CONSTANT RAMSTART
|
RS_ADDR 0x80 - CONSTANT RAMSTART
|
||||||
212 LOAD ( z80 assembler )
|
212 LOAD ( z80 assembler )
|
||||||
262 LOAD ( xcomp )
|
262 LOAD ( xcomp )
|
||||||
: CODE XCODE ;
|
270 LOAD ( xcomp overrides )
|
||||||
: COMPILE XCOMPILE ; IMMEDIATE
|
|
||||||
: [COMPILE] X[COMPILE] ; IMMEDIATE
|
|
||||||
: IMMEDIATE XIMM ;
|
|
||||||
: (entry) (xentry) ;
|
|
||||||
: : [ ' X: , ] ;
|
|
||||||
|
|
||||||
CURRENT @ XCURRENT !
|
|
||||||
|
|
||||||
0x3000 BIN( !
|
0x3000 BIN( !
|
||||||
282 LOAD ( boot.z80 )
|
282 LOAD ( boot.z80 )
|
||||||
|
Loading…
Reference in New Issue
Block a user