anchor.diff:  
   : sd-wait ( -- )  begin $FF >spi> ( dup . ) $FF = until ;
   
  -: sd-cmd ( cmd arg crc -- u )
  -  -rot swap
  +: sd-cmd ( cmd arg -- u )
  +  swap
   \ cr millis . ." CMD" dup . 
     -spi 2 us +spi
               $FF >spi
  
positive.code: \ 007F00325B5A83D3F6DBFF81968000E7772B  SanDisk 2GB
  
  : sd-size ( -- n )  \ return card size in 512-byte blocks
    9 0 $00 sd-cmd  16 sd-copy
  \ http://www.avrfreaks.net/forum/how-determine-mmc-card-size
  \ https://members.sdcard.org/downloads/pls/simplified_specs/archive/part1_301.pdf
  \ TODO bytes 6 and 8 may be reversed...
  
negative.code:   sd.buf 8 + c@ 6 rshift or ;
  
  : sd-read ( page -- )  \ read one 512-byte page from sdcard
    9 lshift  17 swap sd-cmd  512 sd-copy ;
  
  : sd-write ( page -- )  \ write one 512-byte page to sdcard
    9 lshift  24 swap sd-cmd drop
    $FF >spi $FE >spi
    512 0 do  sd.buf i + c@ >spi  loop
    $FF dup >spi >spi  sd-wait ;
  