X-Git-Url: http://cloudbase.mooo.com/gitweb/avrcpm.git/blobdiff_plain/6421941553d20df7608a6e1fe1d10aed2845b350..29ce189c438e15067a26aebcb12227a9c172a384:/avrcpm/avr/mmc.asm diff --git a/avrcpm/avr/mmc.asm b/avrcpm/avr/mmc.asm index 49a1b9c..e3d75eb 100644 --- a/avrcpm/avr/mmc.asm +++ b/avrcpm/avr/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 +; out zh,zl : word thats been read 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 + cpc zh,_0 + breq mmc_rcvw_sto + + sbiw zl,1 spi_waitm in temp,SPDR out SPDR,_255 rjmp mmc_rcvw_rl +mmc_rcvw_sto: + mov zl,temp + spi_waitm + in temp,SPDR + out SPDR,_255 + mov zh,temp + +mmc_rcvw_rl2: + sbiw yl,1 + breq mmc_rcvw_rle + spi_waitm + in temp,SPDR + out SPDR,_255 + rjmp mmc_rcvw_rl2 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.