XREF _custom ; write this from scratch and get it working ; then plug it into C FUNC_CNT SET -30 FUNCDEF MACRO _LVO\1 EQU FUNC_CNT FUNC_CNT SET FUNC_CNT-6 ENDM INCDIR "include_i_39:" INCDIR "extra_lvos_39:" INCLUDE "exec/exec_lib.i" INCLUDE "exec/types.i" INCLUDE "exec/execbase.i" INCLUDE "exec/libraries.i" # get the CALLLIB macro INCLUDE "graphics/gfxbase.i" INCLUDE "graphics_lvo.i" INCLUDE "hardware/custom.i" INCLUDE "hardware/dmabits.i" START: BSR _takeOverSystem BSR _giveBackSystem MOVE.L #0,D0 RTS OpenGraphicsLibrary MACRO LEA GraphicsLibrary,A1 MOVEQ #0,D0 CALLLIB _LVOOpenLibrary MOVE.L D0,GraphicsBase ENDM TakeOverView MACRO MOVE.L GraphicsBase,A6 MOVE.L gb_ActiView(A6),OldView MOVEQ #0,D0 CALLLIB _LVOLoadView CALLLIB _LVOWaitTOF CALLLIB _LVOWaitTOF ENDM PreserveOldCopper MACRO MOVE.L $26(A6),OldCopper1 MOVE.L $32(A6),OldCopper2 ENDM GetVBRPointer MACRO BSR getVBR MOVE.L D0,VBRPtr ENDM PreserveOldRegisters MACRO LEA _custom,A6 MOVE.W adkconr(A6),Oldadkcon MOVE.W intenar(A6),Oldintena MOVE.W dmaconr(A6),Olddmacon ENDM ClearRegisters MACRO MOVE.W #$7FFF,D0 BSR waitRaster MOVE.W D0,intena(A6) MOVE.W D0,dmacon(A6) MOVE.W D0,intreq(A6) ENDM SetRegisters MACRO MOVE.W #$C000,intena(A6) ; enable master interrupt MOVE.W #$3FFF,intena(A6) ; disable every other interrupt MOVE.W #DMAF_SETCLR|DMAF_COPPER|DMAF_RASTER|DMAF_BLITTER,dmacon(A6) MOVE.W #DMAF_AUDIO|DMAF_DISK|DMAF_SPRITE,dmacon(A6) ENDM _takeOverSystem: MOVEM.L A6,-(SP) CLR.W $100 MOVE.L $4,A6 CALLLIB _LVOForbid OpenGraphicsLibrary PreserveOldCopper CALLLIB _LVOOwnBlitter CALLLIB _LVOWaitBlit PreserveOldRegisters SetRegisters TakeOverView MOVEM.L (SP)+,A6 RTS waitRaster: MOVE.L D0,-(SP) .loop: MOVE.L $DFF004,D0 AND.L #$1FF00,D0 CMP.L #303<<8,D0 BNE .loop MOVE.L (SP)+,D0 RTS _giveBackSystem: CLR.W $100 MOVEM.L A6,-(SP) LEA _custom,A6 MOVE.W #$8000,d0 OR.W D0,Olddmacon OR.W D0,Oldintena OR.W D0,Oldadkcon SUBQ #1,D0 ;ClearRegisters MOVE.L OldCopper1,cop1lc(A6) MOVE.L OldCopper2,cop2lc(A6) MOVE.W #1,copjmp1(A6) MOVE.W Olddmacon,intena(A6) MOVE.W Olddmacon,dmacon(A6) MOVE.W Oldadkcon,adkcon(A6) MOVE.L OldView,A1 MOVE.L GraphicsBase,A6 CALLLIB _LVOLoadView CALLLIB _LVOWaitTOF CALLLIB _LVOWaitTOF MOVE.L $4,A6 MOVE.L GraphicsBase,D0 MOVE.L D0,A1 CALLLIB _LVOCloseLibrary CALLLIB _LVOPermit MOVEM.L (SP)+,A6 RTS getVBR: MOVE.L A5,-(SP) MOVEQ #0,D0 MOVE.L $4,A6 BTST #0,AttnFlags+1(A6) BEQ .is68K LEA .get010VBR(pc),A5 CALLLIB _LVOSupervisor .is68K: MOVE.L (SP)+,A5 RTS .get010VBR: dc.l $4E7A0801 ; movec vcr,d0 RTE CNOP 0,4 GraphicsLibrary dc.b 'graphics.library',0 CNOP 0,4 GraphicsBase dc.l 1 OldView dc.l 1 OldCopper1 dc.l 1 OldCopper2 dc.l 1 VBRPtr dc.l 1 Oldadkcon dc.w 0 Oldintena dc.w 0 Olddmacon dc.w 0