shave some bytes

This commit is contained in:
4am 2021-07-11 11:56:35 -04:00
parent 20d53156ef
commit cba62f83b0
3 changed files with 48 additions and 43 deletions

36
src/hw.diskii.a Normal file
View File

@ -0,0 +1,36 @@
;-------------------------------
; ScanForDiskII
; scan all slots for things that look like Disk II cards
;
; in: X = 0
; Y = 0
; out: DiskIIArray populated
; X = 0
; all other registers and flags clobbered
;-------------------------------
!macro ScanForDiskII {
;X=0,Y=0
stx cmp1
ldx #$07
- txa
ora #$C0
sta cmp1+1
ldy #$01
lda (cmp1), y
cmp #$20
bne +
ldy #$03
lda (cmp1), y
bne +
ldy #$05
lda (cmp1), y
cmp #$03
bne +
ldy #$FF
lda (cmp1), y
bne +
tya
sta DiskIIArray-1, x
+ dex
bne -
}

View File

@ -4,53 +4,17 @@ SlashRAM_e
RAMFileName !raw "PASSPORTTMP.DSK" RAMFileName !raw "PASSPORTTMP.DSK"
RAMFileName_e RAMFileName_e
;-------------------------------
; ScanForDiskII
; scan all slots for things that look like Disk II cards
;
; in: none
; out: DiskIIArray populated
; all registers and flags clobbered
;-------------------------------
ScanForDiskII
lda #$00
sta cmp1
ldx #$07
- txa
ora #$C0
sta cmp1+1
ldy #$01
lda (cmp1), y
cmp #$20
bne +
ldy #$03
lda (cmp1), y
bne +
ldy #$05
lda (cmp1), y
cmp #$03
bne +
ldy #$FF
lda (cmp1), y
bne +
tya
sta DiskIIArray-1, x
+ dex
bne -
rts
;------------------------------- ;-------------------------------
; ScanForRAMAndHardDisks ; ScanForRAMAndHardDisks
; scan all slots for things that look like RAM disks or hard drives ; scan all slots for things that look like RAM disks or hard drives
; ;
; in: none ; in: X=0
; out: HardDriveArray populated ; out: HardDriveArray populated
; RAMDiskImagePath possibly populated (if a suitable RAM disk was found) ; RAMDiskImagePath possibly populated (if a suitable RAM disk was found)
; all registers and flags clobbered ; all registers and flags clobbered
;------------------------------- ;-------------------------------
ScanForRAMAndHardDisks ScanForRAMAndHardDisks
lda #$00 stx iunit
sta iunit
@nextunit @nextunit
lda iunit lda iunit
clc clc

View File

@ -6,6 +6,7 @@
!source "apidefs.a" !source "apidefs.a"
!source "strings/enid.a" !source "strings/enid.a"
!source "prefs.load.a" !source "prefs.load.a"
!source "hw.diskii.a"
!source "../build/vars.a" !source "../build/vars.a"
bit $C082 ; read ROM, no write bit $C082 ; read ROM, no write
@ -42,12 +43,13 @@ OneTimeSetup
inc $F1 inc $F1
dex dex
bne - bne -
;X=0,Y=0
ldy #0 ; save a copy of ProDOS system global page - lda $BF00, y ; save a copy of ProDOS system global page
- lda $BF00, y ; (will be copied back and forth by SwapProDOS later) sta $0F00, y ; (will be copied back and forth by SwapProDOS later)
sta $0F00, y
iny iny
bne - bne -
;X=0,Y=0
lda $FBB3 ; ROM MachineID lda $FBB3 ; ROM MachineID
cmp #$EA ; ][+? cmp #$EA ; ][+?
@ -55,7 +57,9 @@ OneTimeSetup
lda #$DF ; AND mask to force characters to uppercase on ][+ lda #$DF ; AND mask to force characters to uppercase on ][+
sta kForceLower sta kForceLower
+ +
jsr ScanForDiskII ; scan slots for Disk II drives ;X=0,Y=0
+ScanForDiskII ; scan slots for Disk II drives
;X=0
lda DiskIIArray+5 lda DiskIIArray+5
bne + bne +
jsr PrintByID ; no Disk II in slot 6, this is fatal jsr PrintByID ; no Disk II in slot 6, this is fatal
@ -63,6 +67,7 @@ OneTimeSetup
jsr WaitForKey jsr WaitForKey
jmp CleanExit jmp CleanExit
+ +
;X=0
jsr ScanForRAMAndHardDisks; scan for things that look like RAM disks or hard disks jsr ScanForRAMAndHardDisks; scan for things that look like RAM disks or hard disks
+LoadPrefs ; load preferences (if available) +LoadPrefs ; load preferences (if available)
jsr ThisSlot ; get information about selected drive and set gTargetType for main menu jsr ThisSlot ; get information about selected drive and set gTargetType for main menu
@ -80,7 +85,7 @@ OneTimeSetup
jmp MainMenu jmp MainMenu
!source "initscan.a" !source "hw.harddisk.a"
SHOW_PROGRESS_DURING_DECRUNCH = 1 ; activates optional UI code in exodecrunch SHOW_PROGRESS_DURING_DECRUNCH = 1 ; activates optional UI code in exodecrunch