ExecBase = 4 OpenLib = -552 CloseLib = -414 SysCopper = 38 CUSTOM = $DFF000 DMACONR = $002 DMACON = $096 VPOSR = $004 COP1LCH = $080 COPJMP1 = $088 COLOR00 = $180 ********* INIT ************************************ run: move.l ExecBase,a6 ; get the addres of the graphics libary move.l #gfxname,a1 clr.l d0 jsr OpenLib(a6) tst.l d0 beq end move.l d0,gfxbase ; and save clr.l d0 ; get the address of the system copper move.l gfxbase,a6 move.l SysCopper(a6),d0 tst.l d0 beq end move.l d0,oldcopper ; and save lea CUSTOM,a6 ; move the base to a6 move.w DMACONR(a6),olddma ; save the current dma state ; from DMACONR move.w #$7FFF,DMACON(a6) ; deactivate all DMA channels move.w #$8280,DMACON(a6) ; activate only the copper DMA chanel move.l #copper,COP1LCH(a6) ; move new copper to copper register move.w #0,COPJMP1(a6) ; (H and L) & activate new copper ********* MAIN ************************************ main: bsr waitVBI ; wait for the vertical blanc ; before updating the screen lea copperbar,a0 ; save the copperbar address move.w #9-1,d7 ; set the conter for the number ; of lines to move loop: add.b #$01,(a0) ; increase the wait position by one add.l #$08,a0 ; increase a0 to point to next ; wait instruction dbf d7,loop ; branche, decrease, test zero btst #6,$BFE001 ; is lmb prssed bne main ; 0 = pressed ********* EXIT ************************************ clean: move.l Execbase,a6 ; close graphics library move.l gfxbase,a1 jsr CloseLib(a6) end: lea CUSTOM,a6 move.l oldcopper,COP1LCH(a6) ; restore system copper or.w #$8200,olddma ; set bits 15 and 9 move.w olddma,DMACON(a6) ; retore old DMA to DMACON rts ********* ROUTINES *********************************** waitVBI: move.l $DFF004,d0 ; get VPOSR lsr.l #8,d0 ; shift 8 to left and.l #$1FF,d0 ; mask out the 9bits of vpos cmp.l #$138,d0 ; are we at VBI bne waitVBI ; no -> wait rts waitraster: ; expects line to wait for in d1.w move.l $DFF004,d0 ; get VPOSR lsr.l #8,d0 ; shift 8 to left and.l #$1FF,d0 ; mask out the 9bits of vpos cmp.l d1,d0 ; are we at the wanted line bne waitraster ; no -> wait rts ********* DATA in FAST MEM ************************ gfxname: dc.b 'graphics.library',0 even gfxbase: ds.l 1 oldcopper: ds.l 1 olddma: ds.l 1 ********* DATA in CHIP MEM ************************ section copperlist,data_C copper: dc.w $100,$0200 dc.w $1B07,$FFFE dc.w $180,$000 copperbar: dc.w $6407,$FFFE dc.w $180,$555 dc.w $6507,$FFFE dc.w $180,$999 dc.w $6607,$FFFE dc.w $180,$CCC dc.w $6707,$FFFE dc.w $180,$FFF dc.w $6807,$FFFE dc.w $180,$FFF dc.w $6907,$FFFE dc.w $180,$CCC dc.w $6A07,$FFFE dc.w $180,$999 dc.w $6B07,$FFFE dc.w $180,$555 dc.w $6C07,$FFFE dc.w $180,$000 dc.w $FFFF,$FFFE