; this is the patches installation code ; last update 04/06/2004 TestProcessor: move.l #uerr,errorbuf movea.l 4.w,a6 move.l a6,_SysBase lea dosname,a1 moveq.l #37,d0 jsr _LVOOpenLibrary(a6) tst.l d0 beq.w FATAL move.l d0,_DOSBase movea.l d0,a6 move.l #template,d1 move.l #_opt0,d2 moveq.l #NULL,d3 jsr _LVOReadArgs(a6) move.l #errorstr1,errorbuf tst.l d0 beq.w FAIL move.l d0,d1 jsr _LVOFreeArgs(a6) jsr _findport tst.l d0 bne.w OK jsr _createport tst.l _opt0 bne.b .noverstr move.l #VersionStr,d1 jsr _LVOPutStr(a6) .noverstr: jsr _GetOpts ;gets FAllocRaster() prefs tst.l opt1 beq.b .do tst.l opt2 beq.b .do tst.l opt3 beq.b .do tst.l opt4 beq.b .do tst.l opt6 bne.w OK .do move.l #errorstr2,errorbuf movea.l 4.w,a6 btst #AFB_68020,AttnFlags+1(a6) beq.w FAIL tst.l opt5 bne.w MMUInstall AllocMem: move.l #MEMF_FAST|MEMF_PUBLIC|MEMF_CLEAR,d1 move.l #EndPatch-StartPatch+15,d0 jsr _LVOAllocMem(a6) move.l #errorstr3,errorbuf move.l d0,d6 beq.w FAIL CopyPatch: addi.l #15,d6 andi.b #%11110000,d6 move.l d6,MemForPatch movea.l d6,a1 cp2: lea StartPatch,a0 move.l #EndPatch-StartPatch,d0 jsr _LVOCopyMemQuick(a6) movea.l a6,a1 movea.l MemForPatch,a4 move.l a1,PExecBase-StartPatch(a4) OpenQuickLayers: tst.l opt6 bne.b PatchUtility lea quicklayersname,a1 moveq.l #0,d0 jsr _LVOOpenLibrary(a6) move.l #errorstr5,errorbuf tst.l d0 beq.w FAIL2 tst.l _opt0 bne.b PatchUtility movea.l _DOSBase,a6 move.l #InstalledLayers,d1 jsr _LVOPutStr(a6) movea.l 4.w,a6 PatchUtility: bsr.w Utility PatchGraphics: tst.l opt3 bne.w PatchExec lea graphname,a1 moveq.l #39,d0 jsr _LVOOpenLibrary(a6) move.l #errorstr4,errorbuf move.l d0,GFXBase beq.w FAIL2 movea.l MemForPatch,a4 move.l d0,PGfxBase-StartPatch(a4) bsr.w PrepareP2C movea.l GFXBase,a1 jsr _LVOForbid(a6) tst.l gopt1 bne.b .1 PATCH WaitBlit .1: tst.l gopt2 bne.b .2 PATCH QBlit .2: tst.l gopt3 bne.b .3 PATCH WaitTOF .3: tst.l gopt4 bne.b .4 PATCH RectFill .4: tst.l gopt5 bne.b .5 PATCH SetAPen .5: tst.l gopt6 bne.b .6 PATCH SetBPen .6: tst.l gopt7 bne.b .7 PATCH SetDrMd .7: tst.l gopt8 bne.b .8 PATCH OwnBlitter .8: tst.l gopt9 bne.b .9 PATCH DisownBlitter .9: tst.l gopt10 bne.b .10 PATCH SetABPenDrMd .10: tst.l gopt11 bne.b .11 PATCH WritePixel .11: tst.l gopt12 bne.b .12 PATCH LockLayerRom .12: tst.l gopt13 bne.b .13 PATCH UnlockLayerRom .13: tst.l gopt14 bne.b .14 PATCH WritePixelLine8 .14: tst.l gopt15 bne.b .15 PATCH WritePixelArray8 .15: tst.l gopt16 bne.b .16 PATCH WriteChunkyPixels .16: tst.l gopt17 bne.b .17 PATCH ReadPixelLine8 .17: tst.l gopt21 bne.b .18 PATCH InitArea .18: tst.l gopt22 bne.b .22 PATCH GetBitMapAttr .22: tst.l gopt23 bne.b .23 PATCH ClearRegion .23: tst.l gopt24 bne.b .24 PATCH DisposeRegion .24: tst.l gopt26 bne.b .27 PATCH AddBob .27: tst.l gopt27 bne.b .28 PATCH ClearEOL .28: tst.l gopt28 bne.b .29 PATCH ClearScreen .29: tst.l gopt29 bne.b .30 PATCH TextLength .30: tst.l gopt30 bne.b .31 PATCH SetFont .31: tst.l gopt31 bne.b .32 PATCH InitRastPort .32: tst.l gopt34 bne.b .cc moveq.l #20,d0 move.l #MEMF_FAST|MEMF_PUBLIC|MEMF_CLEAR,d1 jsr _LVOAllocMem(a6) tst.l d0 beq.b .cc movea.l MemForPatch,a4 move.l d0,table-StartPatch(A4) movea.l GFXBase,a1 PATCH SetRGB32 .cc: jsr _LVOCacheClearU(a6) jsr _LVOPermit(a6) tst.l _opt0 bne.b .Checks movea.l _DOSBase,a6 move.l #InstalledGfx,d1 jsr _LVOPutStr(a6) movea.l 4.w,a6 .Checks: jsr _LVOForbid(a6) bsr.w FBlitCheck tst.l gopt18 bne.b .19 bsr.w BltClearCheck .19: jsr _LVOCacheClearU(a6) jsr _LVOPermit(a6) CloseGraphics: movea.l GFXBase,a1 jsr _LVOCloseLibrary(a6) PatchExec: tst.l opt2 bne.w intrs bsr.w FasterForbid jsr _LVOForbid(a6) movea.l a6,a1 tst.l exopt1 bne.b .1 PATCH Schedule .1: tst.l exopt2 bne.b .2 PATCH Reschedule .2: tst.l exopt3 bne.b .3 PATCH PutMsg .3: tst.l exopt4 bne.b .4 PATCH ReplyMsg .4: tst.l exopt5 bne.b .5 PATCH Enqueue .5: tst.l exopt6 bne.b .6 PATCH Signal .6: tst.l exopt7 bne.b .7 PATCH SetSignal .7: tst.l exopt8 bne.b .8 PATCH ExitIntr .8: tst.l exopt9 bne.b .9 PATCH Dispatch .9: tst.l exopt10 bne.b .10 PATCH Cause .10: tst.l exopt11 bne.b .11 PATCH Exception .11: tst.l exopt12 bne.b .12 PATCH Wait .12: tst.l exopt13 bne.b .13 PATCH InitSemaphore .13: tst.l exopt14 bne.b .14 PATCH AddSemaphore .14: tst.l exopt15 bne.b .15 PATCH ReleaseSemaphore .15: tst.l exopt16 bne.b .16 PATCH AddPort .16: tst.l exopt17 bne.b .17 PATCH WaitPort .17: tst.l exopt18 bne.b .18 PATCH RemPort .18: tst.l exopt19 bne.b .19 PATCH RemSemaphore .19: tst.l exopt20 bne.b .20 PATCH RemResource .20: tst.l exopt21 bne.b .21 PATCH SetExcept .21: tst.l exopt22 bne.b .22 PATCH Insert .22: tst.l exopt23 bne.b .23 PATCH AddHead .23: tst.l exopt24 bne.b .24 PATCH Remove .24: tst.l exopt25 bne.b .25 PATCH RemHead .25: tst.l exopt26 bne.b .26 PATCH RemTail .26: tst.l exopt28 bne.b .28 PATCH GetMsg .28: tst.l exopt29 bne.b .29 PATCH DoIO .29: tst.l exopt30 bne.b .30 PATCH WaitIO .30: jsr _LVOCacheClearU(a6) jsr _LVOPermit(a6) tst.l _opt0 bne.b .testswitch movea.l _DOSBase,a6 move.l #InstalledExec,d1 jsr _LVOPutStr(a6) movea.l 4.w,a6 .testswitch tst.l exopt27 bne.b intrs bsr.w SwitchCheck intrs: tst.l opt1 bne.b EXIT bsr.w AutoInterrupt jsr _LVODisable(a6) movea.l MemForPatch,a0 adda.l #BLIT-StartPatch,a0 move.l a0,IVBLIT+IV_CODE(a6) jsr _LVOCacheClearU(a6) jsr _LVOEnable(a6) tst.l _opt0 bne.b EXIT movea.l _DOSBase,a6 move.l #InstalledInts,d1 jsr _LVOPutStr(a6) movea.l 4.w,a6 EXIT: bra.b ProtectMem cnop 0,4 OK: movea.l 4.w,a6 movea.l _DOSBase,a1 jsr _LVOCloseLibrary(a6) moveq.l #RETURN_OK,d0 rts cnop 0,4 PrepareP2C: ; a4 must contain MemForPatch move.l d0,a0 move.l gb_LayersBase(a0),PLayersBase-StartPatch(a4) * makes the bitspread table * make_table: movea.l a4,a1 adda.l #p2c-StartPatch,a1 move.l d2,a0 moveq #0,d0 more_table move.b d0,d1 moveq #8-1,d2 byteloop btst #7,d1 beq.s zero move.b #1,(a1)+ bra.s one cnop 0,4 zero clr.b (a1)+ one add.b d1,d1 dbra d2,byteloop addq #1,d0 cmp.w #256,d0 bne.b more_table table_made move.l a0,d2 rts cnop 0,4