View Single Post
Old 18 September 2013, 22:18   #121
Don_Adan
Registered User
 
Join Date: Jan 2008
Location: Warsaw/Poland
Age: 49
Posts: 918
Quote:
Originally Posted by Schoenfeld View Post
You're in a part of the device startup code which is only called if the card is not properly initialized, for example if some other card is fully occupying Z3 space. The bug you're referring to is already fixed in V1.10 of the driver, but not yet published on my Wiki (AmigaKit has the device already, was sent to them ahead of time for inclusion in Easynet).

We are currently testing V1.11 which has a faster transfer routine especially geared towards use with AmiTCP: The new device is now available in special AmiTCP/Genesis variants which replace AmiTCP's copy routine with a combined poll/copy routine that essentially skips one step of copying the data around in memory. I'll publish that device later this evening or tomorrow, as time permits. The bug you've found is also fixed in that device.

Jens
Ok. Intuition library problem is fixed for V.1.11 (040).
But copy exec base as data problem is not solved for this version,
due wrong branch still exist:

Code:
lbC0017EE    MOVE.L    A2,-(SP)
    MOVEA.L    (8,SP),A1
    MOVEA.L    A1,A2
    MOVEA.L    ($28,A1),A0
    MOVE.L    ($24,A1),D0
    TST.L    A0
    BEQ.B    lbC001822    ; bug
    MOVEQ    #15,D1
    CMP.L    D0,D1
    BCC.B    lbC001822
    CLR.L    (A0)
    MOVEQ    #$10,D1
    MOVE.L    D1,(4,A0)
    MOVE.W    #7,(8,A0)
    CLR.W    (10,A0)
    MOVE.L    #lbW003E94,(12,A0)
lbC001822    MOVE.L    (4,A0),($20,A2)
    MOVE.L    ($10,SP),-(SP)
    MOVE.L    A1,-(SP)
    BSR.W    lbC000DB0
    ADDQ.W    #8,SP
    MOVEA.L    (SP)+,A2
    RTS
