Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- SECTION GDM_COPPER_MOVE_V0,CODE
- SYS_DISABLETSK = -$78
- SYS_ENABLETSK = -$7e
- SYS_OPENLIB = -$198
- SYS_CLOSELIB = -$19e
- SYS_GETCOPPER = $26
- COLUMN_WIDTH = 12 ; Must be even
- BAR_HEIGHT = 15
- COLOR_G = $010 ; $RGB
- COLOR_D = $001 ; $RGB
- COLOR_M = $100 ; $RGB
- RST_START = $1d ; $1d
- COL_START = $07
- BAR_01 = RST_START+BAR_HEIGHT
- BAR_02 = BAR_01+BAR_HEIGHT
- BAR_03 = BAR_02+BAR_HEIGHT
- BAR_04 = BAR_03+BAR_HEIGHT
- BAR_05 = BAR_04+BAR_HEIGHT
- BAR_06 = BAR_05+BAR_HEIGHT
- BAR_07 = BAR_06+BAR_HEIGHT
- COLUMN_01 = COL_START+COLUMN_WIDTH ; Must be Odd
- COLUMN_02 = COLUMN_01+COLUMN_WIDTH
- COLUMN_03 = COLUMN_02+COLUMN_WIDTH
- COLUMN_04 = COLUMN_03+COLUMN_WIDTH
- COLUMN_05 = COLUMN_04+COLUMN_WIDTH
- COLUMN_06 = COLUMN_05+COLUMN_WIDTH
- COLUMN_07 = COLUMN_06+COLUMN_WIDTH
- COLUMN_08 = COLUMN_07+COLUMN_WIDTH
- COLUMN_09 = COLUMN_08+COLUMN_WIDTH
- COLUMN_10 = COLUMN_09+COLUMN_WIDTH
- COLUMN_11 = COLUMN_10+COLUMN_WIDTH
- COLUMN_12 = COLUMN_11+COLUMN_WIDTH
- COLUMN_13 = COLUMN_12+COLUMN_WIDTH
- COLUMN_14 = COLUMN_13+COLUMN_WIDTH
- RASTER_COUNT = 62 ; Number of movements
- COPPER_VELOCITY = 2 ; number of raster line to skip from a frame to another must be even
- RASTER_XCOUNT = 50 ; Number of x movements
- Start:
- move.l 4.w,a6 ; Retrieve base address for system's routine, store it into a6
- jsr SYS_DISABLETSK(a6) ; Disable multitasking
- lea GfxName(PC),a1 ; Retrieve library string's address to open ...
- jsr SYS_OPENLIB(a6) ; ... Open the library and save address to d0
- move.l d0,GfxBase ; Save address to GfxBase
- move.l d0,a6 ; ... copy to a6
- move.l SYS_GETCOPPER(a6),SystemCopper ; Get system copper address and save it to SystemCopper
- move.l #CustomCopperList,$dff080 ; Place custom copper list's address and store it to actual copper registry
- move.w d0,$dff088 ; activate the new custom copper list
- move.b #RASTER_COUNT,GfxCopperCounter ; Set movements counter
- move.l #COPPER_VELOCITY,GfxCopperDir
- move.b #RASTER_XCOUNT,GfxXCounter ; Set movements counter
- move.l #2,GfxXDir
- Main_Loop:
- cmpi.b #$ff,$dff006 ; compare actual raster line with 255
- bne.s Main_Loop ; ... if actual raster line isn't 255 wait for it ...
- sub.b #1,GfxCopperCounter ; Subtract 1 from movements counter
- bne ChangeCopperX ; MoveCopper if counter is not 0 ...
- bsr MoveCopper_ChangeYDir; else .... if counter has reached 0 then change dir
- ChangeCopperX
- sub.b #1,GfxXCounter ; Subtract 1 from movements counter
- bne MoveCopper ; MoveCopper if counter is not 0 ...
- bsr MoveCopper_ChangeXDir; else .... if counter has reached 0 then change dir
- MoveCopper:
- jsr MoveCopper_Forward ; Move copper according to GfxCopperDir
- MoveCopper_End:
- btst #6,$bfe001 ; left mouse button is pressed ? ...
- bne.s Main_Loop
- ; ... else exit from program ...
- move.l SystemCopper(PC),$dff080 ; Get saved system copper list ...
- move.w d0,$dff088 ; and reactivate it
- move.l 4.w,a6 ; Retrieve base address for system's routine, store it into a6
- jsr SYS_ENABLETSK(a6) ; Enable multitastink again
- move.l GfxBase(PC),a1 ; get graphic library saved address and store it to a1
- jsr SYS_CLOSELIB(a6) ; close the graphic library
- rts
- MoveCopper_ChangeYDir
- subq.l #1,GfxCopperDir ; 2 Complements
- eori.l #$ffffffff,GfxCopperDir ; Invert Sign of GfxCopperDir (+1/-1)
- move.b #RASTER_COUNT,GfxCopperCounter ; Re-Set movements counter
- rts
- MoveCopper_ChangeXDir
- subq.l #1,GfxXDir ; 2 Complements
- eori.l #$ffffffff,GfxXDir ; Invert Sign of GfxXDir (+1/-1)
- move.b #RASTER_XCOUNT,GfxXCounter ; Re-Set movements counter
- rts
- MoveCopper_Forward: ; Move Copper list According to GfxCopperDir
- lea Bars,a0 ; Load into a0 Entire Address of copper list bars definition
- move.l GfxCopperDir,d0 ; store into d0 the direction of YY copper
- move.l GfxXDir,d1 ; store into d1 the direction of XX copper
- rept 72*BAR_HEIGHT+1 ; assembler repetive directive 72 is the numbers of total consecutive waits on copper list
- add.b d0,(REPTN-1)*8(a0) ; Change YY add GfxCopperDir Byte for every line defined on copper list
- add.b d1,(REPTN-1)*8+1(a0); Change XX add GfxXCopperDir Byte for every line defined on copper list
- tst.w (REPTN-1)*8+6(a0)
- beq.s *+6
- addq.w #8,(REPTN-1)*8+6(a0); Change colors ....
- endr
- rts
- GfxCopperCounter:
- dc.b 0,0
- GfxCopperDir:
- dc.w 0
- dc.w 0
- GfxXCounter:
- dc.b 0,0
- GfxXDir:
- dc.w 0
- dc.w 0
- GfxName:
- dc.b "graphics.library",0,0
- GfxBase: ; Address for graphic library base address
- dc.l 0
- SystemCopper: ; Address of system copper list
- dc.l 0
- SECTION GRAPHIC,DATA_C
- CustomCopperList:
- dc.w $100,$200 ; BPLCON0 Only color 0
- dc.w $180,$000 ; COLOR0 - Start with black
- ; $1b is the first visible raster line
- ; $33 is the first pixel visible column (** odd coordinates only!! **)
- ; Wait : YYXX,$fffe
- ; Assign color 0: $180,Color ($180 stand for $dff180)
- ; G G D D M M 1 8
- ;G D D M M M M 2 10
- ;G D D M M M 3 12
- ;G D D M M 4 10
- ;G G G D D M M 5 12
- ;G G D D M M 6 12
- ; G G D D M M 7 8
- ; 72
- ;1 2 3 4 5 6 7 8 9 0 1 2 3 4
- Bars:
- ; Bar 1 8 Waits
- rept BAR_HEIGHT
- dc.b RST_START+REPTN-1
- dc.b COLUMN_01
- dc.w $fffe ; wait ....
- dc.w $180,COLOR_G+(REPTN)*16 ; Color
- dc.b RST_START+REPTN-1
- dc.b COLUMN_03
- dc.w $fffe
- dc.w $180,$000
- dc.b RST_START+REPTN-1
- dc.b COLUMN_05
- dc.w $fffe ; wait ....
- dc.w $180,COLOR_D+(REPTN) ; Color
- dc.b RST_START+REPTN-1
- dc.b COLUMN_07
- dc.w $fffe
- dc.w $180,$000
- dc.b RST_START+REPTN-1
- dc.b COLUMN_09
- dc.w $fffe ; wait ....
- dc.w $180,COLOR_M+(REPTN)*256 ; Color
- dc.b RST_START+REPTN-1
- dc.b COLUMN_10
- dc.w $fffe
- dc.w $180,$000
- dc.b RST_START+REPTN-1
- dc.b COLUMN_13
- dc.w $fffe ; wait ....
- dc.w $180,COLOR_M+(REPTN)*256 ; Color
- dc.b RST_START+REPTN-1
- dc.b COLUMN_14
- dc.w $fffe
- dc.w $180,$000
- endr
- ; Bar 2 10 Waits
- rept BAR_HEIGHT
- dc.b BAR_01+REPTN-1
- dc.b COL_START
- dc.w $fffe ; wait ....
- dc.w $180,COLOR_G+(REPTN)*16 ; Color
- dc.b BAR_01+REPTN-1
- dc.b COLUMN_01
- dc.w $fffe
- dc.w $180,$000
- dc.b BAR_01+REPTN-1
- dc.b COLUMN_05
- dc.w $fffe ; wait ....
- dc.w $180,COLOR_D+(REPTN) ; Color
- dc.b BAR_01+REPTN-1
- dc.b COLUMN_06
- dc.w $fffe
- dc.w $180,$000
- dc.b BAR_01+REPTN-1
- dc.b COLUMN_07
- dc.w $fffe ; wait ....
- dc.w $180,COLOR_D+(REPTN) ; Color
- dc.b BAR_01+REPTN-1
- dc.b COLUMN_08
- dc.w $fffe
- dc.w $180,$000
- dc.b BAR_01+REPTN-1
- dc.b COLUMN_09
- dc.w $fffe ; wait ....
- dc.w $180,COLOR_M+(REPTN)*256 ; Color
- dc.b BAR_01+REPTN-1
- dc.b COLUMN_11
- dc.w $fffe
- dc.w $180,$000
- dc.b BAR_01+REPTN-1
- dc.b COLUMN_12
- dc.w $fffe ; wait ....
- dc.w $180,COLOR_M+(REPTN)*256 ; Color
- dc.b BAR_01+REPTN-1
- dc.b COLUMN_14
- dc.w $fffe
- dc.w $180,$000
- endr
- ; Bar 3 12 Waits
- rept BAR_HEIGHT
- dc.b BAR_02+REPTN-1
- dc.b COL_START
- dc.w $fffe ; wait ....
- dc.w $180,COLOR_G+(REPTN)*16 ; Color
- dc.b BAR_02+REPTN-1
- dc.b COLUMN_01
- dc.w $fffe
- dc.w $180,$000
- dc.b BAR_02+REPTN-1
- dc.b COLUMN_05
- dc.w $fffe ; wait ....
- dc.w $180,COLOR_D+(REPTN) ; Color
- dc.b BAR_02+REPTN-1
- dc.b COLUMN_06
- dc.w $fffe
- dc.w $180,$000
- dc.b BAR_02+REPTN-1
- dc.b COLUMN_07
- dc.w $fffe ; wait ....
- dc.w $180,COLOR_D+(REPTN) ; Color
- dc.b BAR_02+REPTN-1
- dc.b COLUMN_08
- dc.w $fffe
- dc.w $180,$000
- dc.b BAR_02+REPTN-1
- dc.b COLUMN_09
- dc.w $fffe ; wait ....
- dc.w $180,COLOR_M+(REPTN)*256 ; Color
- dc.b BAR_02+REPTN-1
- dc.b COLUMN_10
- dc.w $fffe
- dc.w $180,$000
- dc.b BAR_02+REPTN-1
- dc.b COLUMN_11
- dc.w $fffe ; wait ....
- dc.w $180,COLOR_M+(REPTN)*256 ; Color
- dc.b BAR_02+REPTN-1
- dc.b COLUMN_12
- dc.w $fffe
- dc.w $180,$000
- dc.b BAR_02+REPTN-1
- dc.b COLUMN_13
- dc.w $fffe ; wait ....
- dc.w $180,COLOR_M+(REPTN)*256 ; Color
- dc.b BAR_02+REPTN-1
- dc.b COLUMN_14
- dc.w $fffe
- dc.w $180,$000
- endr
- ; Bar 4 10 Waits
- rept BAR_HEIGHT
- dc.b BAR_03+REPTN-1
- dc.b COL_START
- dc.w $fffe ; wait ....
- dc.w $180,COLOR_G+(REPTN)*16 ; Color
- dc.b BAR_03+REPTN-1
- dc.b COLUMN_01
- dc.w $fffe
- dc.w $180,$000
- dc.b BAR_03+REPTN-1
- dc.b COLUMN_05
- dc.w $fffe ; wait ....
- dc.w $180,COLOR_D+(REPTN) ; Color
- dc.b BAR_03+REPTN-1
- dc.b COLUMN_06
- dc.w $fffe
- dc.w $180,$000
- dc.b BAR_03+REPTN-1
- dc.b COLUMN_07
- dc.w $fffe ; wait ....
- dc.w $180,COLOR_D+(REPTN) ; Color
- dc.b BAR_03+REPTN-1
- dc.b COLUMN_08
- dc.w $fffe
- dc.w $180,$000
- dc.b BAR_03+REPTN-1
- dc.b COLUMN_09
- dc.w $fffe ; wait ....
- dc.w $180,COLOR_M+(REPTN)*256 ; Color
- dc.b BAR_03+REPTN-1
- dc.b COLUMN_10
- dc.w $fffe
- dc.w $180,$000
- dc.b BAR_03+REPTN-1
- dc.b COLUMN_13
- dc.w $fffe ; wait ....
- dc.w $180,COLOR_M+(REPTN)*256 ; Color
- dc.b BAR_03+REPTN-1
- dc.b COLUMN_14
- dc.w $fffe
- dc.w $180,$000
- endr
- ; Bar 5 12 Waits
- rept BAR_HEIGHT
- dc.b BAR_04+REPTN-1
- dc.b COL_START
- dc.w $fffe ; wait ....
- dc.w $180,COLOR_G+(REPTN)*16 ; Color
- dc.b BAR_04+REPTN-1
- dc.b COLUMN_01
- dc.w $fffe
- dc.w $180,$000
- dc.b BAR_04+REPTN-1
- dc.b COLUMN_02
- dc.w $fffe ; wait ....
- dc.w $180,COLOR_G+(REPTN)*16 ; Color
- dc.b BAR_04+REPTN-1
- dc.b COLUMN_04
- dc.w $fffe
- dc.w $180,$000
- dc.b BAR_04+REPTN-1
- dc.b COLUMN_05
- dc.w $fffe ; wait ....
- dc.w $180,COLOR_D+(REPTN) ; Color
- dc.b BAR_04+REPTN-1
- dc.b COLUMN_06
- dc.w $fffe
- dc.w $180,$000
- dc.b BAR_04+REPTN-1
- dc.b COLUMN_07
- dc.w $fffe ; wait ....
- dc.w $180,COLOR_D+(REPTN) ; Color
- dc.b BAR_04+REPTN-1
- dc.b COLUMN_08
- dc.w $fffe
- dc.w $180,$000
- dc.b BAR_04+REPTN-1
- dc.b COLUMN_09
- dc.w $fffe ; wait ....
- dc.w $180,COLOR_M+(REPTN)*256 ; Color
- dc.b BAR_04+REPTN-1
- dc.b COLUMN_10
- dc.w $fffe
- dc.w $180,$000
- dc.b BAR_04+REPTN-1
- dc.b COLUMN_13
- dc.w $fffe ; wait ....
- dc.w $180,COLOR_M+(REPTN)*256 ; Color
- dc.b BAR_04+REPTN-1
- dc.b COLUMN_14
- dc.w $fffe
- dc.w $180,$000
- endr
- ; Bar 6 13 Waits
- rept BAR_HEIGHT
- dc.b BAR_05+REPTN-1
- dc.b COL_START
- dc.w $fffe ; wait ....
- dc.w $180,COLOR_G+(REPTN)*16 ; Color
- dc.b BAR_05+REPTN-1
- dc.b COLUMN_01
- dc.w $fffe
- dc.w $180,$000
- dc.b BAR_05+REPTN-1
- dc.b COLUMN_03
- dc.w $fffe ; wait ....
- dc.w $180,COLOR_G+(REPTN)*16 ; Color
- dc.b BAR_05+REPTN-1
- dc.b COLUMN_04
- dc.w $fffe
- dc.w $180,$000
- dc.b BAR_05+REPTN-1
- dc.b COLUMN_05
- dc.w $fffe ; wait ....
- dc.w $180,COLOR_D+(REPTN) ; Color
- dc.b BAR_05+REPTN-1
- dc.b COLUMN_06
- dc.w $fffe
- dc.w $180,$000
- dc.b BAR_05+REPTN-1
- dc.b COLUMN_07
- dc.w $fffe ; wait ....
- dc.w $180,COLOR_D+(REPTN) ; Color
- dc.b BAR_05+REPTN-1
- dc.b COLUMN_08
- dc.w $fffe
- dc.w $180,$000
- dc.b BAR_05+REPTN-1
- dc.b COLUMN_09
- dc.w $fffe ; wait ....
- dc.w $180,COLOR_M+(REPTN)*256 ; Color
- dc.b BAR_05+REPTN-1
- dc.b COLUMN_10
- dc.w $fffe
- dc.w $180,$000
- dc.b BAR_05+REPTN-1
- dc.b COLUMN_13
- dc.w $fffe ; wait ....
- dc.w $180,COLOR_M+(REPTN)*256 ; Color
- dc.b BAR_05+REPTN-1
- dc.b COLUMN_14
- dc.w $fffe
- dc.w $180,$000
- endr
- ; Bar 7 8 Waits
- rept BAR_HEIGHT
- dc.b BAR_06+REPTN-1
- dc.b COLUMN_01
- dc.w $fffe ; wait ....
- dc.w $180,COLOR_G+(REPTN)*16 ; Color
- dc.b BAR_06+REPTN-1
- dc.b COLUMN_03
- dc.w $fffe
- dc.w $180,$000
- dc.b BAR_06+REPTN-1
- dc.b COLUMN_05
- dc.w $fffe ; wait ....
- dc.w $180,COLOR_D+(REPTN) ; Color
- dc.b BAR_06+REPTN-1
- dc.b COLUMN_07
- dc.w $fffe
- dc.w $180,$000
- dc.b BAR_06+REPTN-1
- dc.b COLUMN_09
- dc.w $fffe ; wait ....
- dc.w $180,COLOR_M+(REPTN)*256 ; Color
- dc.b BAR_06+REPTN-1
- dc.b COLUMN_10
- dc.w $fffe
- dc.w $180,$000
- dc.b BAR_06+REPTN-1
- dc.b COLUMN_13
- dc.w $fffe ; wait ....
- dc.w $180,COLOR_M+(REPTN)*256 ; Color
- dc.b BAR_06+REPTN-1
- dc.b COLUMN_14
- dc.w $fffe
- dc.w $180,$000
- endr
- dc.b BAR_06+BAR_HEIGHT
- dc.b COL_START
- dc.w $fffe ; wait ....
- dc.w $180,$000 ; Color
- dc.w $FFFF,$FFFE ; End Of Custom Copper List
- end
Add Comment
Please, Sign In to add comment