detect RAMFactor-style RAM disks

This commit is contained in:
Peter Ferrie 2017-07-01 17:16:12 -07:00
parent 24c0a9fa9d
commit e3445b08bf
3 changed files with 21 additions and 9 deletions

View File

@ -29,7 +29,7 @@ PC_SETEOF = $02
PRODOSMLI = $BF00 ; [callable] MLI entry point PRODOSMLI = $BF00 ; [callable] MLI entry point
!ct "lcase.ct" !ct "lcase.ct"
RAMFileName !text "PASSPORT.IMG" RAMFileName !text "PASSPORTTMP.DSK"
RAMFileName_e RAMFileName_e
; MLI error codes ; MLI error codes
@ -52,7 +52,6 @@ ERR_EOF = $4C
WriteTrackMLI WriteTrackMLI
jsr SwapProDOS jsr SwapProDOS
lda gUsingRAMDisk lda gUsingRAMDisk
cmp #TRUE
beq + beq +
jsr ReorderBuffer jsr ReorderBuffer
+ lda #$81 ; 'write block' command + lda #$81 ; 'write block' command
@ -92,7 +91,6 @@ WriteTrackMLI
sta mliparam+3 sta mliparam+3
.writeloop .writeloop
lda gUsingRAMDisk lda gUsingRAMDisk
cmp #TRUE
beq + beq +
lda mlicmd lda mlicmd
ldy #$03 ; parameter count ldy #$03 ; parameter count
@ -114,7 +112,6 @@ WriteTrackMLI
php php
pha pha
lda gUsingRAMDisk lda gUsingRAMDisk
cmp #TRUE
beq + beq +
jsr ReorderBuffer jsr ReorderBuffer
+ jsr SwapProDOS + jsr SwapProDOS
@ -539,7 +536,6 @@ DeleteFile
!zone { !zone {
CreateRAMFile CreateRAMFile
lda gUsingRAMDisk lda gUsingRAMDisk
cmp #TRUE
bne .done bne .done
;existing file being reused? ;existing file being reused?

View File

@ -482,8 +482,6 @@ nextsector
lda #s_passdemuf lda #s_passdemuf
bne .passprint ; always branches bne .passprint ; always branches
.passcrack .passcrack
lda gPatchCount
beq .passcrack0
lda gUsingRAMDisk lda gUsingRAMDisk
cmp #FALSE cmp #FALSE
beq .skipram beq .skipram
@ -491,6 +489,8 @@ nextsector
jsr PrintByID jsr PrintByID
jsr WriteRAMToDisk jsr WriteRAMToDisk
.skipram .skipram
lda gPatchCount
beq .passcrack0
lda #s_passcrack lda #s_passcrack
!byte $2C ; hide next LDA !byte $2C ; hide next LDA
.passcrack0 .passcrack0
@ -608,7 +608,6 @@ WriteTrackNA ; entry point used by Special Delivery tracer
beq .write beq .write
lda #s_writeram ; only print "writing to" message once lda #s_writeram ; only print "writing to" message once
ldx gUsingRAMDisk ldx gUsingRAMDisk
cpx #TRUE
beq + beq +
lda #s_writing ; only print "writing to" message once lda #s_writing ; only print "writing to" message once
+ jsr PrintByID + jsr PrintByID

View File

@ -93,6 +93,7 @@ ScanForRAMDisk
lsr lsr
lsr lsr
lsr lsr
sta .driverbase+1
lsr lsr
tay tay
pla pla
@ -105,13 +106,29 @@ ScanForRAMDisk
jsr GetVolumeInfo jsr GetVolumeInfo
;watch for RAM disk type ;watch for RAM disk type
;can't filter on device driver because RAMWorks
lda filetype lda filetype
and #$0F and #$0F
cmp #$0F cmp #$0F
bne - bne -
.driverbase
ldx #$d1
lda $BF11,x
sta .drivercode+2
and #$f0
cmp #$c0
bne +
;RAMFactor detection
;looks like a SmartPort device
.drivercode
lda $d100
cmp #$c9
bne -
+
;check free space ;check free space
;need at least $118 blocks ;need at least $118 blocks