]> cloudbase.mooo.com Git - avrcpm.git/blobdiff - mmc.asm
* More changes for FAT16 support.
[avrcpm.git] / mmc.asm
diff --git a/mmc.asm b/mmc.asm
index 49a1b9cd716a874542bedcf2d0ee2626c892c9cf..e3d75eb2d3e5192225dab2a64374d62d04366184 100644 (file)
--- a/mmc.asm
+++ b/mmc.asm
@@ -600,7 +600,7 @@ mmc_rdex:
 ;
 ;      in      zh,zl:          Pointer to Word within the Sector to read       
 ;   in yh..xl: Start sector number (LBA)
-;      out     xh,xl   : word thats been read\r
+;      out     zh,zl   : word thats been read\r
 
 mmcReadWord:
 .if MMC_DEBUG > 1
@@ -644,14 +644,31 @@ mmc_rcvw_start:
 mmc_rcvw_rl:
        sbiw    yl,1
        breq    mmc_rcvw_rle
-       //st            z+,temp
+       cp              zl,_0\r
+       cpc             zh,_0\r
+       breq    mmc_rcvw_sto\r
+\r
+       sbiw    zl,1\r
        spi_waitm
        in              temp,SPDR
        out             SPDR,_255
        rjmp    mmc_rcvw_rl
 
+mmc_rcvw_sto:\r
+       mov     zl,temp\r
+       spi_waitm
+       in              temp,SPDR
+       out             SPDR,_255
+       mov     zh,temp\r
+\r
+mmc_rcvw_rl2:
+       sbiw    yl,1
+       breq    mmc_rcvw_rle
+       spi_waitm
+       in              temp,SPDR
+       out             SPDR,_255
+       rjmp    mmc_rcvw_rl2\r
 mmc_rcvw_rle:
-       //st            z+,temp                 ;Store last byte in buffer 
        rcall   spi_wait                ;      while SPI module shifts in crc part1.
        rcall   spi_rcvr                ;Read second crc.