View Single Post
Old 08 November 2021, 18:11   #16
LaBodilsen
Registered User
 
Join Date: Dec 2017
Location: Denmark
Posts: 179
Quote:
Originally Posted by geldo79 View Post
Ok thanks, working now (see image). But, now i would be glad if somebody could explain this a bit to a dummy like me

What does the
Code:
        dc.w $0084,$0000,$0086,$0000
do? I guess these are the COPL2C/COPL2H registers. But why do i write 0 to them in my copperlist?
The 0 values, are only placeholders, they are not used, but gets replaced by the init code.

Quote:
And how does this init work? How does the copperlist know where to jump?Where does the copperlist distinguish between Copper_Line1,Copper_Line9,Copper_Line17 ? I see that somehow, the addresses of my marks are written to the COP2LC/COP2LH registers here. But there is only one COPL2C/COPL2H....why does this work with more than one mark?

Code:
        lea.l	Copper_Line1-2,a0	
	move.l	#Copper_Line1,d0	
	move.w	d0,(a0)			
	swap	d0					
	move.w	d0,-4(a0)
	
	lea.l	Copper_Line9-2,a0	
	move.l	#Copper_Line9,d0
	move.w	d0,(a0)
	swap	d0
	move.w	d0,-4(a0)
	
	lea.l	Copper_Line17-2,a0	
	move.l	#Copper_Line17,d0
	move.w	d0,(a0)
	swap	d0
	move.w	d0,-4(a0)
This part replaces the 0 values in the copper with the actual adress values for the different jumps in the copper. eg. Copper_Line1, 9 and 17.

It works with more than one mark, because copl2c+copl2h is pressent 3 times in the copperlist, one time for each segment.


It works by:
Code:
-- Wait for firstline of segment --
        dc.w $2c07,$FFFE
-- load copper 2 address with values set by init (copper_line1) --
	dc.w $0084,$0000,$0086,$0000		

Copper_Line1:
-- Wait for horizontal start of segment --
	dc.w $003f,$80fe
-- Spam colors --
	dc.w $0182,$0000,$0182,$0000,$0182,$0000,$0182,$0000,$0182,$0001,$0182,$0002,$0182,$0003,$0182,$0004,$0182,$0005,$0182,$0006
	dc.w $0182,$0007,$0182,$0008,$0182,$0009,$0182,$000a,$0182,$000b,$0182,$000c,$0182,$000d,$0182,$000e,$0182,$000f,$0182,$000f
	dc.w $0182,$000e,$0182,$000d,$0182,$000c,$0182,$000b, $0182,$000a,$0182,$0009,$0182,$0008,$0182,$0007,$0182,$0006,$0182,$0005
	dc.w $0182,$0004,$0182,$0003,$0182,$0002,$0182,$0001,$0182,$0000,$0182,$0000,$0182,$0000,$0182,$0000,$0182,$0000,$0182,$0000
-- Wait for last line of segment, and if reached, skip the copper jump, else execute the jump  --
	dc.w $3401,$FF07
-- Jump to adress set in copl2c/copl2h (Copper_line1)
	dc.w COPJMP2,$0	

-- if skip was executed, Wait for for start of next line segment -- 
	dc.w $3407,$FFFE
-- load new address in cop2lc/cop2lh (copper_line9)-- 
	dc.w $0084,$0000,$0086,$0000		

:repeat for next line:

Edit: Ahh you understood a/b's post. but will leave this post here for future reference.

Last edited by LaBodilsen; 08 November 2021 at 18:42.
LaBodilsen is offline  
 
Page generated in 0.04599 seconds with 11 queries