I wasn't aware that the unit numbers in the ProDOS device list contain device type identifiers in the low nibble. So if we can't use the device list entries as-is we can as well present the high nibble as low nibble to the user thus providing more meaningful device numbers.
git-svn-id: svn://svn.cc65.org/cc65/trunk@5852 b7a2c559-68d2-44c3-8de9-860c34a00d81
This commit is contained in:
@@ -7,42 +7,28 @@
|
||||
|
||||
.export _getfirstdevice
|
||||
.export _getnextdevice
|
||||
|
||||
.import __dos_type
|
||||
.import __dos_type, isdevice
|
||||
|
||||
.include "zeropage.inc"
|
||||
.include "mli.inc"
|
||||
|
||||
_getfirstdevice:
|
||||
lda #$FF
|
||||
; Fall through
|
||||
|
||||
_getnextdevice:
|
||||
next: tax
|
||||
inx
|
||||
txa
|
||||
cmp #$FF
|
||||
tax
|
||||
next: inx
|
||||
cpx #$FF
|
||||
beq done
|
||||
|
||||
; Check for ProDOS 8
|
||||
ldx __dos_type
|
||||
lda __dos_type
|
||||
beq next
|
||||
|
||||
; Up to 14 units may be active
|
||||
ldx #<DEVLST
|
||||
ldy #>DEVLST
|
||||
stx ptr1
|
||||
sty ptr1+1
|
||||
; Check for valid device
|
||||
jsr isdevice
|
||||
bne next
|
||||
|
||||
; Number of on-line devices (minus 1)
|
||||
ldy DEVCNT
|
||||
|
||||
; Does the list contain the device?
|
||||
: cmp (ptr1),y
|
||||
beq done
|
||||
dey
|
||||
bpl :-
|
||||
bmi next ; Branch always
|
||||
|
||||
done: ldx #$00
|
||||
done: txa
|
||||
ldx #$00
|
||||
rts
|
||||
|
||||
Reference in New Issue
Block a user