aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorH. Peter Anvin <hpa@zytor.com>2008-12-29 19:35:06 -0800
committerH. Peter Anvin <hpa@zytor.com>2008-12-29 19:35:06 -0800
commit943c11c1a104fd3cb9bb301725e3a2931d867f1a (patch)
tree03af6d5173730ead1d5f47d485bc210e5a930ef8
parentec7d7ec83b3580ab836c85cb04de12930400dfd1 (diff)
downloadabc80-943c11c1a104fd3cb9bb301725e3a2931d867f1a.tar.gz
abc80-943c11c1a104fd3cb9bb301725e3a2931d867f1a.tar.xz
abc80-943c11c1a104fd3cb9bb301725e3a2931d867f1a.zip
sddrom.asm: minor space optimization
Rearrange some entry points to save a few bytes.
-rw-r--r--data/sddrom.asm60
1 files changed, 29 insertions, 31 deletions
diff --git a/data/sddrom.asm b/data/sddrom.asm
index 633b60c..8d97d26 100644
--- a/data/sddrom.asm
+++ b/data/sddrom.asm
@@ -92,6 +92,11 @@ interrupt_entry: ; Address 0038h
ei
reti
+interrupt_reset:
+ ld sp,stack ; Reset stack
+ ei
+ jr idle
+
reset_1:
ld hl,sysinfo
push hl
@@ -103,12 +108,31 @@ reset_1:
rst 56 ; = interrupt
defs 0x0066-$
-nmi_entry: ; Address 0066h
- jp nmi
+;:
+; NMI handing -- we receive an NMI when the SD card is removed. Allow
+; a DMA operation in process to complete, then report CMD/ERROR/READY
+; with the error code of DRIVE NOT READY (80h) until the card is reinserted.
+;:
+; We do a full initialization after a card has been inserted; this includes
+; invalidating the SD sector buffer!
+;
+nmi:
+ di
+ xor a
+ out (0x82),a ; Disable DMA
+ out (0x86),a ; Clear error LED
-interrupt_reset:
- ld sp,stack ; Reset stack
- ei
+ ld a,0x08 ; Drive not ready
+ out (0x81),a ; Auxilliary status
+ xor a
+ out (0x80),a ; Primary status
+
+nmi_wait_card:
+ in a,(0x80) ; DMA/SD aux status
+ and 04h ; Card present?
+ jr z,nmi_wait_card
+
+ rst 0 ; Reset everything
idle: ; Resume here to begin command
ld e,0
@@ -481,32 +505,6 @@ fmt_lba_sdhc:
ld de,(sd_need+2)
ret
-;:
-; NMI handing -- we receive an NMI when the SD card is removed. Allow
-; a DMA operation in process to complete, then report CMD/ERROR/READY
-; with the error code of DRIVE NOT READY (80h) until the card is reinserted.
-;:
-; We do a full initialization after a card has been inserted; this includes
-; invalidating the SD sector buffer!
-;
-nmi:
-nmi_wait_dma:
- di
- xor a
- out (0x82),a ; Disable DMA
- out (0x86),a ; Clear error LED
-
- ld a,0x08 ; Drive not ready
- out (0x81),a ; Auxilliary status
- xor a
- out (0x80),a ; Primary status
-
-nmi_wait_card:
- in a,(0x80) ; DMA/SD aux status
- and 04h ; Card present?
- jr z,nmi_wait_card
-
- rst 0 ; Reset everything
;
; Initialize the SD card after power on or insert