I converted to ASM DevAbortIO (6th LVO's) routine:

Code:
; for future expansion - must return zero.

DevExtfunc
QuitLVO
    moveq    #0,D0            ; output (no error)
    rts

; The device AbortIO() entry point.

; A1 - The IO request to be aborted.
; A6 - The device base.

; input A1 - used (node)
; input A6 - unused (X-Surf-100 device base)
; output   - D0 (error status)

DevAbortIO
    cmp.b    #7,8(A1)
    beq.b    QuitLVO
    moveq    #-3,D0            ; output (error)
    move.w    $1C(A1),D1
    cmp.w    #$16+2,D1
    bhi.b    QuitLVO6        ; D0 is set already
    move.l    $18(A1),A0
    jmp    JumpBase(PC,D1.W*2)

JumpBase
    rts                ; 00
    rts                ; 01
    bra.b    Rout1LVO6        ; 02
    bra.b    Rout2LVO6        ; 03
    rts                ; 04
    rts                ; 05
    rts                ; 06
    rts                ; 07
    rts                ; 08
    rts                ; 09
    rts                ; 0A
    rts                ; 0B
    rts                ; 0C
    rts                ; 0D
    rts                ; 0E
    rts                ; 0F
    bra.b    Rout2LVO6        ; 10    fix
    bra.b    Rout2LVO6        ; 11
    rts                ; 12
    rts                ; 13
    rts                ; 14
    rts                ; 15
QuitLVO6
    rts                ; 16
    bra.b    Rout3LVO6        ; 17
Rout4LVO6
    lea    $70(A0),A0        ; 18
    bra.b    NodeLVO6

Rout1LVO6
    move.l    $64(A0),A0
    move.l    (A0),D1
    beq.b    QuitLVO
LoopLVO6
    move.l    A0,-(SP)
    lea    $14(A0),A0
    bsr.b    NextLVO6
    move.l    (SP)+,A0
    tst.l    D0
    beq.b    QuitLVO6        ; output (no error)
    move.l    (A0),A0
    move.l    (A0),D1            ; D0 is set already
    bne.b    LoopLVO6
    rts

Rout3LVO6
    lea    $4C(A0),A0
    bra.b    NodeLVO6

Rout2LVO6
    lea    $40(A0),A0

; input A0 - changed
; input A1 - not changed, if error occured
; output D0 - CCR no set

NodeLVO6
    move.l    (A0),D1
NextLVO6
    move.l    D1,A0
    move.l    (A0),D1
    beq.b    QuitLVO6
    cmp.l    A0,A1
    bne.b    NextLVO6
    move.l    A6,-(SP)
    move.l    A1,-(SP)
    move.l    ExecBase(PC),A6
    jsr    -$78(A6)    ; Disable, This call is guaranteed to preserve all registers.

;    IMPORTANT REMINDER:

;    It is important to remember that there is a danger in using
;    disabled sections.  Disabling interrupts for more than ~250
;    microseconds will prevent vital system functions (especially serial
;    I/0) from operating in a normal fashion.

;    Think twice before using Disable(), then think once more.
;    After all that, think again.  With enough thought, txe need
;    for a Disable() can often be eliminated.  For the user of many
;    device drivers, a write to disable *only* the particular interrupt
;    of interest can replace a Disable().  For example:
;            MOVE.W    #INTF_PORTS,_intena

    jsr    -$FC(A6)    ; Remove, A1 input
    move.l    (SP)+,A1
    move.b    #$FE,$1F(A1)
    btst    #0,$1E(A1)
    bne.b    SkipLVO6
    jsr    -$17A(A6)    ; ReplyMsg, A1 input
SkipLVO6
    jsr    -$7E(A6)    ; Enable, This call is guaranteed to preserve all registers.
    move.l    (SP)+,A6
    moveq    #0,D0        ; output (no error)
    rts
This is mix 4th and 6th LVO's. You can use this version if you want.
I fixed also next bug, due "Rout2LVO6" routine must be called for
$10 input value too.

Here is original v1.11 C code of DevAbortIO routine:

Code:
lbC00016A    MOVE.L    A6,-(SP)
    MOVE.L    A1,-(SP)
    JSR    (lbC000AB0)
    ADDQ.L    #8,SP
    RTS

    ,,,,   

lbC000AB0    MOVEM.L    D2/D3/A2/A3,-(SP)
    MOVEA.L    ($14,SP),A3
    MOVE.L    ($18,SP),D3
    CLR.L    D2
    MOVEA.L    ($18,A3),A2
    MOVE.B    (8,A3),D0
    CMPI.B    #7,D0
    BEQ.W    lbC000B6C
    BSR.L    lbC003BF8            ; Disable
    MOVE.W    ($1C,A3),D0
    ANDI.L    #$FFFF,D0
    SUBQ.L    #2,D0
    MOVEQ    #$16,D1
    CMP.L    D0,D1
    BCS.B    lbC000B64
    MOVE.W    (lbW000AEE,PC,D0.L*2),D0
    JMP    (lbW000AEE,PC,D0.W)

lbW000AEE
    dc.w    lbC000B1C-lbW000AEE
    dc.w    lbC000B3E-lbW000AEE
    dc.w    lbC000B64-lbW000AEE
    dc.w    lbC000B64-lbW000AEE
    dc.w    lbC000B64-lbW000AEE
    dc.w    lbC000B64-lbW000AEE
    dc.w    lbC000B64-lbW000AEE
    dc.w    lbC000B64-lbW000AEE
    dc.w    lbC000B64-lbW000AEE
    dc.w    lbC000B64-lbW000AEE
    dc.w    lbC000B64-lbW000AEE
    dc.w    lbC000B64-lbW000AEE
    dc.w    lbC000B64-lbW000AEE
    dc.w    lbC000B64-lbW000AEE
    dc.w    lbC000B64-lbW000AEE
    dc.w    lbC000B3E-lbW000AEE
    dc.w    lbC000B64-lbW000AEE
    dc.w    lbC000B64-lbW000AEE
    dc.w    lbC000B64-lbW000AEE
    dc.w    lbC000B64-lbW000AEE
    dc.w    lbC000B64-lbW000AEE
    dc.w    lbC000B48-lbW000AEE
    dc.w    lbC000B52-lbW000AEE

lbC000B1C    MOVEA.L    ($64,A2),A2
    MOVE.L    (A2),D0
    BEQ.B    lbC000B66
lbC000B24    MOVE.L    D3,-(SP)
    MOVE.L    A3,-(SP)
    PEA    ($14,A2)
    BSR.B    lbC000B74
    MOVE.L    D0,D2
    ADDQ.W    #8,SP
    ADDQ.W    #4,SP
    BEQ.B    lbC000B66
    MOVEA.L    (A2),A2
    MOVE.L    (A2),D0
    BNE.B    lbC000B24
    BRA.B    lbC000B66

lbC000B3E    MOVE.L    D3,-(SP)
    MOVE.L    A3,-(SP)
    PEA    ($40,A2)
    BRA.B    lbC000B5A

lbC000B48    MOVE.L    D3,-(SP)
    MOVE.L    A3,-(SP)
    PEA    ($4C,A2)
    BRA.B    lbC000B5A

lbC000B52    MOVE.L    D3,-(SP)
    MOVE.L    A3,-(SP)
    PEA    ($70,A2)
lbC000B5A    BSR.B    lbC000B74
    MOVE.L    D0,D2
    ADDQ.W    #8,SP
    ADDQ.W    #4,SP
    BRA.B    lbC000B66

lbC000B64    MOVEQ    #-3,D2
lbC000B66    BSR.L    lbC003C44        ; Enable
lbC000B6C    MOVE.L    D2,D0
    MOVEM.L    (SP)+,D2/D3/A2/A3
    RTS

lbC000B74    MOVE.L    A2,-(SP)
    MOVE.L    D2,-(SP)
    MOVEA.L    (12,SP),A0
    MOVEA.L    ($10,SP),A1
    MOVE.L    ($14,SP),D2
    MOVEQ    #-3,D1
    MOVEA.L    (A0),A2
    BRA.B    lbC000BB0

lbC000B8A    MOVE.L    (A2),D0
    CMPA.L    A2,A1
    BNE.B    lbC000BAE
    MOVE.L    A2,-(SP)
    BSR.L    lbC003DA0        ; Remove
    MOVE.B    #$FE,($1F,A2)
    MOVE.L    D2,-(SP)
    MOVE.L    A2,-(SP)
    BSR.W    lbC000DB0        ; ReplyMsg
    CLR.L    D1
    ADDQ.W    #8,SP
    ADDQ.W    #4,SP
    BRA.B    lbC000BB4

lbC000BAE    MOVEA.L    D0,A2
lbC000BB0    MOVE.L    (A2),D0
    BNE.B    lbC000B8A
lbC000BB4    MOVE.L    D1,D0
    MOVE.L    (SP)+,D2
    MOVEA.L    (SP)+,A2
    RTS
I found this bug due I disassembled a2065.device for check how
works DevAbortIO routine. Here is code from a2065.device:

Code:
lbC000D92    MOVEM.L    D6/D7/A2-A5,-(SP)
    BSR.L    lbC000352
    MOVEQ    #1,D7
    MOVEQ    #0,D6
    CLR.B    $1F(A4)
    TST.B    8(A4)
    BNE.L    lbC000E9A
    MOVE.W    $1C(A4),D0
    CMPI.W    #2,D0
    BEQ.L    lbC000DFE
    CMPI.W    #$18,D0
    BEQ.L    lbC000DFE
    CMPI.W    #3,D0
    BEQ.L    lbC000E3C
    CMPI.W    #$11,D0
    BEQ.L    lbC000E3C
    CMPI.W    #$10,D0            ; here
    BEQ.L    lbC000E3C
    CMPI.W    #$17,D0
    BNE.L    lbC000E9A
    MOVE.L    $20(A4),D0
    CMPI.B    #1,D0
    BLT.L    lbC000E9A
    CMPI.B    #$80,D0
    BGT.L    lbC000E9A
    LEA    $CEA(A3),A2
    JSR    -$84(A6)
    BRA.L    lbC000E46

lbC000DFE    JSR    -$84(A6)
    CMPI.W    #$18,D0
    BNE.S    lbC000E12
    LEA    $C8A(A3),A2
    LEA    $20(A2),A2
    BRA.S    lbC000E46

lbC000E12    MOVE.L    $24(A4),D0
    CMPI.L    #$5DC,D0
    BHI.L    lbC000E2A
    LEA    $C5E(A3),A2
    LEA    $20(A2),A2
    BRA.S    lbC000E46

lbC000E2A    BSR.L    lbC0018A2
    TST.L    D0
    BEQ.L    lbC000E96
    MOVEA.L    D0,A2
    LEA    $20(A2),A2
    BRA.S    lbC000E46

lbC000E3C    JSR    -$84(A6)
    MOVEQ    #1,D6
    LEA    $CCE(A3),A2
lbC000E46    JSR    -$78(A6)
    CMPA.L    8(A2),A2
    BEQ.S    lbC000E92
    MOVEA.L    (A2),A2
    CMPA.L    A2,A4
    BNE.S    lbC000E70
    TST.B    D6
    BNE.S    lbC000E92
lbC000E5A    MOVEA.L    A2,A1
    JSR    -$FC(A6)
    MOVE.B    #$FE,$1F(A2)
    MOVEQ    #0,D7
    MOVEA.L    A2,A1
    BSR.L    lbC000C06
    BRA.S    lbC000E92

lbC000E70    MOVEA.L    (A2),A2
    TST.L    (A2)
    BEQ.S    lbC000E92
    CMPA.L    A2,A4
    BEQ.S    lbC000E5A
    BRA.S    lbC000E70

    MOVE.L    $54(A2),D0
lbC000E80    MOVEA.L    (A2),A2
    TST.L    (A2)
    BEQ.S    lbC000E92
    CMP.L    $14(A2),D0
    BNE.S    lbC000E80
    LEA    8(A2),A2
    BRA.S    lbC000E46

lbC000E92    JSR    -$7E(A6)
lbC000E96    JSR    -$8A(A6)
lbC000E9A    MOVE.L    D7,D0
    MOVEM.L    (SP)+,D6/D7/A2-A5
    RTS
Anyway exist also possible one more bug. A2065 version returns D0 as 0 or 1,
x_surf_100 version returns D0 as 0 or -3. I don't know which result 1 or
-3 is correct, but I suspect that Commodore driver has correct error output.

Next routines can be removed from driver, due are unused:

Code:
1)
    MOVEM.L    A2/A3/A6,-(SP)
    MOVEA.L    ($10,SP),A3
    MOVEA.L    ($14,SP),A0
    LEA    ($18,SP),A1
    LEA    (lbC00019A,PC),A2
    MOVEA.L    (4).W,A6
    JSR    (-$20A,A6)
    MOVEM.L    (SP)+,A2/A3/A6
    RTS

