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