From 47acabad9a66012a33588e8408771a6addc08672 Mon Sep 17 00:00:00 2001 From: 4am Date: Tue, 16 May 2017 12:14:20 -0400 Subject: [PATCH] [WIP] ScanForRAMDisk --- src/mli.a | 41 +++++++++++++++++++++++++++++++++++++++++ src/passport.a | 4 +++- src/slots.a | 27 +++++++++++++++++++++++++++ src/strings/en.a | 2 +- 4 files changed, 72 insertions(+), 2 deletions(-) diff --git a/src/mli.a b/src/mli.a index 474e72d..8f15b9a 100755 --- a/src/mli.a +++ b/src/mli.a @@ -1,6 +1,8 @@ ; MLI command codes CMD_CREATE = $C0 ; create new file CMD_DESTROY = $C1 ; delete a file +CMD_GETFILEINFO = $C4 ; get file (or volume) info +CMD_ONLINE = $C5 ; check online volume(s) CMD_SETPREFIX = $C6 ; change default pathname prefix CMD_OPEN = $C8 ; open a file CMD_NEWLINE = $C9 ; set line-by-line read mode @@ -12,6 +14,8 @@ CMD_SETMARK = $CE ; change position in an open file ; MLI parameter counts PC_CREATE = $07 PC_DESTROY = $01 +PC_GETFILEINFO = $0A +PC_ONLINE = $02 PC_SETPREFIX = $01 PC_OPEN = $03 PC_NEWLINE = $03 @@ -501,6 +505,43 @@ SetPrefix jsr mli rts +;------------------------------- +; get volume name of disk in specific slot+drive +; in: A = unit number (DSSS0000) +; out: if no disk in drive or any MLI error, C set and A contains error code +; if disk found, C clear and @VolumeName contains volume name +; (length byte + up to 14 character name, no leading slash) +;------------------------------- +!zone { +GetVolumeName + sta mliparam+1 + lda #OnlineReturn + sta mliparam+3 + jsr Online + rts +OnlineReturn + !byte $FF +VolumeName + !byte $FF,$FF,$FF,$FF,$FF,$FF,$FF + !byte $FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF +} + +;------------------------------- +; check if volume is online +; using ProDOS MLI +; in: caller has filled @mliparam +; with unit number +; out: if error, C set and A contains error code +; if success, C clear +;------------------------------- +Online + lda #CMD_ONLINE + ldy #PC_ONLINE + jsr mli + rts + ;------------------------------- ; low-level MLI wrapper ; in: A = MLI command code diff --git a/src/passport.a b/src/passport.a index 33501d2..5e9728f 100755 --- a/src/passport.a +++ b/src/passport.a @@ -87,6 +87,7 @@ cmp1 = $F8 ; word cmp2 = $FA ; word counter = $FC ; byte tmp = $FC ; byte +iunit = $FC ; byte tmpa = $FC ; byte tmpx = $FD ; byte tmpy = $FE ; byte @@ -94,7 +95,7 @@ flag = $FF ; byte } ; Application constants (not zero addresses) -RELBASE = $6100 ; address to move Passport code +RELBASE = $6000 ; address to move Passport code ; so that it's out of the way LOWPOINT = $4300 ; lowest available address for code BASEPAGE = $10 ; Special Delivery tracer assumes @@ -185,6 +186,7 @@ OneTimeSetup bne .founds6 jmp FatalNoSlot6 .founds6 + jsr ScanForRAMDisk jsr LoadPrefs ; load preferences (if available) bcc ResetVector jsr SavePrefs ; save preferences (if possible) diff --git a/src/slots.a b/src/slots.a index 5420d0f..0ebecc4 100755 --- a/src/slots.a +++ b/src/slots.a @@ -76,3 +76,30 @@ NextSlot .reallydone rts } + +!zone { +ScanForRAMDisk + rts + + lda #$00 + sta $0800 + sta $0801 + + lda #$00 + sta iunit +- lda iunit + clc + adc #$10 + sta iunit + beq .done + cmp #$80 + beq - + jsr GetVolumeName + bcs - + lda #VolumeName + sta $0801 +.done + jmp $ff59 +} diff --git a/src/strings/en.a b/src/strings/en.a index 5cc8a97..ce620df 100755 --- a/src/strings/en.a +++ b/src/strings/en.a @@ -210,7 +210,7 @@ StringTable ; can be set directly before calling PrintByID. ; .header - !text "Passport by 4am 2017-05-14",00 + !text "Passport by 4am 2017-05-16",00 .mainmenu !text "________________________________________",$8D,$8D,$8D,$8D,$8D,$8D,$8D !text " "