Update sd controller and test code
This commit is contained in:
@@ -8,8 +8,12 @@
|
||||
|
||||
SD_CONTROLLER = $e000
|
||||
SD_ARG = SD_CONTROLLER + $4
|
||||
SD_RESP = SD_CONTROLLER + $10
|
||||
CLK_DIV = $20
|
||||
|
||||
.zeropage
|
||||
rca: .res 4
|
||||
|
||||
.code
|
||||
|
||||
_nmi_int:
|
||||
@@ -28,5 +32,107 @@ _init:
|
||||
sta SD_ARG+3
|
||||
lda #$08
|
||||
sta SD_CONTROLLER
|
||||
nop
|
||||
nop
|
||||
nop
|
||||
|
||||
lda #55
|
||||
sta SD_CONTROLLER
|
||||
lda #41
|
||||
sta SD_CONTROLLER
|
||||
nop
|
||||
nop
|
||||
nop
|
||||
|
||||
@acmd41:
|
||||
lda #55
|
||||
sta SD_CONTROLLER
|
||||
lda #$80
|
||||
sta SD_ARG+1
|
||||
lda #$ff
|
||||
sta SD_ARG+2
|
||||
lda #$40
|
||||
sta SD_ARG+3
|
||||
lda #41
|
||||
sta SD_CONTROLLER
|
||||
|
||||
nop
|
||||
nop
|
||||
nop
|
||||
nop
|
||||
nop
|
||||
|
||||
lda SD_RESP+3
|
||||
bmi card_ready
|
||||
|
||||
|
||||
ldx #$10
|
||||
@loop: dex
|
||||
bne @loop
|
||||
|
||||
bra @acmd41
|
||||
|
||||
card_ready:
|
||||
lda #2
|
||||
sta SD_CONTROLLER
|
||||
|
||||
nop
|
||||
nop
|
||||
nop
|
||||
nop
|
||||
nop
|
||||
nop
|
||||
nop
|
||||
nop
|
||||
nop
|
||||
nop
|
||||
|
||||
lda #3
|
||||
sta SD_CONTROLLER
|
||||
|
||||
nop
|
||||
nop
|
||||
nop
|
||||
nop
|
||||
nop
|
||||
nop
|
||||
nop
|
||||
nop
|
||||
nop
|
||||
nop
|
||||
|
||||
lda SD_RESP
|
||||
sta rca
|
||||
lda SD_RESP+1
|
||||
sta rca+1
|
||||
lda SD_RESP+2
|
||||
sta rca+2
|
||||
lda SD_RESP+3
|
||||
sta rca+3
|
||||
|
||||
lda rca
|
||||
sta SD_ARG
|
||||
lda rca+1
|
||||
sta SD_ARG+1
|
||||
lda rca+2
|
||||
sta SD_ARG+2
|
||||
lda rca+3
|
||||
sta SD_ARG+3
|
||||
lda #7
|
||||
sta SD_CONTROLLER
|
||||
|
||||
nop
|
||||
nop
|
||||
nop
|
||||
nop
|
||||
nop
|
||||
nop
|
||||
nop
|
||||
nop
|
||||
nop
|
||||
nop
|
||||
|
||||
lda #17
|
||||
sta SD_CONTROLLER
|
||||
|
||||
@end: bra @end
|
||||
Reference in New Issue
Block a user