1
0
mirror of https://github.com/hsoft/collapseos.git synced 2024-11-26 20:18:06 +11:00

Compare commits

..

4 Commits

Author SHA1 Message Date
Virgil Dupras
d041b91846 Optimize chkPS
Use EXX instead of the stack for HL protection and remove all
spurious uses of chkPS,

I wanted to inline chkPS in next because of its "tight loop" status,
but for reasons I don't understand, doing so breaks Collapse OS.
Later...
2020-05-22 23:12:03 -04:00
Virgil Dupras
4f2c2ab80a z80a: add a few ops 2020-05-22 22:23:24 -04:00
Virgil Dupras
581c6d015c Fix blk overflow in usage guide index 2020-05-22 20:39:28 -04:00
Virgil Dupras
a2136e604d rc2014/eeprom: adjust instructions
Now that adev is directly in core, things are easier.
2020-05-22 20:35:01 -04:00
14 changed files with 37 additions and 42 deletions

View File

@ -10,8 +10,7 @@ the dictionary (B30) for a word reference.
Contents Contents
4 Number literals 6 Compilation vs meta-comp. 5 Number literals 6 Compilation vs meta-comp.
8 Interpreter I/O 11 Signed-ness 8 Interpreter I/O 11 Signed-ness
14 Addressed devices 17 DOES> 14 Addressed devices 17 DOES>
18 Disk blocks 21 How blocks are organized 18 Disk blocks (cont.)
22 Addressed devices

12
blk/004
View File

@ -1,11 +1 @@
Number literals 21 How blocks are organized 22 Addressed devices
Traditional Forth often use HEX/DEC switches to go from decimal
to hexadecimal parsing. Collapse OS parses literals in a way
that is closer to C.
Straight numbers are decimals, numbers starting with "0x"
are hexadecimals (example "0x12ef"), "0b" prefixes indicate
binary (example "0b1010"), char literals are single characters
surrounded by ' (example 'X'). Char literals can't be used for
whitespaces.

12
blk/005 Normal file
View File

@ -0,0 +1,12 @@
Number literals
Traditional Forth often use HEX/DEC switches to go from decimal
to hexadecimal parsing. Collapse OS parses literals in a way
that is closer to C.
Straight numbers are decimals, numbers starting with "0x"
are hexadecimals (example "0x12ef"), "0b" prefixes indicate
binary (example "0b1010"), char literals are single characters
surrounded by ' (example 'X'). Char literals can't be used for
whitespaces.

View File

@ -1,8 +1,10 @@
: OP1 CREATE C, DOES> C@ A, ; : OP1 CREATE C, DOES> C@ A, ;
0xf3 OP1 DI, 0xfb OP1 EI, 0xf3 OP1 DI, 0xfb OP1 EI,
0xeb OP1 EXDEHL, 0xd9 OP1 EXX, 0xeb OP1 EXDEHL, 0xd9 OP1 EXX,
0x08 OP1 EXAFAF',
0x76 OP1 HALT, 0xe9 OP1 JP(HL), 0x76 OP1 HALT, 0xe9 OP1 JP(HL),
0x12 OP1 LD(DE)A, 0x1a OP1 LDA(DE), 0x12 OP1 LD(DE)A, 0x1a OP1 LDA(DE),
0x02 OP1 LD(BC)A, 0x0a OP1 LDA(BC),
0x00 OP1 NOP, 0xc9 OP1 RET, 0x00 OP1 NOP, 0xc9 OP1 RET,
0x17 OP1 RLA, 0x07 OP1 RLCA, 0x17 OP1 RLA, 0x07 OP1 RLCA,
0x1f OP1 RRA, 0x0f OP1 RRCA, 0x1f OP1 RRA, 0x0f OP1 RRCA,

View File

@ -1,11 +1,11 @@
CODE (?br) ( 0x67 ) CODE (?br) ( 0x67 )
HL POPqq, chkPS, HL POPqq,
HLZ, HLZ,
JRZ, L2 BWR ( BR + 2. False, branch ) JRZ, L2 BWR ( BR + 2. False, branch )
L1 BSET ( loop will jump here ) L1 BSET ( loop will jump here )
( True, skip next 2 bytes and don't branch ) ( True, skip next 2 bytes and don't branch )
IY INCss, IY INCss, IY INCss, IY INCss,
JPNEXT, JPNEXT, NOP, NOP, NOP,
CODE (loop) ( 0x77 ) CODE (loop) ( 0x77 )
0 IX+ INC(IXY+), IFZ, 1 IX+ INC(IXY+), THEN, ( I++ ) 0 IX+ INC(IXY+), IFZ, 1 IX+ INC(IXY+), THEN, ( I++ )
( Jump if I <> I' ) ( Jump if I <> I' )

View File

