English Amiga Board


Go Back   English Amiga Board > Coders > Coders. Asm / Hardware

 
 
Thread Tools
Old 14 September 2015, 22:03   #1
Fell
Registered User
 
Join Date: Aug 2015
Location: UK
Posts: 15
Question Copper loop confusions

Hi all,

I'm working on a chunky-to-copper system.

As part of this, I'm using copper loops so that each row of chunky pixels only needs to be written to the copperlist once (for configurations where the vertical size of chunky pixels is greater than 1).

Each chunky scanline looks like this in the copperlist:

SCANSTARTADDR:
- Wait for hpos > something
- C2C_WIDTH of $0180,$0rgb
- Set COP2LCL and COP2LCH to SCANSTARTADDR for this scanline
- Skip following if vpos > start row of the next scaline
- Strobe COPJMP2

(Above repeats * C2C_HEIGHT)

Now this is all groovy, I can programatically generate that copperlist, and then C2C_HEIGHT blits correctly copy the scanline $0rgb values to where they should be, skipping the $0180s and the jump logic, etc.

My issue is in the copperlist; it runs fine and the loops work and stuff, right up to vpos $80; after that it explodes.

I've extracted the generated copperlist and stuck it in its own little prog to show the problem. It depends on my usual startup code but should be easy to paste into yours, it's really just a copperlist.

See it upon the pastebin, it's too long to paste here. I've marked where it breaks, and the copperlist is commented thanks to Toni

Am I not doing the SKIP correctly? I've WAITed past $80 no probs using eg $8201FFFE. Can I not SKIP with eg $8201FFFF?

Last edited by Fell; 14 September 2015 at 22:24. Reason: OCD...
Fell is offline  
Old 15 September 2015, 00:45   #2
Fell
Registered User
 
Join Date: Aug 2015
Location: UK
Posts: 15
Haaang on.... this and this seem to describe my problem so I'll have a nose around those.
Fell is offline  
Old 15 September 2015, 11:41   #3
Toni Wilen
WinUAE developer
 
Join Date: Aug 2001
Location: Hämeenlinna/Finland
Age: 49
Posts: 26,534
Your example copper list is difficult to follow because listing lacks copper addresses, can't easily see where COPJMP2's are supposed to jump.

Check the copper list with "od" debugger command active, it includes more details (if instruction was executed and what was vpos/hpos position when it was last executed)

Attach also binary, I am too lazy to assemble it
Toni Wilen is offline  
Old 15 September 2015, 13:37   #4
Fell
Registered User
 
Join Date: Aug 2015
Location: UK
Posts: 15
Hi Toni, certainly Full copperlist with addresses here; binary attached. I suspect it's a masking issue when the high bit of vpos is 1, but haven't quite figured it out yet.

The problem seems to start with the SKIP at $10f88.
Attached Files
File Type: lha coppermystery.lha (1.8 KB, 153 views)
Fell is offline  
Old 15 September 2015, 17:13   #5
Leffmann
 
Join Date: Jul 2008
Location: Sweden
Posts: 2,269
Bit 7 of the vertical mask is always enabled, so if you're doing a horizontal wait at line 128 or later, then you need to set the vertical component to 128. In your case, just changing the first instruction in your loop from $00xx 80FE to $80xx 80FE, will fix it.
Leffmann is offline  
Old 15 September 2015, 17:48   #6
Fell
Registered User
 
Join Date: Aug 2015
Location: UK
Posts: 15
Leffmann, ahh of course There was nothing wrong with the skips, and now when I switch from $0033 to $8033 at the middle of the screen (for the first word of the h wait), all is great!

Thanks very much, once again!

Last edited by Fell; 15 September 2015 at 20:15.
Fell is offline  
Old 15 September 2015, 20:12   #7
Fell
Registered User
 
Join Date: Aug 2015
Location: UK
Posts: 15
Hmmm, is there a way to have it work once vpos has looped past $ff?

I've tried going back to $0033,$8030, but it seems they trigger instantly again.

Attached a pic, in the hope that making it would give me a flash of inspiration -- neither it nor this Old Speckled Hen have so far helped..
Attached Thumbnails
Click image for larger version

Name:	debuggage.png
Views:	394
Size:	8.7 KB
ID:	45484  
Fell is offline  
Old 15 September 2015, 22:43   #8
ReadOnlyCat
Code Kitten
 
Join Date: Aug 2015
Location: Montreal/Canadia
Age: 52
Posts: 1,178
Quote:
Originally Posted by Fell View Post
Hmmm, is there a way to have it work once vpos has looped past $ff?

I've tried going back to $0033,$8030, but it seems they trigger instantly again.

Attached a pic, in the hope that making it would give me a flash of inspiration -- neither it nor this Old Speckled Hen have so far helped..
Happiness lies in the HRM:
http://amigadev.elowar.com/read/ADCD.../node004D.html

ReadOnlyCat is offline  
Old 16 September 2015, 00:08   #9
Fell
Registered User
 