lbC00019A    MOVE.B    D0,(A3)+
    RTS

2)
    MOVE.W    (6,SP),D0
    ROL.W    #8,D0
    ANDI.L    #$FFFF,D0
    RTS

    NOP
    MOVEA.L    #$BFE001,A0
    MOVE.B    (A0),D0
    RTS

    NOP
    MOVE.L    (4,SP),D1
    MULS.L    #$2CA,D1
    MOVE.L    D1,D0
    SUBQ.L    #1,D1
    TST.L    D0
    BEQ.B    lbC001878
    MOVEA.L    #$BFE001,A0
lbC00186E    MOVE.B    (A0),D0
    MOVE.L    D1,D0
    SUBQ.L    #1,D1
    TST.L    D0
    BNE.B    lbC00186E
lbC001878    RTS

3)
    MOVE.L    A2,-(SP)
    MOVEA.L    (8,SP),A2
    MOVEA.L    ($10,SP),A1
    MOVEA.L    (12,SP),A0
    MOVE.L    ($14,SP),D0
    JSR    (A2)
    MOVEA.L    (SP)+,A2
    RTS

    MOVE.L    A3,-(SP)
    MOVE.L    A2,-(SP)
    MOVEA.L    (12,SP),A3
    MOVEA.L    ($10,SP),A0
    MOVEA.L    ($14,SP),A2
    MOVEA.L    ($18,SP),A1
    JSR    (A3)
    MOVEA.L    (SP)+,A2
    MOVEA.L    (SP)+,A3
    RTS

