Skip to content

Commit

Permalink
Disk Copy: Apply GS/OS case bits to ProDOS volume names, if present
Browse files Browse the repository at this point in the history
Turned out to be easier to slip in than I thought.

Fixes #428
  • Loading branch information
inexorabletash committed Mar 16, 2024
1 parent 108aac7 commit c1530c0
Show file tree
Hide file tree
Showing 3 changed files with 49 additions and 9 deletions.
1 change: 1 addition & 0 deletions RELEASE-NOTES.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ Project Page: https://github.com/a2stuff/a2d
* Hide "Select Quit..." once menu is not accessible.
* Show correct block counts during Quick Copy.
* Show progress bar during copy.
* Apply GS/OS case bits to ProDOS volume names, if present. ([#428](https://github.com/a2stuff/a2d/issues/428))

### Desk Accessories

Expand Down
53 changes: 45 additions & 8 deletions disk_copy/auxlc.s
Original file line number Diff line number Diff line change
Expand Up @@ -590,8 +590,7 @@ source_is_pro:
lda main__on_line_buffer2+1
jmp check_source_error
:
sta main__on_line_buffer2
param_call AdjustCase, main__on_line_buffer2
param_call AdjustOnLineEntryCase, main__on_line_buffer2
jsr DrawSourceDriveInfo

check_source_finish:
Expand Down Expand Up @@ -667,8 +666,7 @@ use_sd:
tax ; slot/drive
lda #kAlertMsgConfirmEraseSlotDrive ; X = unit number
ELSE
sta main__on_line_buffer2
param_call AdjustCase, main__on_line_buffer2
param_call AdjustOnLineEntryCase, main__on_line_buffer2
ldxy #main__on_line_buffer2
lda #kAlertMsgConfirmErase ; X,Y = ptr to volume name
END_IF
Expand Down Expand Up @@ -1366,13 +1364,52 @@ match: clc

;;; ============================================================

.proc AdjustCase
;;; Input: A,X is ON_LINE data buffer entry *including* the
;;; slot/drive bits, not just the name.
;;; Output: entry is length-prefix, case-adjusted

.proc AdjustOnLineEntryCase
ptr := $A

stax ptr

ldy #0
lda (ptr),y
pha
and #UNIT_NUM_MASK ; stash unit number
sta main__block_params_unit_num
pla
and #NAME_LENGTH_MASK
sta (ptr),y ; mask off length

;; --------------------------------------------------
;; Check for GS/OS case bits, apply if found

copy16 #2, main__block_params_block_num
copy16 #default_block_buffer, main__block_params_data_buffer
jsr main__ReadBlock
bcs fallback

case_bytes := default_block_buffer + $1A
asl16 case_bytes
bcc fallback ; High bit set = GS/OS case bits present

ldy #1
bloop: asl16 case_bytes ; Shift out high byte first
bcc :+
lda (ptr),y
ora #AS_BYTE(~CASE_MASK)
sta (ptr),y
: iny
cpy #16 ; bits
bcc bloop
rts

;; --------------------------------------------------
;; Use heuristic
fallback:
ldy #0
lda (ptr),y
and #NAME_LENGTH_MASK ; handle ON_LINE results, etc
beq done

;; Walk backwards through string. At char N, check char N-1; if
Expand All @@ -1399,7 +1436,7 @@ check_alpha:
sta (ptr),y
: dey
bpl loop ; always
.endproc ; AdjustCase
.endproc ; AdjustOnLineEntryCase

;;; ============================================================

Expand Down Expand Up @@ -1522,7 +1559,7 @@ is_prodos:
sta drive_unitnum_table,x

ldax $06
jsr AdjustCase
jsr AdjustOnLineEntryCase
lda num_drives
asl a
asl a
Expand Down
4 changes: 3 additions & 1 deletion res/notes/testplan.md
Original file line number Diff line number Diff line change
Expand Up @@ -1033,15 +1033,17 @@ With Sci.Calc:
* Configure a system with 8 or fewer drives. Launch DeskTop. Special > Copy Disk.... Verify that the scrollbar is inactive.
* Configure a system with 9 or more drives. Launch DeskTop. Special > Copy Disk.... Verify that the scrollbar is active.

* Launch DeskTop. Special > Copy Disk.... Verify that ProDOS disk names in the device list have adjusted case (e.g. "Volume" not "VOLUME").
* Launch DeskTop. Special > Copy Disk.... Verify that ProDOS disk names in the device list have adjusted case (e.g. "Volume" not "VOLUME"). Verify that GS/OS disk names in the device list have correct case (e.g. "GS.OS.disk" not "Gs.Os.Disk").
* Launch DeskTop. Special > Copy Disk.... Verify that Pascal disk names in the device list do not have adjusted case (e.g. "TGP:" not "Tgp:").
* Launch DeskTop. Special > Copy Disk.... Verify that DOS 3.3 disk names in the device list appear as "DOS 3.3 Sn, Dn" and do not have adjusted case.

* Launch DeskTop. Special > Copy Disk.... Select a ProDOS disk as a source disk. Verify that after the "Insert source disk" prompt is dismissed, the volume name appears on the "Source" line and the name has adjusted case (e.g. "Volume" not "VOLUME").
* Launch DeskTop. Special > Copy Disk.... Select a GS/OS disk as a source disk. Verify that after the "Insert source disk" prompt is dismissed, the volume name appears on the "Source" line and the name has correct case (e.g. "GS.OS.disk" not "Gs.Os.Disk").
* Launch DeskTop. Special > Copy Disk.... Select a Pascal disk as a source disk. Verify that after the "Insert source disk" prompt is dismissed, the volume name appears on the "Source" line and the name does not have adjusted case (e.g. "TGP:" not "Tgp:").
* Launch DeskTop. Special > Copy Disk.... Select a DOS 3.3 disk as a source disk. Verify that after the "Insert source disk" prompt is dismissed, no volume name appears on the "Source" line.

* Launch DeskTop. Special > Copy Disk.... Select a ProDOS disk as a destination disk. Verify that in the "Do you want to erase ...?" dialog that the name has adjusted case (e.g. "Volume" not "VOLUME"), and the name is quoted.
* Launch DeskTop. Special > Copy Disk.... Select a GS/OS disk as a destination disk. Verify that in the "Do you want to erase ...?" dialog that the name has correct case (e.g. "GS.OS.disk" not "Gs.Os.Disk"), and the name is quoted.
* Launch DeskTop. Special > Copy Disk.... Select a Pascal disk as a destination disk. Verify that in the "Do you want to erase ...?" dialog that the name does not have adjusted case (e.g. "TGP:" not "Tgp:"), and the name is quoted.
* Launch DeskTop. Special > Copy Disk.... Select a DOS 3.3 disk as a destination disk. Verify that in the "Do you want to erase ...?" dialog that the prompt describes the disk using slot and drive, and is not quoted.

Expand Down

0 comments on commit c1530c0

Please sign in to comment.