drv/sdc: Implement "SDC@" as a BLK@ word

"0 LIST" in the RC2014 emulator w/ SD card works!
This commit is contained in:
Virgil Dupras 2020-04-18 17:06:57 -04:00
parent f3c92684a0
commit 47a7133b8b

View File

@ -156,15 +156,20 @@
0 0
; ;
( dstaddr blkno -- f ) : _err
: SDC@ _desel
ABORT" SDC error"
;
( dstaddr blkno -- )
: _sdc@
_sel _sel
0x51 ( CMD17 ) 0x51 ( CMD17 )
0 ROT ( a cmd 0 blkno ) 0 ROT ( a cmd 0 blkno )
_cmd _cmd
IF _desel 0 EXIT THEN IF _err THEN
_wait _wait
0xfe = NOT IF _desel 0 EXIT THEN 0xfe = NOT IF _err THEN
0 SWAP ( crc a ) 0 SWAP ( crc a )
512 0 DO ( crc a ) 512 0 DO ( crc a )
DUP ( crc a a ) DUP ( crc a a )
@ -180,5 +185,12 @@
_idle + ( crc2 ) _idle + ( crc2 )
_wait DROP _wait DROP
_desel _desel
= ( success if crc1 == crc2 ) = NOT IF _err THEN
;
: SDC@
2 * DUP BLK( SWAP ( b a b )
_sdc@
1+ BLK( 512 + SWAP
_sdc@
; ;