Mirror of CollapseOS
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

14 line
581B

  1. : aspfb! ( n a --, write word n to flash buffer addr a )
  2. SWAP 256 /MOD ( a lo hi ) SWAP ROT ( hi lo a )
  3. DUP ROT ( hi a a lo ) SWAP ( hi a lo a )
  4. 0 0x40 ( hi a lo a 0 0x40 ) _cmd DROP ( hi a )
  5. 0 0x48 _cmd DROP ;
  6. : aspfp! ( page --, write buffer to page )
  7. 0 SWAP aspfpgsz @ * 256 /MOD ( 0 lsb msb )
  8. 0x4c _cmd DROP asprdy ;
  9. : aspf@ ( page a -- n, read word from flash )
  10. SWAP aspfpgsz @ * OR ( addr ) 256 /MOD ( lsb msb )
  11. 2DUP 0 ROT ROT ( lsb msb 0 lsb msb )
  12. 0x20 _cmd ( lsb msb low )
  13. ROT ROT 0 ROT ROT ( low 0 lsb msb ) 0x28 _cmd 8 LSHIFT OR ;