; interrupt patches
; last update 13/12/2003


BLIT:
    MOVE    #$0040,156(A0)
    MOVE.L  58(A1),D0
    BEQ.S   .ALAB_0002
    BTST    #1,169(A1)
    BEQ.S   .ALAB_0002
    MOVEA.L A1,A6
    MOVEA.L D0,A1
    MOVEQ.L #$20,D1
.LAB_0003:
    BTST    #6,2(A0)
    BEQ.S   .LAB_0004
    MOVE    30(A0),D0
    AND     D1,D0
    BEQ.S   .LAB_0003
    BTST    #6,_custom+dmaconr
    BNE.S   .ALAB_0002
    MOVE    #$8040,_custom+intreq
.ALAB_0002:
    RTS
 cnop 0,4


.LAB_0004:
    BCLR    #7,169(A6)
    BNE.S   .LAB_0006
    MOVE    12(A1),D0
    BPL.S   .LAB_0005
    AND    #32767,D0
    MOVE    D0,12(A1)
    MOVE.L  4(A0),D1
    LSR.L   #8,D1
    AND #$07FF,D1
    CMP D0,D1
    BCS.w   .LAB_000A
.LAB_0005:
    MOVEA.L 4(A1),A5
     JSR (A5)
    BNE.S   .LAB_0001
    BSET    #7,169(A6)
.LAB_0001:
    BTST    #6,_custom+dmaconr
    BNE.S   .LAB_0002
    MOVE    #$8040,_custom+intreq
.LAB_0002:
    RTS
 cnop 0,4


.LAB_0006:
    BTST    #6,8(A1)
    BEQ.S   .LAB_0007
    MOVEA.L 14(A1),A5
     JSR (A5)
    MOVEA.L 58(A6),A1
.LAB_0007:
    MOVE.L  (A1),58(A6)
    BNE.S   .LAB_0008
    ANDI    #$FFFD,168(A6)
    MOVE    #$0040,_custom+intena
     bra DisownBlitter
 cnop 0,4


.LAB_0008:
    TST 170(A6)
    BEQ.S   .LAB_0009
    CLR.L   58(A6)
    ANDI    #$FFFD,168(A6)
    MOVE    #$0040,_custom+intena
     bsr DisownBlitter
    MOVE.L  (A1),58(A6)
    ADDQ    #1,170(A6)
    RTS
 cnop 0,4


.LAB_0009:
    MOVE    #$8040,_custom+intreq
    RTS
 cnop 0,4


.LAB_000A:
    BTST    #1,165(A6)
    BEQ.S   .LAB_000B
    LSR #1,D0
.LAB_000B:
    LEA CIAB_PRA,A0
    MOVEA.L A6,A1
    MOVEM.L D0/A0-A1,-(A7)
    MOVEQ   #-1,D0
    CLR.B  2560(A0)
    MOVE.B  D0,2304(A0)
    MOVE.B  D0,2048(A0)
    MOVEA.L 42(A6),A6
    MOVEQ   #4,D0
     JSR -24(A6)
    MOVEM.L (A7)+,D0/A0-A1
    BSET    #6,169(A1)
    ROR #8,D0
    MOVE.B  D0,2304(A0)
    ROL #8,D0
    MOVE.B  D0,2048(A0)
    MOVEQ   #127,D0
    ADDQ.L  #5,D0
     JMP -18(A6)
 cnop 0,4
