;------------------------------- ; NextSlot ; in: DiskIIArray populated by calling ScanForDiskII ; HardDiskArray populated by calling ScanForRAMAndHardDisks ; out: @SLOT, @DRIVE set to ASCII values of next available slot/drive ; @gTargetType set based on type of target (see apidefs.a for values) ;------------------------------- NextSlot ldy #$31 cpy DRIVE bne NextSlotLoop inc DRIVE ; cycle from drive 1 to drive 2 of the same slot bne ThisSlot ; always branches NextSlotLoop sty DRIVE ; cycle to drive 1 of the next slot inc SLOT ThisSlot lda SLOT cmp #$38 bne + sty SLOT ; cycle from slot 7 back to slot 1 tya + tax lda DiskIIArray-$31, x beq @maybeHardDisk lda SLOT and #$0F ora #$C0 ldx #$28 ldy #$06 jsr CompareMemory ; check for signature of CFFA3000 virtual drive in slot ROM !byte $20,$33,$CD !byte $18 !byte $90,$2E bcc @foundCFFA lda SLOT cmp #$36 bne @foundDiskII lda #$32 ; never return S6,D1 sta DRIVE bne @foundDiskII ; always branches @maybeHardDisk jsr LookupUnitNumberOfSelectedHardDisk ; see if we found a hard disk beq NextSlotLoop ; no hard disk at this location, keep cycling lda #ID_FILE_ON_HARD_DISK !byte $2C @foundCFFA lda #ID_CFFA_VIRTUAL_DISK !byte $2C @foundDiskII lda #ID_DISK_II sta gTargetType rts LookupUnitNumberOfSelectedHardDisk ; in: HardDiskArray populated ; out: if selected slot and drive contain a suitable hard disk ; then A=ProDOS unit number, Z=0 ; otherwise A=0, Z=1 ; X clobbered ; Y preserved lda SLOT sec sbc #$30 tax lda DRIVE lsr bcs + txa ora #8 tax + lda HardDiskArray-1, x rts