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

Re: Virtual serial drive



On Tuesday, September 4, 2012 6:28:34 AM UTC-5, schmidtd wrote:
> On 9/4/2012 4:46 AM, Ric wrote:> I try on my //c 255 rom but don't work 
> 
> right.
> 
>  > Should be rewrite serial card subroutine on file SERIAL.DRIVE
> 
>  > The command dos is Apple2VirtualDrive COM1 disk.hdv
> 
> 
> 
> It won't work on a IIc because it is currently hard-coded to talk to the 
> 
> GS serial hardware.  I've got the serial code isolated and bolted the 
> 
> serial backend of ADTPro to it, and now it'll use whatever hardware is 
> 
> supported by that.  But I still have to get the driver to attach to 
> 
> ProDOS correctly - I'm reading the Beyond ProDOS book for that now.

That's a pretty easy problem to fix!  The serial ports aren't that different if you're just using polling routines.  The I/O registers and init code are different, but the process of polling the port is pretty similar.

;//gs SSC:
!if     SLOT = 1 {
SCC_Data    = $c03B
SCC_Reg     = $c039
} else {
SCC_Data    = $c03A
SCC_Reg     = $c038
}

;Init
                    ;Enable emulation mode (redundant?)
                    ;sec
                    ;xce
                    ; Synchronize with SCC
                    lda SCC_Reg
                    ; Offsetting by 1 to leverage Z flag
                    ldy #(.enddata - .data + 1)
.initloop
                    ; Offsetting by 1 (again) to leverage Z flag
                    lda .data - 1,y
                    sta SCC_Reg
                    dey
                    bne .initloop
                    beq .enddata
.data
;Select RTxC pin as clock source
                    !if SLOT=1 {
                        !byte %10000000, 11
                    } else {
                        !byte %00000000, 11
                    }
;Disable baud rate generator
                    !byte %10100000, 14
;x32 clock, 8-bit sync, 1 stop bit, no parity
                    !byte %10000100, 4
; polling mode: WR9, bit 3 and WR1 bit 7 must be 0 to disable interrupts
; WR9 value taken from Apple //gs tech note #18
                    !byte %00000010, 9
                    !byte %00000000, 1

;Send byte in X
send
                    LDA #$04
.sendloop
                    BIT SCC_Reg
                    BEQ .sendloop
                    STX SCC_Data
;Read byte to A
recv
                    ;Poll for next byte
                    LDA #$01
.readLoop
                    BIT SCC_Reg
                    BEQ .readLoop
                    LDA SCC_Data


;-----------------------------------------------------------------------
;Super Serial Card:
ACIA_Data       = $c088 + (SLOT * 16)
ACIA_Status     = $c089 + (SLOT * 16)
ACIA_Command    = $c08a + (SLOT * 16)
ACIA_Control    = $c08b + (SLOT * 16)

;Init
;init serial port to 115200, no interrupts, 8 data bits, 1 stop bit
                    LDA #%00010000      
                    STA ACIA_Control
; No Parity, RTS low, DTR on, disable IRQ (& //c keyboard buffer)
                    LDA #%00001011      
                    STA ACIA_Command

;Recv byte to A
recv
                    LDA #$08
.readLoop
                    BIT ACIA_Status
                    BEQ .readLoop
                    LDA ACIA_Data
                    RTS

;Send byte in X
send
                    LDA #$10
.sendloop
                    BIT ACIA_Status
                    BEQ .sendloop
                    STX ACIA_Data
                    RTS

-B