Megalextoria
Retro computing and gaming, sci-fi books, tv and movies and other geeky stuff.

Home » Digital Archaeology » Computer Arcana » Apple » Apple II Emulation » SmartPort device assignments
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
SmartPort device assignments [message #420749] Thu, 24 August 2023 10:06 Go to next message
gids.rs is currently offline  gids.rs
Messages: 1395
Registered: October 2012
Karma: 0
Senior Member
Does any one know how the SmartPort assigns a slot/drive to a device number? Is it just as simple as using a look-up table in the order of:

Dev 1 = Slot 7 Drv 1
Dev 2 = Slot 7 Drv 2
Dev 3 = Slot 4 Drv 1
Dev 4 = Slot 4 Drv 2
Dev 5 = Slot 1 Drv 1
Dev 6 = Slot 1 Drv 2
Dev 7 = Slot 2 Drv 1
Dev 8 = Slot 2 Drv 2
Dev 9 = Slot 3 Drv 1
Dev 10 = Slot 6 Drv 1
Dev 11 = Slot 6 Drv 2
Dev 12 = Slot 3 Drv 2

or is there a translation table stored somewhere in memory?

If Kent will respond, I would like to know how you handled the COP 82 instruction at the end of the $C70D routine (entry to SmartPort) in your Kegs emulator,
Re: SmartPort device assignments [message #420753 is a reply to message #420749] Thu, 24 August 2023 15:14 Go to previous messageGo to next message
Anonymous
Karma:
Originally posted by: kegs

In article <f5340119-5b7f-4100-9c0e-5b98ca77bd4en@googlegroups.com>,
I am Rob <gids.rs@sasktel.net> wrote:
> Does any one know how the SmartPort assigns a slot/drive to a device
> number? Is it just as simple as using a look-up table in the order of:
>
> Dev 1 = Slot 7 Drv 1
> Dev 2 = Slot 7 Drv 2
> Dev 3 = Slot 4 Drv 1
> Dev 4 = Slot 4 Drv 2
> Dev 5 = Slot 1 Drv 1
> Dev 6 = Slot 1 Drv 2
> Dev 7 = Slot 2 Drv 1
> Dev 8 = Slot 2 Drv 2
> Dev 9 = Slot 3 Drv 1
> Dev 10 = Slot 6 Drv 1
> Dev 11 = Slot 6 Drv 2
> Dev 12 = Slot 3 Drv 2
>
> or is there a translation table stored somewhere in memory?
>
> If Kent will respond, I would like to know how you handled the COP 82
> instruction at the end of the $C70D routine (entry to SmartPort) in your
> Kegs emulator,

Smartport is two things: a physical port you can plug 3.5", 5.25", etc.
drives into, and a software convention so OS's can communicate with devices
they may not have a "driver" for.

The software convention: If the $Cnxx ROM space for a slot appears to be
bootable, and $CnFF=0A, then it supports Smartport calls at $C70D, and
ProDOS calls at $C70A. The ProDOS entry point at $C70A supports just
two devices and supports just 65535 blocks, but the $C70D "Smarport" entry
point supports many more devices, I think 127, and can support up to
24-bit block numbers (or 32-bit block numbers, for Extended Smartport).

ProDOS 8 can only support two devices per "slot", so it remaps drives to
"virtual" slots. If slot 1 is a printer, for example, with no drives,
then ProDOS 8 can map 2 drives from another slot to be s1d1 and s1d2.
In this way, ProDOS 8 can support up to 14 devices, but s3d2 can only be
/RAM.

I don't know off the top of my head how ProDOS 8 manages this, but I do
know it was constantly changing, and the latest non-Apple ProDOS 2.5x does it
differently than any official release. Technote ProDOS #20 talks about
this remapping, and ProDOS Technote #23 talks about the versions of
ProDOS 8, which seems to say ProDOS 2.0.1 was the first to automatically
do this remapping.

ProDOS 16/GSOS doesn't have to deal with this 2-devices-per-slot restriction,
and can support lots more devices (I don't know the actual limit offhand).

KEGS doesn't use COP $82. KEGS does something really dumb, and compares
all instruction fetch addresses to see if it is to $00C70D, and if it is, it
calls do_c70d() in smartport.c. No matter what code you try to place at
$C70D, KEGS will interpret it as a smartport call to s7dx devices if you
execute at that address. And this is done for $C700 and $C70A as well.
So "PR#7" in KEGS runs no code from the $C700 space at all, it doesn't matter
what's there. I have plans to change this, but it's not a high priority.

Kent
Re: SmartPort device assignments [message #420755 is a reply to message #420753] Fri, 25 August 2023 00:46 Go to previous messageGo to next message
gids.rs is currently offline  gids.rs
Messages: 1395
Registered: October 2012
Karma: 0
Senior Member
>> Does any one know how the SmartPort assigns a slot/drive to a device
>> number? Is it just as simple as using a look-up table in the order of:
>>
>> Dev 1 = Slot 7 Drv 1
>> Dev 2 = Slot 7 Drv 2
>> Dev 3 = Slot 4 Drv 1
>> Dev 4 = Slot 4 Drv 2
>> Dev 5 = Slot 1 Drv 1
>> Dev 6 = Slot 1 Drv 2
>> Dev 7 = Slot 2 Drv 1
>> Dev 8 = Slot 2 Drv 2
>> Dev 9 = Slot 3 Drv 1
>> Dev 10 = Slot 6 Drv 1
>> Dev 11 = Slot 6 Drv 2
>> Dev 12 = Slot 3 Drv 2
>>
>> or is there a translation table stored somewhere in memory?
>>
>> If Kent will respond, I would like to know how you handled the COP 82
>> instruction at the end of the $C70D routine (entry to SmartPort) in your
>> Kegs emulator,
> Smartport is two things: a physical port you can plug 3.5", 5.25", etc.
> drives into, and a software convention so OS's can communicate with devices
> they may not have a "driver" for.
>
> The software convention: If the $Cnxx ROM space for a slot appears to be
> bootable, and $CnFF=0A, then it supports Smartport calls at $C70D, and
> ProDOS calls at $C70A. The ProDOS entry point at $C70A supports just
> two devices and supports just 65535 blocks, but the $C70D "Smarport" entry
> point supports many more devices, I think 127, and can support up to
> 24-bit block numbers (or 32-bit block numbers, for Extended Smartport).
>
> ProDOS 8 can only support two devices per "slot", so it remaps drives to
> "virtual" slots. If slot 1 is a printer, for example, with no drives,
> then ProDOS 8 can map 2 drives from another slot to be s1d1 and s1d2.
> In this way, ProDOS 8 can support up to 14 devices, but s3d2 can only be
> /RAM.
>
> I don't know off the top of my head how ProDOS 8 manages this, but I do
> know it was constantly changing, and the latest non-Apple ProDOS 2.5x does it
> differently than any official release. Technote ProDOS #20 talks about
> this remapping, and ProDOS Technote #23 talks about the versions of
> ProDOS 8, which seems to say ProDOS 2.0.1 was the first to automatically
> do this remapping.
>
> ProDOS 16/GSOS doesn't have to deal with this 2-devices-per-slot restriction,
> and can support lots more devices (I don't know the actual limit offhand)..
>
> KEGS doesn't use COP $82. KEGS does something really dumb, and compares
> all instruction fetch addresses to see if it is to $00C70D, and if it is, it
> calls do_c70d() in smartport.c. No matter what code you try to place at
> $C70D, KEGS will interpret it as a smartport call to s7dx devices if you
> execute at that address. And this is done for $C700 and $C70A as well.
> So "PR#7" in KEGS runs no code from the $C700 space at all, it doesn't matter
> what's there. I have plans to change this, but it's not a high priority.


Thank you for your explanation. That explains a lot how Kegs is doing it. I imagine other emulators like Sweet16 do something similar.

On a real computer, though, there are no calls to the SmartPort from Prodos 8, and SmartPort should not know anything about Prodos and therefore the Prodos device table is off limits to the SmartPort. But the Smartport has to know how to access the slots and map a device number to a slot.

In your emulator, the slot assignment for a SmartPort device is just continguous with the slot/drive assignments listed above. But on a real computer you can have a hard drive (connected to a SCSI card/SD/CFFA card) in slot 7 and another Smartport compatible card in slot 2. The Smartport will recognize these slots as device #1 and device #2. But there has to be a table some where that maps a device number to its slot/drive pair so the device can be accessed by the softswitches needed for that device. Thus the device number has to be mapped to a device in a certain slot and stored in a table. I am trying to locate where in memory that mapping table is.
Re: SmartPort device assignments [message #420772 is a reply to message #420755] Mon, 28 August 2023 13:21 Go to previous messageGo to next message
qkumba is currently offline  qkumba
Messages: 1596
Registered: March 2013
Karma: 0
Senior Member
ProDOS has an internal mapping table which moved around in earlier versions of ProDOS, and whose format changed in 2.5. Smart Port devices are numbered 1, 2, 3, ... so they can live anywhere in the slot space from ProDOS's point of view.
Re: SmartPort device assignments [message #420773 is a reply to message #420772] Mon, 28 August 2023 16:15 Go to previous messageGo to next message
gids.rs is currently offline  gids.rs
Messages: 1395
Registered: October 2012
Karma: 0
Senior Member
> ProDOS has an internal mapping table which moved around in earlier versions of ProDOS, and whose format changed in 2.5. Smart Port devices are numbered 1, 2, 3, ... so they can live anywhere in the slot space from ProDOS's point of view.

Is there a table that matches the device number with the slots somewhere in memory? Or is there some math calculation that is used?

Normally there would be a device in slot #7 as the boot device and it would be designated Device #1. But another device card can be in any of the other slots supported by the SmartPort Protocol as Device #2. Therefore the assumption has to be made that there is a table some where that matches what slot device #2 is in. I am trying to locate that table.
Re: SmartPort device assignments [message #420774 is a reply to message #420772] Mon, 28 August 2023 16:24 Go to previous messageGo to next message
gids.rs is currently offline  gids.rs
Messages: 1395
Registered: October 2012
Karma: 0
Senior Member
> ProDOS has an internal mapping table which moved around in earlier versions of ProDOS, and whose format changed in 2.5. Smart Port devices are numbered 1, 2, 3, ... so they can live anywhere in the slot space from ProDOS's point of view.

Is there a table that matches the device number with the slots somewhere in memory? Or is there some math calculation that is used?

Normally there would be a device in slot #7 as the boot device and it would be designated Device #1. But another device card can be in any of the other slots supported by the SmartPort Protocol as Device #2. Therefore the assumption has to be made that there is a table some where that matches what slot device #2 is in. I am trying to locate that table.

The software that I am trying to understand is from OpenApple 1987. It makes no calls to Prodos, yet it can report the number of devices and all their information through the SmartPort Protocol at $C70D. What is even more bizarre, is that it recognizes and reports the correct number of blocks on a 2 gig disk image whether it be formatted to Prodos or HFS. This information is not stored in a volumes header.

Is the SmartPort Protocol built into the IIGS ROM, or is it in a slot cards firmware, such as a SCSI card or CFFA3000?
Re: SmartPort device assignments [message #420776 is a reply to message #420774] Tue, 29 August 2023 00:04 Go to previous messageGo to next message
Anonymous
Karma:
Originally posted by: Jerry Penner

I am Rob <gids.rs@sasktel.net> writes:

>> ProDOS has an internal mapping table which moved around in earlier versions of ProDOS,
> and whose format changed in 2.5. Smart Port devices are numbered 1, 2, 3, ... so they can
> live anywhere in the slot space from ProDOS's point of view.
>
> Is there a table that matches the device number with the slots somewhere in memory? Or is
> there some math calculation that is used?
>
> Normally there would be a device in slot #7 as the boot device and it would be designated
> Device #1. But another device card can be in any of the other slots supported by the
> SmartPort Protocol as Device #2. Therefore the assumption has to be made that there is a
> table some where that matches what slot device #2 is in. I am trying to locate that table.
>
> The software that I am trying to understand is from OpenApple 1987. It makes no calls to
> Prodos, yet it can report the number of devices and all their information through the
> SmartPort Protocol at $C70D. What is even more bizarre, is that it recognizes and reports
> the correct number of blocks on a 2 gig disk image whether it be formatted to Prodos or
> HFS. This information is not stored in a volumes header.
>
> Is the SmartPort Protocol built into the IIGS ROM, or is it in a slot cards firmware, such
> as a SCSI card or CFFA3000?

Short answer: both. It's built into the card's firmware. The IIgs has
it built-in if slot 5 is set to Smart Port.


I think you're referring to the January 1987 article on pages
2.89-2.92. Is that right?

The article talks about various peripherals that support the Smartport
protocol converter. Could be an Apple 3.5 Controller (LIRON) card that
supports only the UniDisk 3.5, an Apple Memory Expansion (slinky) board,
an Apple SCSI card, or the IIgs "slot 5" Smartport protocol converter.

Since then, third party product such as the CFFA also support the
Smartport protocol converter.

All of these products maintain the Smartport device list internally and
in their own way. This device-list is separate from the ProDOS device
list.

Also, there is no guarantee that there is a Smartport
protocol-supporting card in slot #7. The Open-Apple program scans the
slots in lines 100-200 (page 2.90b).

The Open-Apple program is finding out all reported information from the
discovered Smartport protocol-converter-supporting peripheral by
examining the firmware ID bytes. It then calls the Smartport
entry-point in the card's $Csxx firmware.

--
--
Jerry jerry+a2 at jpen.ca
Re: SmartPort device assignments [message #420777 is a reply to message #420776] Tue, 29 August 2023 01:00 Go to previous messageGo to next message
gids.rs is currently offline  gids.rs
Messages: 1395
Registered: October 2012
Karma: 0
Senior Member
>>> ProDOS has an internal mapping table which moved around in earlier versions of ProDOS,
>> and whose format changed in 2.5. Smart Port devices are numbered 1, 2, 3, ... so they can
>> live anywhere in the slot space from ProDOS's point of view.
>>
>> Is there a table that matches the device number with the slots somewhere in memory? Or is
>> there some math calculation that is used?
>>
>> Normally there would be a device in slot #7 as the boot device and it would be designated
>> Device #1. But another device card can be in any of the other slots supported by the
>> SmartPort Protocol as Device #2. Therefore the assumption has to be made that there is a
>> table some where that matches what slot device #2 is in. I am trying to locate that table.
>>
>> The software that I am trying to understand is from OpenApple 1987. It makes no calls to
>> Prodos, yet it can report the number of devices and all their information through the
>> SmartPort Protocol at $C70D. What is even more bizarre, is that it recognizes and reports
>> the correct number of blocks on a 2 gig disk image whether it be formatted to Prodos or
>> HFS. This information is not stored in a volumes header.
>>
>> Is the SmartPort Protocol built into the IIGS ROM, or is it in a slot cards firmware, such
>> as a SCSI card or CFFA3000?
> Short answer: both. It's built into the card's firmware. The IIgs has
> it built-in if slot 5 is set to Smart Port.

Disregard the slot 5 Smartport. I am more interested in the slot 7 Smartport with 12 devices and support for 2 gig volumes.


> I think you're referring to the January 1987 article on pages
> 2.89-2.92. Is that right?

Don't know. The software just has the date in the REM statements.


> The article talks about various peripherals that support the Smartport
> protocol converter. Could be an Apple 3.5 Controller (LIRON) card that
> supports only the UniDisk 3.5, an Apple Memory Expansion (slinky) board,
> an Apple SCSI card, or the IIgs "slot 5" Smartport protocol converter.
>
> Since then, third party product such as the CFFA also support the
> Smartport protocol converter.

> All of these products maintain the Smartport device list internally and
> in their own way. This device-list is separate from the ProDOS device
> list.

I have trouble with statements like these as this makes the assumption that the SmartPort device has RAM to store the device list. I have checked the screen holes for the order of the devices. And like you said, the SmartPort device list is separate from the Prodos device list. Where in RAM is it stored?


> Also, there is no guarantee that there is a Smartport
> protocol-supporting card in slot #7. The Open-Apple program scans the
> slots in lines 100-200 (page 2.90b).

If you check the machine language part of the program, you can see that it calls the SmartPort at $C70D. But if there is another SCSI card in slot 2, or slot 4, that device gets assigned device #2. But there has to be a table that indicates which slot device #2 is in. Where is that table or list?


> The Open-Apple program is finding out all reported information from the
> discovered Smartport protocol-converter-supporting peripheral by
> examining the firmware ID bytes. It then calls the Smartport
> entry-point in the card's $Csxx firmware.

That is fine if there is only 1 SmartPort device. But a second SmartPort device can be in any of the other slots supported by SmartPort protocol. The slots checked in order should be S7D1, S7D2, S4D1, S4D2, S2D1, S2D2, S1D1, S1D2, S3D1, S6D1, S6D2, S3D2. Device #2 can be in any of the slots after S7D1. Therefore there must be a table to indicate which slot device #2 is in so that device can be accesssed using that slots softswitches.

Put another way. When device #2 is called by the SmartPort Protocol, there should be a table somewhere that points to the device in slot 2 instead of slot 4. I have trouble believing that the slots get scanned every time in the sequence mentioned above to confirm there is a SmartPort device in that slot. If one were to have 12 devices installed, that is a lot of wear and tear just to find the slot that the 12th device is in.
Re: SmartPort device assignments [message #420781 is a reply to message #420777] Wed, 30 August 2023 16:29 Go to previous message
Anonymous
Karma:
Originally posted by: Jerry Penner

I am Rob <gids.rs@sasktel.net> writes:

>>>> ProDOS has an internal mapping table which moved around in earlier versions of ProDOS,
>>> and whose format changed in 2.5. Smart Port devices are numbered 1, 2, 3, ... so they can
>>> live anywhere in the slot space from ProDOS's point of view.
>>>
>>> Is there a table that matches the device number with the slots somewhere in memory? Or is
>>> there some math calculation that is used?
>>>
>>> Normally there would be a device in slot #7 as the boot device and it would be designated
>>> Device #1. But another device card can be in any of the other slots supported by the
>>> SmartPort Protocol as Device #2. Therefore the assumption has to be made that there is a
>>> table some where that matches what slot device #2 is in. I am trying to locate that table.
>>>
>>> The software that I am trying to understand is from OpenApple 1987. It makes no calls to
>>> Prodos, yet it can report the number of devices and all their information through the
>>> SmartPort Protocol at $C70D. What is even more bizarre, is that it recognizes and reports
>>> the correct number of blocks on a 2 gig disk image whether it be formatted to Prodos or
>>> HFS. This information is not stored in a volumes header.
>>>
>>> Is the SmartPort Protocol built into the IIGS ROM, or is it in a slot cards firmware, such
>>> as a SCSI card or CFFA3000?
>> Short answer: both. It's built into the card's firmware. The IIgs has
>> it built-in if slot 5 is set to Smart Port.
>
> Disregard the slot 5 Smartport. I am more interested in the slot 7 Smartport with 12
> devices and support for 2 gig volumes.

What device is in your slot 7?

It's that device's firmware that is going to determine where the device
list is stored.


>> I think you're referring to the January 1987 article on pages
>> 2.89-2.92. Is that right?
>
> Don't know. The software just has the date in the REM statements.
>
>
>> The article talks about various peripherals that support the Smartport
>> protocol converter. Could be an Apple 3.5 Controller (LIRON) card that
>> supports only the UniDisk 3.5, an Apple Memory Expansion (slinky) board,
>> an Apple SCSI card, or the IIgs "slot 5" Smartport protocol converter.
>>
>> Since then, third party product such as the CFFA also support the
>> Smartport protocol converter.
>
>> All of these products maintain the Smartport device list internally and
>> in their own way. This device-list is separate from the ProDOS device
>> list.
>
> I have trouble with statements like these as this makes the assumption that the SmartPort
> device has RAM to store the device list. I have checked the screen holes for the order of
> the devices. And like you said, the SmartPort device list is separate from the Prodos
> device list. Where in RAM is it stored?

It's device-dependent. Long ago I disassemmbled some of the Apple
High-Speed SCSI card's firmware. The HS SCSI card has an 8kB static RAM
on it, that it can map into $C800-$CBFF. It maps its ROM into
$CC00-$CFFF. So, that SmartPort protocol converter, at least, has the
resources to store its own device list. (It also uses the RAM for
maintaining the partition-map from connected SCSI devices.)


>> Also, there is no guarantee that there is a Smartport
>> protocol-supporting card in slot #7. The Open-Apple program scans the
>> slots in lines 100-200 (page 2.90b).
>
> If you check the machine language part of the program, you can see that it calls the
> SmartPort at $C70D. But if there is another SCSI card in slot 2, or slot 4, that device
> gets assigned device #2. But there has to be a table that indicates which slot device #2
> is in. Where is that table or list?

I understand the question, and I agree there ought to be a table
*somewhere*. There also needs to be an agreed-upon arbitration protocol
if there are multiple SmartPort protocol-converters installed in the
same machine, so they don't stomp on each other.

I suspect the CFFA3000 also has RAM to maintain its list of devices. I
ought to dig into that some day.

>> The Open-Apple program is finding out all reported information from the
>> discovered Smartport protocol-converter-supporting peripheral by
>> examining the firmware ID bytes. It then calls the Smartport
>> entry-point in the card's $Csxx firmware.
>
> That is fine if there is only 1 SmartPort device. But a second SmartPort device can be in
> any of the other slots supported by SmartPort protocol. The slots checked in order should
> be S7D1, S7D2, S4D1, S4D2, S2D1, S2D2, S1D1, S1D2, S3D1, S6D1, S6D2, S3D2. Device #2 can
> be in any of the slots after S7D1. Therefore there must be a table to indicate which slot
> device #2 is in so that device can be accesssed using that slots softswitches.

> Put another way. When device #2 is called by the SmartPort Protocol, there should be a
> table somewhere that points to the device in slot 2 instead of slot 4. I have trouble
> believing that the slots get scanned every time in the sequence mentioned above to confirm
> there is a SmartPort device in that slot. If one were to have 12 devices installed, that
> is a lot of wear and tear just to find the slot that the 12th device is in.

I suspect the scan only happens when the card is first accessed, unless
there are identifiable conditions under which it does a rescan. I doubt
it does it often nor would it do it everytime.

I'm curious to know what you discover.

--
--
Jerry jerry+a2 at jpen.ca
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Sweet 16
Next Topic: Question about video issues
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Sat May 04 13:55:58 EDT 2024

Total time taken to generate the page: 0.08613 seconds