@ -1,11 +1,11 @@
CODE >R ( 0xa8 ) CODE >R ( 0xa8 )
HL POPqq, chkPS, HL POPqq,
17 BCALL, ( 17 == pushRS ) 17 BCALL, ( 17 == pushRS )
;CODE ;CODE NOP, NOP, NOP,
CODE 2>R ( 0xb9 ) CODE 2>R ( 0xb9 )
DE POPqq, HL POPqq, chkPS, DE POPqq, HL POPqq,
17 BCALL, ( 17 == pushRS ) EXDEHL, 17 BCALL, 17 BCALL, ( 17 == pushRS ) EXDEHL, 17 BCALL,
;CODE ;CODE NOP, NOP, NOP,
CODE R> ( 0xce ) CODE R> ( 0xce )
20 BCALL, ( 20 == popRS ) 20 BCALL, ( 20 == popRS )
HL PUSHqq, HL PUSHqq,

11
blk/299
View File

@ -1,10 +1,13 @@
PC ORG @ 0x1e + ! ( chkPS ) PC ORG @ 0x1e + ! ( chkPS )
HL PUSHqq, ( 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 ( We have the return address for this very call on the stack
and protected registers. 4 - is to compensate that. ) and protected registers. 2 - is to compensate that. )
HL PS_ADDR 4 - LDddnn, HL PS_ADDR 2 - LDddnn,
SP SUBHLss, SP SUBHLss,
HL POPqq, EXX,
CNC RETcc, ( PS_ADDR >= SP? good ) CNC RETcc, ( PS_ADDR >= SP? good )
JR, L2 BWR ( abortUnderflow-B298 ) JR, L2 BWR ( abortUnderflow-B298 )

View File

@ -1,6 +1,5 @@
CODE PICK CODE PICK
HL POPqq, HL POPqq,
chkPS,
( x2 ) ( x2 )
L SLAr, H RLr, L SLAr, H RLr,
SP ADDHLss, SP ADDHLss,

View File

@ -2,7 +2,6 @@
CODE 2DROP CODE 2DROP
HL POPqq, HL POPqq,
HL POPqq, HL POPqq,
chkPS,
;CODE ;CODE
( a b -- a b a b ) ( a b -- a b a b )

View File

@ -1,7 +1,6 @@
CODE ! CODE !
HL POPqq, HL POPqq,
DE POPqq, DE POPqq,
chkPS,
(HL) E LDrr, (HL) E LDrr,
HL INCss, HL INCss,
(HL) D LDrr, (HL) D LDrr,

View File

@ -1,7 +1,6 @@
CODE C! CODE C!
HL POPqq, HL POPqq,
DE POPqq, DE POPqq,
chkPS,
(HL) E LDrr, (HL) E LDrr,
;CODE ;CODE

View File

@ -1,7 +1,6 @@
CODE PC! CODE PC!
BC POPqq, BC POPqq,
HL POPqq, HL POPqq,
chkPS,
L OUT(C)r, L OUT(C)r,
;CODE ;CODE

Binary file not shown.

View File

@ -34,19 +34,13 @@ I don't think you need a schematic. It's really simple.
### Building the binary ### Building the binary
You build the binary by modifying the base recipe's `xcomp` unit. This binary The binary from the base recipe has almost all it needs to write to EEPROM. The
is missing 2 things: Addressed devices and the AT28 Driver. only thing it needs is the AT28 driver from B590. You could add it to the
`xcomp` unit and rebuild, but the driver is so tiny, you're probably better off
loading it at runtime.
Addressed devices are at B140. If you read that block, you'll see that it tells If your system has mass storage, it's as easy as a LOAD. If it doesn't, you
you to load block 142. Open the `xcomp` unit and locate the ACIA driver loading can use `/tools/exec` to send `blk/591` to the RC2014.
line. Insert your new load line after that one.
Do the same thing with the AT28 driver (B590)
You also have to modify the initialization sequence at the end of the `xcomp`
unit to include `ADEV$`.
Build again, write `os.com` to EEPROM.
## Writing contents to the AT28 ## Writing contents to the AT28
@ -58,7 +52,7 @@ run this from your modern computer:
./upload <tty device> a000 <filename> ./upload <tty device> a000 <filename>
Then, activate `AT28!` with `' AT28! A!* !` and then run Then, activate `AT28!` with `' AT28! A!* !` and then run
`0xa000 0x2000 <size-of-bin> AMOVE`. `AT28!` checks every myte for integrity, `0xa000 0x2000 <size-of-bin> AMOVE`. `AT28!` checks every byte for integrity,
so it there's no error, you should be fine. Your content is now on the EEPROM! so it there's no error, you should be fine. Your content is now on the EEPROM!
Why not upload content directly to `0x2000` after having activated `AT28!`? Why not upload content directly to `0x2000` after having activated `AT28!`?