From c9f164a5106cebb361a63459eff778f2f33a58a2 Mon Sep 17 00:00:00 2001 From: Virgil Dupras Date: Tue, 7 May 2019 16:20:28 -0400 Subject: [PATCH] recipe/rc2014/sdcard: Make sdinit program output readable text Makes for a more straightforward test. --- recipes/rc2014/sdcard/sdinit.asm | 40 ++++++++++++++++++++++++++++++-- 1 file changed, 38 insertions(+), 2 deletions(-) diff --git a/recipes/rc2014/sdcard/sdinit.asm b/recipes/rc2014/sdcard/sdinit.asm index 47674ae..78e2b06 100644 --- a/recipes/rc2014/sdcard/sdinit.asm +++ b/recipes/rc2014/sdcard/sdinit.asm @@ -3,16 +3,52 @@ call JUMP_SDCWAKEUP + ; We expect a 0x01 R1 response + ld hl, sCmd0 + call JUMP_PRINTSTR ld a, 0b01000000 ; CMD0 ld hl, 0 ld de, 0 ld c, 0x95 call JUMP_SDCCMDR1 - call JUMP_PRINTHEX + cp 0x01 + jr nz, .error + ld hl, sOk + call JUMP_PRINTSTR + + ; We expect a 0x01 R1 response followed by 0x0001aa R7 response + ld hl, sCmd8 + call JUMP_PRINTSTR ld a, 0b01001000 ; CMD8 ld hl, 0 ld de, 0x01aa ld c, 0x87 call JUMP_SDCCMDR7 - call JUMP_PRINTHEX + ld a, h + cp 0 + jr nz, .error + ld a, l + cp 0 + jr nz, .error + ld a, d + cp 0x01 + jr nz, .error + ld a, e + cp 0xaa + jr nz, .error + ld hl, sOk + call JUMP_PRINTSTR ret +.error: + ld hl, sErr + call JUMP_PRINTSTR + ret + +sCmd0: + .db "Sending CMD0", 0xa, 0xd, 0 +sCmd8: + .db "Sending CMD8", 0xa, 0xd, 0 +sOk: + .db "Ok", 0xa, 0xd, 0 +sErr: + .db "Err", 0xa, 0xd, 0