;Copyright(c)1992 by Giuliano C. Peritore - ETI020 ;E-Mail mc6040@mclink.it SECTION "Code",CODE XDEF _dopat XDEF _undopat ;--------------------------------------------------------------- _dopat: ;Call in Forbid()en state move.l 4(a7),DOSBase move.l 8(a7),Buffer move.l 12(a7),BufSize move.l 16(a7),Task move.l a6,-(a7) move.l 4,a6 ;SysBase lea newread(pc),a0 move.l a0,d0 move.w #$ffd6,a0 ;Read() move.l DOSBase,a1 jsr -$1a4(a6) ;SetFunction() move.l d0,olda+2 ;This is absurd and relies on move.l d0,oldb+2 ;calling program's cache move.l d0,oldc+2 ;flushing, but it is here move.l d0,oldd+2 ;to gain a few cycles... move.l d0,olde+2 lea newwrite(pc),a0 move.l a0,d0 move.w #$ffd0,a0 ;Write() move.l DOSBase,a1 jsr -$1a4(a6) ;SetFunction() move.l d0,wolda+2 move.l d0,woldb+2 move.l d0,woldc+2 move.l d0,woldd+2 move.l d0,wolde+2 move.l (a7)+,a6 rts _undopat: move.l 4(a7),DOSBase move.l a6,-(a7) move.l 4,a6 ;SysBase move.l olda+2,d0 move.w #$ffd6,a0 ;Read() move.l DOSBase,a1 jsr -$1a4(a6) ;SetFunction() move.l wolda+2,d0 move.w #$ffd0,a0 ;Write() move.l DOSBase,a1 jsr -$1a4(a6) ;SetFunction() move.l (a7)+,a6 rts ;--------------------------------------------------------------- ;d1 filehandle ;d2 buffer ;d3 len newread: move.l d2,d0 ;Check if destination is in swap d0 ;ZorroIII memory and.w #$ff00,d0 bne.s ToZorroIII olda: jmp $00000000 ;Read() ToZorroIII: move.l d1,a0 ;Get FileHandle add.l a0,a0 add.l a0,a0 move.l 8(a0),a0 ;Get MsgPort *fh_Type move.l 16(a0),a0 ;mp_SigTask cmp.l Task,a0 beq.s Patched ;Check if it is patched drive oldb: jmp $00000000 Patched: cmp.l BufSize,d3 ;Check if buffer suffices bgt.s ExtraLong movem.l d0-d1/a0-a1/a6,-(a7) move.l 4,a6 ;Forbid jsr -$0084(a6) movem.l (a7)+,d0-d1/a0-a1/a6 move.l d2,-(a7) move.l Buffer,d2 oldc: jsr $00000000 move.l (a7),a1 movem.l d0/a6,-(a7) move.l d2,a0 move.l d3,d0 move.l 4,a6 jsr -$270(a6) ;CopyMem movem.l (a7)+,d0/a6 move.l (a7)+,d2 movem.l d0-d1/a0-a1/a6,-(a7) move.l 4,a6 jsr -$008A(a6) ;Permit movem.l (a7)+,d0-d1/a0-a1/a6 rts ExtraLong: movem.l d0-d1/a0-a1/a6,-(a7) move.l 4,a6 ;Forbid jsr -$0084(a6) movem.l (a7)+,d0-d1/a0-a1/a6 movem.l d2-d7/a4-a6,-(a7) move.l a6,a5 ;Store DOSBase in A5 move.l d2,d6 ;Store destination as destposition move.l d2,d4 ;Store destination in D4 move.l d3,d7 ;Store length as StillToDo move.l d1,a4 ;Store filehandle in A4 loop: move.l Buffer,d2 move.l BufSize,d3 move.l a5,a6 ;Get DOSBase from A5 move.l a4,d1 ;Get filehandle from a4 oldd: jsr $00000000 ;Read(d1:fh,d2:buf,d3:len) move.l d0,d5 move.l 4,a6 ;SysBase move.l d2,a0 move.l d6,a1 ;Copy to destposition jsr -$270(a6) ;CopyMem(S:a0,D:a1,L:d0) cmp.l BufSize,d5 bne.s Exit add.l BufSize,d6 ;destposition+=BufSize sub.l BufSize,d7 ;StillToDo-=BufSize cmp.l BufSize,d7 ;BufSize