calling SmartPort interface directly

General forum for support issues related to the CFFA3000

calling SmartPort interface directly

Postby peterferrie » Mon Sep 10, 2018 10:02 am

I have configured my CFFA card with five ProDOS volumes, based on a bug report for something that I wrote.
On my system, ProDOS maps two volumes at slot 7, two at slot 4, and the final one at slot 1.
If I ask ProDOS to do a block read of the unit in slot 1, it succeeds and I see the expected content.
If I try to do the same thing without ProDOS (by calling $C70D with the exact unit number), I get garbage being read.
If I iterate through all unit numbers and then dump the volume names, I see all of the volumes other than the one in slot 1.
i.e. I can read any volume successfully other than the one in slot 1.
I didn't see anything in the firmware disassembly that would suggest special handling for ProDOS but I might have missed it.
Any idea what else could be the cause?
peterferrie
 
Posts: 8
Joined: Tue Oct 06, 2015 5:41 pm

Re: calling SmartPort interface directly

Postby dlyons » Fri Oct 26, 2018 1:31 pm

Hi Peter,

The CFFA3000 should not be able to tell the difference between your call to $C70D, and the same call made by ProDOS. That's what ProDOS would do for the slot-1 device.

Let's track this down...I'm not aware of any issues with the 3K's handling of SmartPort calls, but we won't know until we figure this out.

I believe you're issuing a SmartPort read-block command for Unit 5 and Block 2. (Does your code check for an error (A=00) on return?)

Are you running on an Apple IIgs, or some other model? (The 3K has different code on the Apple II side.) If a GS, are you using a Standard or Extended SmartPort call? The 3K supports the extended calls only on the GS, because the main use is for buffer pointers into any IIgs memory bank. I believe ProDOS uses a standard call.

Can you post more details of your SmartPort call, including the parameter block?

Cheers,

--Dave
dlyons
 
Posts: 42
Joined: Sun Feb 17, 2002 6:00 pm

Re: calling SmartPort interface directly

Postby peterferrie » Tue Dec 11, 2018 12:34 pm

Hi Dave,

It turns out that the firmware code (though not specific to the CFFA) does indeed know the difference.
For $C70A, there is translation from ID to device number (i.e. #$10 becomes #$01 or whatever), for $C70D, there is no translation (and passing #$01 stays as #$01), but it works only for remapped partitions.
So now I have code that tries to read via $C70A first. If it fails, then I iterate through all values while calling $C70D.
That works on my hardware, but apparently there's still a problem on the reporter's hardware.
Is there anything obviously wrong with this code?

Code: Select all
                lda     #<(readbuff + $200)
                sta     adrlo
                ldy     #>(readbuff + $200)
                ldx     #2
                stx     x80_parms + 4
                lda     #0 ;block 2
                sta     x80_parms + 5
                jsr     unrhddrd ;read block 2 of volume via SmartPort to readbuff + $200
                jsr     MLI ;read block 2 of volume via ProDOS to readbuff
                !byte   $80
                !word   x80_parms
                bcc     + ;always
iterunit        inc     iterunit + 1

                ;enable use of ProDOS entrypoint

                lda     #$2c
                sta     unrentry2 ;enable fall-through to ProDOS interface

unrentry1       jsr     $d1d1 ;self-modified to $Cxyy and whatever $CxFF holds +3
                !byte   cmdread
                !word   unrpacket
                bcs     iterunit

+               ldy     #$0f
-               lda     readbuff + 4, y
                cmp     readbuff + $204, y
                bne     iterunit
                dey
                bpl     -

;;; snip unrelated code ;;;

x80_parms       !byte   3, $d1 ;self-modified from ProDOS DEVNUM
                !word   readbuff, 2

unrhddrd
                sty     adrhi
                ldy     #cmdread
                sty     command
                stx     bloklo
                sta     blokhi
                lda     #$d1 ;self-modified from ProDOS DEVNUM
                sta     unit
unrentry2
                jmp     $d1d1 ;self-modified to $Cxyy and whatever $CxFF holds
                                     ;jmp is self-modified to BIT on volume name mismatch

                jsr     $d1d1 ;self-modified to $Cxyy and whatever $CxFF holds +3
                !byte   1
                !word   packet
                rts

packet          !byte   3
unrunit2        !byte   0 ;self-modified by iteration
                !word   readbuff + $200
                !word   2
peterferrie
 
Posts: 8
Joined: Tue Oct 06, 2015 5:41 pm

Re: calling SmartPort interface directly

Postby dlyons » Tue Dec 11, 2018 2:05 pm

There are certainly differences between the ProDOS entry point ($C70A) and the SmartPort entry point ($C70D)...the ProDOS devnum and the SmartPort unit number are different concepts.

There is some magic going on in the way ProDOS sets up the remapped devnums, especially for devices after the 4th. Using slot 7 as in this case, the ProDOS entry point will treat $70 as the first device (S7,D1), $F0 as the second device (S7,D2), ANY other value with the highest bit clear as device 3, and any other value with the highest bit set as device 4. This allows ProDOS calls for another slot to be "pointed" at $C70D for the 3rd and 4th devices.

Some versions of ProDOS set up the remapping of devs 3 and 4 that way; possibly all of them that support it. But there is deeper magic available, and required for the 5th and later devices: ProDOS points the device driver vector (in the table starting at $BF10) for the remapped slot/drive (S1,D1 in this case) to point at some glue code (somewhere in $Dxxx, I think) that calls into the SmartPort entry point ($C70D) with the unit number set to 5.

That bit of magic, specifically, is what I meant in saying the CFFA3K's firmware shouldn't be able to tell the difference: between (1) ProDOS's call into the $C70D with unit = 5, and (2) your code's call to $C70d with unit = 5.

I don't see anything obviously wrong with your code, though I can't tell quite which device numbers and unit numbers it's setting up.

Let me know if this helps at all! Cheers,

--Dave
dlyons
 
Posts: 42
Joined: Sun Feb 17, 2002 6:00 pm


Return to CFFA3000 Support

Who is online

Users browsing this forum: No registered users and 8 guests

cron