4)
    MOVEM.L    D2/A2/A3,-(SP)
    MOVEA.L    ($10,SP),A2
    CLR.L    D2
    TST.L    A2
    BEQ.B    lbC00320E
    MOVE.B    (A2),D0
    CMPI.B    #$30,D0
    BNE.B    lbC00320E
    MOVE.B    (1,A2),D0
    CMPI.B    #$78,D0
    BNE.B    lbC00320E
    MOVE.L    A2,-(SP)
    BSR.L    lbC003A9C
    MOVEQ    #2,D1
    ADDQ.W    #4,SP
    CMP.L    D1,D0
    BLE.B    lbC00320E
    LEA    (2,A2),A0
    LEA    (A2,D0.L),A1
lbC0031C0    ASL.L    #4,D2
    MOVE.B    (A2,D1.L),D0
    CMPI.B    #$39,D0
    BGT.B    lbC0031E4
    MOVE.B    (A2,D1.L),D0
    CMPI.B    #$2F,D0
    BLE.B    lbC0031E4
    MOVE.B    (A2,D1.L),D0
    EXTB.L    D0
    MOVEA.L    D2,A3
    LEA    (-$30,A3,D0.L),A3
    MOVE.L    A3,D2
lbC0031E4    MOVE.B    (A2,D1.L),D0
    CMPI.B    #$66,D0
    BGT.B    lbC003206
    MOVE.B    (A2,D1.L),D0
    CMPI.B    #$60,D0
    BLE.B    lbC003206
    MOVE.B    (A2,D1.L),D0
    EXTB.L    D0
    MOVEA.L    D2,A3
    LEA    (-$61,A3,D0.L),A3
    MOVE.L    A3,D2
