passport/src/slots.a
2017-08-13 09:07:16 -07:00

150 lines
2.8 KiB
Plaintext
Executable File

DiskIIArray
!byte 00,00,00,00,00,00,00
;-------------------------------
; ScanForDiskII
; scan all slots for things that
; look like Disk II cards
;
; out: all registers clobbered
; all flags clobbered
; DiskIIArray filled with 00 or FF
;-------------------------------
!zone {
ScanForDiskII
lda #$00
sta cmp1
ldx #$07
.fingerprint
txa
ora #$C0
sta cmp1+1
ldy #$01
lda (cmp1),y
cmp #$20
bne .next
ldy #$03
lda (cmp1),y
bne .next
ldy #$05
lda (cmp1),y
cmp #$03
bne .next
ldy #$FF
lda (cmp1),y
bne .next
tya
sta DiskIIArray-1,x
.next
dex
bne .fingerprint
rts
}
;-------------------------------
; NextSlot
;-------------------------------
!zone {
NextSlot
lda DRIVE
cmp #$31
bne .incslot
lda #$32
sta DRIVE
bne .done ; unconditional branch
.incslot
lda #$31
sta DRIVE
inc SLOT
lda SLOT
cmp #$38
bne .nowrap
lda #$31
sta SLOT
.nowrap
sec
sbc #$30
tax
lda DiskIIArray-1,x
beq .incslot
.done
lda SLOT
cmp #$36
bne .reallydone
lda #$32
sta DRIVE
.reallydone
rts
}
!zone {
ScanForRAMDisk
lda #$00
sta iunit
- lda iunit
clc
adc #$10
sta iunit
beq .done
cmp #$80
beq -
pha
and #$70
lsr
lsr
lsr
lsr
tay
pla
ldx DiskIIArray-1,y
bne -
jsr GetVolumeName
bcs -
lda OnlineReturn
beq -
jsr GetVolumeInfo
;watch for RAM disk type
lda filetype
and #$0F
cmp #$0F
bne -
;check for RAM[x] by name
ldy OnlineReturn
cpy #4
beq +
cpy #5
bne -
dey
+
-- lda SlashRAM-1,y
cmp VolumeName-1,y
bne -
dey
bne --
;check free space
;need at least $118 blocks
sec
lda auxtype
sbc blocks
tax
lda auxtype+1
sbc blocks+1
cmp #1
bcc -
bne +
cpx #$18
bcc -
+ lda #TRUE
sta gUsingRAMDisk
.done
rts
SlashRAM !byte $2F, $52, $41, $4D
}