-
Notifications
You must be signed in to change notification settings - Fork 19
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Handle mirrored SmartPort drives in ProDOS 2.x #685
Comments
Also for reference, ProDOS 2.0.3 source, via the A2osX crew: |
I handle this differently in ProRWTS - just brute-forcing the device
number, after detecting that it has been mirrored, by iterating
through all device numbers and issuing a read until I get a match.
|
Talking directly to the SmartPort controller is necessary for status calls to retrieve device details and eject disks. Doing so requires mapping a ProDOS unit number (DSSSxxxx) to a SmartPort controller and a SmartPort unit number. ProDOS 1.x mirrors SmartPort device 3 and 4 for Slot 5 in a predictable way, so the unit numbers can be retrieved in a predictable way. ProDOS 2.0 and later mirror devices beyond 1 and 2 on a SmartPort controller to any free slot/drive combinations, and maintains internal tables mapping ProDOS unit number to SmartPort entry vector and unit. Previously, attempts to look these up failed, so only SmartPort devices would show with correct names in Format/Erase, correctly eject, and have disks show and disappear automatically when inserted/ejected. This change introduces support specific to ProDOS 2.4 to dig this mapping out of ProDOS itself in a mostly safe way. This should make mirrored drives work in these cases with 2.4: * DeskTop: Special > Eject Disk (or drag to trash) * DeskTop: Polling for disks manually ejected * DeskTop: Polling for disks inserted * DeskTop: Correct device names in Special > Format/Erase a Disk... * Disk Copy: Automatic ejection when swapping disks A more robust solution would handle other versions of ProDOS (e.g. 2.0, 2.0.x, FX, etc), either by including more lookups or building a mapping table on startup. A2D releases include 2.4 but will work with any ProDOS-8 1.1 or later.
An alternative approach would be (per the suggestion above) to construct mappings on startup. Make the MLI
|
Extend the support for mirrored SmartPort drives added in f6cdeb6 from just ProDOS 2.4 to handle ProDOS 2.0.1 through 2.0.3 as well. This affects: * DeskTop: Special > Eject Disk (or drag to trash) * DeskTop: Polling for disks manually ejected * DeskTop: Polling for disks inserted * DeskTop: Correct device names in Special > Format/Erase a Disk... * Disk Copy: Automatic ejection when swapping disks For #685
I took a stab at supporting ProDOS 2.0. The ProDOS code for that version must be buggy - with a mirrored drive (at least in GSPlus), calls to Given that, I'm going to call this item "done" as the dominant versions of ProDOS are supported. If anyone wants to do a more robust implementation I'd accept it, though. |
If you have a disk image that reproduces the crash, I'd be happy to investigate.
|
lib/smartport.s
is used to map a ProDOS unit number (DSSSxxxx) to a SmartPort entry vector and unit, but this is limited.ProDOS 1.2...1.9 mirror S5,D3/4 to S2,D1/2 only, and leave
DEVADR
entry pointing at $C5xx. Therefore, if the driver address is firmware ($Cn): If the unit number slot matches the driver slot, the device is not mirrored, and SmartPort unit is 1 or 2. Otherwise, the device is mirrored, and SmartPort unit is 3 or 4. So ProDOS 1.x is handled as best it can be.But ProDOS 2.x mirror to non-device slots, and point
DEVADR
at RAM-based drivers, not firmware entry points. If the device is not mirrored, a firmware entry point will be used, and therefore the unit number slot will match the driver slot, and the drive gives the SmartPort unit as 1 or 2. But further mirrored drives are impossible to determine given data external to ProDOS, without exactly replicating ProDOS's remapping algorithm for a particular version, which is fragile.All extant versions of ProDOS that remap (2.0 through 2.0.3, 2.4.x, and ProDOS.FX) use a similar internal approach:
DEVADR
entries at a procedure that maps ProDOS calls to SmartPort calls.The unfortunately, the tables vary in memory location across versions of ProDOS. Fortunately, so does the map proc address placed in
DEVADR
. This means that theDEVADR
can be used as key into a table to find the mapping tables.NOTE: The "-1" notation is because DSSS is used as an index into a table, and because Slot 0 doesn't exist, each table has 15 entries (starting at S1,D1) rather than 16 to save space. So in the ProDOS source,
spunit
is actually one greater than the value given above. A byte is wasted for S0,D2.Further observations:
DEVADR
values for mirrored drives. On the minus side, they aren't stable across FX builds, so there's a remote chance of a collision some day. But back on the plus side, they seem to be moving in a safe direction: 2.0.x = $FD08, 2.4.x = $FCE6, FX 0.94 circa 2020 = $FCA6, FX from this last week = $FC8B. Yay?DEVADR
entry. If it's not4C 00 10
(JMP $1000
), fail.4A 4A 4A 4A AA
(LSR
x4,TAX
) which maps unit number to offset.LDA spunit-1,X
/STA ...
/LDA spvecl-1,X
/STA ...
/LDA spvech-1,X
/STA ...
...
Supporting this would enable the following functionality for mirrored drives:
The text was updated successfully, but these errors were encountered: