mirror of
https://github.com/hsoft/collapseos.git
synced 2024-11-10 03:08:06 +11:00
14 lines
581 B
Plaintext
14 lines
581 B
Plaintext
|
: aspfb! ( n a --, write word n to flash buffer addr a )
|
||
|
SWAP 256 /MOD ( a lo hi ) SWAP ROT ( hi lo a )
|
||
|
DUP ROT ( hi a a lo ) SWAP ( hi a lo a )
|
||
|
0 0x40 ( hi a lo a 0 0x40 ) _cmd DROP ( hi a )
|
||
|
0 0x48 _cmd DROP ;
|
||
|
: aspfp! ( page --, write buffer to page )
|
||
|
0 SWAP aspfpgsz @ * 256 /MOD ( 0 lsb msb )
|
||
|
0x4c _cmd DROP asprdy ;
|
||
|
: aspf@ ( page a -- n, read word from flash )
|
||
|
SWAP aspfpgsz @ * OR ( addr ) 256 /MOD ( lsb msb )
|
||
|
2DUP 0 ROT ROT ( lsb msb 0 lsb msb )
|
||
|
0x20 _cmd ( lsb msb low )
|
||
|
ROT ROT 0 ROT ROT ( low 0 lsb msb ) 0x28 _cmd 8 LSHIFT OR ;
|