[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: IDE and CF on CFFA



Bill,

I wish I had time to work on your hack, but I have no free time for more 
apple hacking these days. But I thought I might give you or someone else
a head start on your request:

NOTE: Changing the CFFA's firmware will not change the behavior of Dave 
Lyon's GS/OS driver which doesn't use the firmware once booted!
So if your using his driver, changing the firmware won't help.

The CFFA firmware currently maps all 4 drives (or 8 with jumper change) 
onto one CF card. To change that mapping to map say 2 drives onto the 
master card (the onboard socket) and the next 2 drives onto the IDE 
connector (slave if you jumper the device that way) you would have to 
change the following routine. (and no other routine should need changes, 
I think :-o)

Basically, the drive to access, master or slave is controlled by bit6 of
ATAHead,x so first that hardcoded $E0 would have to be changed based on 
what drive prodos was trying to access and how you decide to map them.
Also, ATACylinderH,x would have to be changed to accomidate your mapping 
scheme. As it is, the mapping scheme was easy because it just worked out 
that the prodos drive number could be dropped into LBA address bit 16 to 
23 as long as you add in any overflow from LBA bits 8 to 15. In any 
case, this is the routine, and the source, as always, is freely 
available at my web site: http://dreher.net/

You know, what I would love to see is someone hack my card to work with 
DOS 3.3. Is there someone out there that has done that kind of thing? Is 
Beneath Apple DOS the only relevant reference available?

Rich Dreher

;-----------------------------------------------------------------------
-------
; Block2LBA - Translates ProDOS block# into LBA and programs devices' 
task file
;             registers.
;
; Input:
;       pd Command Block Data $42 - $47
;       X = requested slot number in form $n0 where n = slot 1 to 7
;       Y = $0n (n = slot#) for accessing scratchpad RAM;
;
; Ouput:
;       None
;
; ZeroPage Usage:
;       None
;
; CPU Registers changed:  A, P
;
; This function translates the block number sent in the PRODOS request
; packet, into an ATA Logical Block Address (LBA).
; The least significant 16 bits becomes the ProDOS block#.
; The most significant 16 becomes the ProDOS Drive #
;
; A ProDOS block and a ATA sector are both 512 bytes.
;
; Logical Block Mode, the Logical Block Address is interpreted as 
follows:
; LBA07-LBA00: Sector Number Register D7-D0.
; LBA15-LBA08: Cylinder Low Register D7-D0.
; LBA23-LBA16: Cylinder High Register D7-D0.
; LBA27-LBA24: Drive/Head Register bits HS3-HS0.


Block2LBA:

   lda  #$E0                    ;1, (LBA), 1, (Drive), LBA 27-24, where 
LBA=1,
                                ; Drive=0
   sta  ATAHead,x               ;Talk to the Master device and use LBA 
mode.
                                ; Remember that this write will seen by 
both
                                ; the master and slave devices.
;
; Add BLOCKOFFSET to the ProDOS block number to offset the first drive 
block we
; use. This keeps the device's first BLOCKOFFSET blocks free, which 
usually
; includes a MBR at block 0.
;
   lda  DrvMiscFlags,y           ; bit 7 = raw block access
   and  #$80
   eor  #$80
   beq  rawBlocks
   lda  #BLOCKOFFSET
rawBlocks:                      ; A = $00 or BLOCKOFFSET
   clc
   adc  pdBlockNumber
   sta  ATASector,x             ;store ProDOS Low block # into LBA 0-7

   lda  pdBlockNumberH
   adc  #0                      ;account for any overflow in LBA 0-7
   sta  ATACylinder,x           ;store ProDOS High block # into LBA 15-8

   lda DriveNumber,y
   adc #0                        ;account for overflow from LBA 8-15
   sta ATACylinderH,x            ;store LBA bits 23-16

   lda #1
   sta ATASectorCnt,x
   rts


In article <gvedne7W240bMY_d4p2dnA@comcast.com>, willy46pa@comcast.net 
says...
> 
> If someone has broken this barrier of
> the CFFA, I would like it please. What
> I want to do is use an adapter to hold
> a second CF card that I can use for backups.
> I'm not very good at assemblers yet, so
> it would be better if I had the object
> or binary file.