Join Date: Aug 2015
Location: UK
Posts: 15
That's what I'm trying It was reading that in the HRM that made me try to go past $ff.

I see vpos overflowing as expected, and I *think* the SKIPs are happy after overflow. The prob is that the horiz waits don't seem to behave the same, but I have some more poking around to do.

ps ReadOnlyCat==SceneCat? Saucer of cream if so
Fell is offline  
Old 16 September 2015, 02:21   #10
ReadOnlyCat
Code Kitten
 
Join Date: Aug 2015
Location: Montreal/Canadia
Age: 52
Posts: 1,178
Quote:
Originally Posted by Fell View Post
That's what I'm trying It was reading that in the HRM that made me try to go past $ff.

I see vpos overflowing as expected, and I *think* the SKIPs are happy after overflow. The prob is that the horiz waits don't seem to behave the same, but I have some more poking around to do.

ps ReadOnlyCat==SceneCat? Saucer of cream if so
Argh. I was being dumb again. Indeed you account for the line 255 overflow.

Your problem probably comes from the fact that you are not setting all mask bits to 1.
Unless you want to reuse a section of copperlist several times over the course of a frame it is generally a good idea to always set the second word of
WAIT
to
$FFFE
.

Also, ReadOnlyCat != Scenecat.
ReadOnlyCat is offline  
Old 16 September 2015, 11:00   #11
Fell
Registered User
 
Join Date: Aug 2015
Location: UK
Posts: 15
Aye, but my waits are just for horizontal-only, so $FFFE won't work; only the skips care about vpos. Aaaaand since this screen is a series of copperloops I guess I do want to reuse a section of copperlist several times..

Saucer of cream anyway
Fell is offline  
Old 16 September 2015, 11:15   #12
hooverphonique
ex. demoscener "Bigmama"
 
Join Date: Jun 2012
Location: Fyn / Denmark
Posts: 1,629
Quote:
Originally Posted by Fell View Post
Attached a pic, in the hope that making it would give me a flash of inspiration -- neither it nor this Old Speckled Hen have so far helped..
Are you doing a demo about fried eggs?
hooverphonique is offline  
Old 16 September 2015, 12:00   #13
Fell
Registered User
 
Join Date: Aug 2015
Location: UK
Posts: 15
Don't get me wrong, I LOVE breakfast prods, but those are daisies
Fell is offline  
Old 16 September 2015, 15:11   #14
ReadOnlyCat
Code Kitten
 
Join Date: Aug 2015
Location: Montreal/Canadia
Age: 52
Posts: 1,178
Quote:
Originally Posted by Fell View Post
Aye, but my waits are just for horizontal-only, so $FFFE won't work; only the skips care about vpos. Aaaaand since this screen is a series of copperloops I guess I do want to reuse a section of copperlist several times.
Which is why I precised:
Quote:
Unless you want to reuse a section of copperlist several times over the course of a frame it is generally a good idea to always set the second word of WAIT to $FFFE.
The operating remark was the one about the mask bits, the conclusion is a general example.

You are reusing the copper list vertically so the comparison mask can have its vertical bits cleared but the horizontal mask bits should be fully set just like you did for the first chunky lines of your copper list.
ReadOnlyCat is offline  
Old 16 September 2015, 18:54   #15
Fell
Registered User
 
Join Date: Aug 2015
Location: UK
Posts: 15
Sorry ReadOnlyCat, I'm evidently confusing myself

For vpos $00-$79, the horizontal waits (for hpos $33) look like: $0033, $8030
Then for vpos $80-$ff, the horizontal waits (for hpos $33) look like: $8033, $8030

After vpos overflows, I go back to using $0033, $8030, but neither that nor $0033, $80FE works..

EDIT: Ahhh there's nothing wrong with these horizontal waits now The issue is the SKIPs after $FF! The loop running before wraparound ends with the SKIP: $0001,$ffff -- this will always skip, so the next scanline gets drawns instantly, and THAT scanline, which ends with a SKIP: $0801,$ffff, will always skip too Hmmmm I'll have a think \o/

Last edited by Fell; 16 September 2015 at 19:08.
Fell is offline  
Old 21 September 2015, 21:02   #16
Fell
Registered User
 
Join Date: Aug 2015
Location: UK
Posts: 15
Well, I went away and implemented some other effects, then came back to this. Solution was to align a SKIP on $ff. Now all sorted, thanks for the help
Fell is offline  
 


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

Similar Threads
Thread Thread Starter Forum Replies Last Post
Combining copper scrolling with copper background phx Coders. Asm / Hardware 16 13 February 2021 12:41
fastest possible rom copy loop Yulquen74 Coders. Asm / Hardware 17 10 May 2014 19:10
Loop optimization + cycle counts losso Coders. Asm / Hardware 8 05 November 2013 11:50
Sampled loop in cracktro absence request.Music 2 30 June 2012 11:33

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 12:36.

Top

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Page generated in 0.15242 seconds with 16 queries