passport/src/slots.a

79 lines
1.6 KiB
Plaintext
Raw Normal View History

2017-01-08 03:35:35 +00:00
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 {
2017-01-08 03:35:35 +00:00
ScanForDiskII
lda #$00
sta cmp1
ldx #$07
.fingerprint
2017-01-08 03:35:35 +00:00
txa
ora #$C0
sta cmp1+1
ldy #$01
lda (cmp1),y
cmp #$20
bne .next
2017-01-08 03:35:35 +00:00
ldy #$03
lda (cmp1),y
bne .next
2017-01-08 03:35:35 +00:00
ldy #$05
lda (cmp1),y
cmp #$03
bne .next
2017-01-08 03:35:35 +00:00
ldy #$FF
lda (cmp1),y
bne .next
2017-01-08 03:35:35 +00:00
tya
sta DiskIIArray-1,x
.next
2017-01-08 03:35:35 +00:00
dex
bne .fingerprint
2017-01-08 03:35:35 +00:00
rts
}
2017-01-08 03:35:35 +00:00
;-------------------------------
; NextSlot
;-------------------------------
!zone {
2017-01-08 03:35:35 +00:00
NextSlot
lda DRIVE
cmp #$31
bne .incslot
2017-01-08 03:35:35 +00:00
lda #$32
sta DRIVE
bne .done ; unconditional branch
.incslot
2017-01-08 03:35:35 +00:00
lda #$31
sta DRIVE
inc SLOT
lda SLOT
cmp #$38
bne .nowrap
2017-01-08 03:35:35 +00:00
lda #$31
sta SLOT
.nowrap
2017-01-08 03:35:35 +00:00
sec
sbc #$30
tax
lda DiskIIArray-1,x
beq .incslot
.done
2017-01-08 03:35:35 +00:00
lda SLOT
cmp #$36
bne .reallydone
2017-01-08 03:35:35 +00:00
lda #$32
sta DRIVE
.reallydone
2017-01-08 03:35:35 +00:00
rts
}