lbC003206    ADDQ.W    #1,A0
    ADDQ.L    #1,D1
    CMPA.L    A0,A1
    BGT.B    lbC0031C0
lbC00320E    MOVE.L    D2,D0
    MOVEM.L    (SP)+,D2/A2/A3
    RTS

5)
    MOVEM.L    D2-D6/A2,-(SP)
    MOVE.L    ($1C,SP),D6
    MOVEA.L    ($24,SP),A0
    MOVE.L    ($28,SP),D3
    MOVE.W    ($22,SP),D5
    MOVEA.L    ($64,A0),A2
    TST.L    D3
    BEQ.B    lbC0039B4
    CLR.L    D4
lbC003986    MOVE.L    (8,A2),D2
    CMP.L    D3,D2
    BLS.B    lbC003990
    MOVE.L    D3,D2
lbC003990    CLR.L    -(SP)
    MOVE.W    D2,D4
    MOVE.L    D4,-(SP)
    MOVE.W    D5,-(SP)
    CLR.W    -(SP)
    MOVE.L    (12,A2),-(SP)
    MOVE.L    D6,-(SP)
    BSR.L    lbC002674
    SUB.L    D2,D3
    ADD.W    D2,D5
    MOVEA.L    (A2),A2
    ADDA.W    #$14,SP
    TST.L    D3
    BNE.B    lbC003986
lbC0039B4    MOVEQ    #1,D0
    MOVEM.L    (SP)+,D2-D6/A2
    RTS

    MOVEM.L    D2-D7/A2/A3,-(SP)
    MOVE.L    ($24,SP),D7
    MOVEA.L    ($28,SP),A3
    MOVE.L    ($30,SP),D3
    MOVE.W    ($2E,SP),D5
    MOVEA.L    ($60,A3),A2
    MOVE.L    D3,D6
    BNE.B    lbC0039E2
    CLR.L    ($64,A3)
    BRA.B    lbC003A30

lbC0039DE    SUB.L    D3,D6
    BRA.B    lbC003A20

lbC0039E2    MOVE.L    A2,($64,A3)
    CLR.L    D4
lbC0039E8    MOVE.L    (8,A2),D2
    CMP.L    D3,D2
    BLS.B    lbC0039F6
    MOVE.L    D3,D2
    MOVE.L    D3,(8,A2)
lbC0039F6    SUB.L    D2,D3
    CLR.L    -(SP)
    MOVE.W    D2,D4
    MOVE.L    D4,-(SP)
    MOVE.L    (12,A2),-(SP)
    MOVE.W    D5,-(SP)
    CLR.W    -(SP)
    MOVE.L    D7,-(SP)
    BSR.L    lbC002566
    ADD.W    D2,D5
    ADDA.W    #$14,SP
    TST.L    D3
    BEQ.B    lbC003A20
    MOVE.L    (A2),D0
    BEQ.B    lbC0039DE
    MOVEA.L    (A2),A2
    BRA.B    lbC0039E8

lbC003A20    MOVE.L    (A2),D0
    CLR.L    (A2)
    MOVEA.L    ($64,A3),A0
    MOVE.L    D6,($14,A0)
    MOVE.L    D0,($60,A3)
lbC003A30    MOVEQ    #1,D0
    MOVEM.L    (SP)+,D2-D7/A2/A3
    RTS
And finally better change EndSkip value to zero/null.

Code:
    MOVEQ    #-1,D0
    RTS

lbC000004    ILLEGAL
    dc.l    lbC000004
    dc.l    lbL000096        ; EndSkip
    dc.b    $80
    dc.b    1
    dc.b    3
    dc.b    0
    dc.l    xsurf100devic.MSG
    dc.l    VERxsurf100de.MSG
    dc.l    lbL000096
Now I start reworking to ASM DevBeginIO (5th LVO) routine.
Don_Adan is offline  
AdSense AdSense  
 
Page generated in 0.16398 seconds with 9 queries