mirror of
https://github.com/hsoft/collapseos.git
synced 2024-12-27 08:28:06 +11:00
7001446212
Recipes contain bits and pieces of hardware-related knowledge, but these bits feel sparse. I've been wanting to consolidate hardware- related documentation for a while, but always fell at odds with the recipes organisation. We don't have recipes anymore, just a /doc/hw section that contains hardware-related documentation which often translate to precise instructions to run Collapse OS on a specific machine. With this new organisation, I hope to end up with a better, more solid documentation.
17 lines
516 B
Plaintext
17 lines
516 B
Plaintext
: _err LIT" FDerr" ERR ;
|
|
: _cylsec ( sec -- cs, return sector/cylinder for given secid )
|
|
( 4 256b sectors per block, 10 sec per cyl, 40 cyl max )
|
|
10 /MOD ( sec cyl )
|
|
DUP 39 > IF _err THEN
|
|
8 LSHIFT + ( cylsec )
|
|
;
|
|
: FD@! ( wref blk -- )
|
|
1 @DCSTAT NOT IF _err THEN
|
|
2 LSHIFT ( 4 * -- wr sec )
|
|
4 0 DO ( wr sec )
|
|
DUP I + _cylsec ( wr sec cs )
|
|
I 8 LSHIFT BLK( + ( wr sec cs addr )
|
|
1 ROT ROT ( wr sec drv cs addr )
|
|
4 PICK EXECUTE NOT IF _err THEN
|
|
LOOP 2DROP ;
|