Consolidate resp3 and resp7, fix stack issue

wasn't pushing res to stack, which makes stack pointer wrong
This commit is contained in:
Byron Lathi
2023-07-23 21:45:54 -07:00
parent 7e958c8a11
commit d16675ed3c
2 changed files with 7 additions and 5 deletions

View File

@@ -193,6 +193,7 @@ void SD_readRes3(uint8_t *res)
/******************************************************************************* /*******************************************************************************
Read R7 from SD card Read R7 from SD card
*******************************************************************************/ *******************************************************************************/
/*
void SD_readRes7(uint8_t *res) void SD_readRes7(uint8_t *res)
{ {
// read response 1 in R7 // read response 1 in R7
@@ -204,6 +205,7 @@ void SD_readRes7(uint8_t *res)
// read remaining bytes // read remaining bytes
SD_readBytes(res + 1, R7_BYTES); SD_readBytes(res + 1, R7_BYTES);
} }
*/
/******************************************************************************* /*******************************************************************************
Read specified number of bytes from SD card Read specified number of bytes from SD card

View File

@@ -2,6 +2,7 @@
.export _SD_readRes1 .export _SD_readRes1
.export _SD_readRes2 .export _SD_readRes2
.export _SD_readRes3 .export _SD_readRes3
.export _SD_readRes7
.export _SD_readBytes .export _SD_readBytes
.export _SD_powerUpSeq .export _SD_powerUpSeq
.export _res1_cmd .export _res1_cmd
@@ -98,8 +99,9 @@ read:
.endproc .endproc
; void SD_readRes7(uint8_t *res)
_SD_readRes7:
; void SD_readRes3(uint8_t *res) ; void SD_readRes3(uint8_t *res)
.proc _SD_readRes3: near .proc _SD_readRes3: near
sta ptr1 ; store res in ptr1 sta ptr1 ; store res in ptr1
@@ -113,10 +115,8 @@ read:
bne @L2 bne @L2
inc ptr1 inc ptr1
@L2: lda ptr1 ; push low byte @L2: lda ptr1 ; push low byte
sta (sp) ldx ptr1 + 1
ldy #$01 jsr pushax
lda ptr1 + 1 ; push high byte
sta (sp),y
lda #$04 ; R3_BYTES lda #$04 ; R3_BYTES
jsr _SD_readBytes jsr _SD_readBytes