.endif
ret
-\r
+
;--------------------------------------------------------------
-; Read word \r
-; TODO: Read Word to ZL,ZH at given ZL/ZH Offset\r
-; Need for reading of single FAT16 Entrys without killing the\r
-; Entrys in hostbuffer...\r
+; Read word
+; TODO: Read Word to ZL,ZH at given ZL/ZH Offset
+; Need for reading of single FAT16 Entrys without killing the
+; Entrys in hostbuffer...
;
; 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
mmcReadWord:
.if MMC_DEBUG > 1
lds temp,mmcCardType
sbrs temp,log2(CT_BLOCK)
rcall mul_yx_512 ;Convert to byte address (*512)
-\r
+
ldi temp2,CMD17
rcall mmcCmd
ldi temp2,RES_ERROR
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.
rcall printhex
printstring " "
.endif
- ret\r
+ ret
;--------------------------------------------------------------
; Write sector