4cade/src/hw.diskcheck.a
2019-09-18 20:49:24 -07:00

87 lines
1.8 KiB
Plaintext

;------------------------------------------------------------------------------
; IsLowPartition
; Checks whether image was run from partition 1-4
;
; in: none
; out: C clear if partition is acceptable
; C set if partition is not acceptable
; all other flags and registers clobbered
;------------------------------------------------------------------------------
DEVADR01HI = $bf11 ;ProDOS constant
DEVNUM = $bf30 ;ProDOS constant
IsLowPartition
lda DEVNUM
sta x80_parms + 1
sta unit
and #$70
lsr
lsr
lsr
tay
lda DEVADR01HI, y
cmp #$c8
bcc @GoodPartition
;find the SmartPort device
ldx #$c8
- dex
stx ldrhi
ldy #0
sty ldrlo
iny
lda (ldrlo), y
cmp #$20
bne -
iny
iny
lda (ldrlo), y
bne -
iny
iny
lda (ldrlo), y
cmp #3
bne -
ldy #$ff
lda (ldrlo), y
beq -
sta ldrlo
;detect extended remapping
lda #<(readbuff + $200)
sta adrlo
lda #>(readbuff + $200)
sta adrhi
lda #2
sta x80_parms + 4
sta bloklo
lda #0
sta x80_parms + 5
sta blokhi
lda #cmdread
sta command
jsr @dispatch
jsr MLI
!byte $80
!word x80_parms
ldy #$0f
- lda readbuff + 4, y
cmp readbuff + $204, y
bne @BadPartition
dey
bpl -
clc
!byte $24
@BadPartition
sec
@GoodPartition
rts
@dispatch
jmp (ldrlo)