14 September 2015, 22:03 | #1 |
Registered User
Join Date: Aug 2015
Location: UK
Posts: 15
|
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... |
15 September 2015, 11:41 | #3 |
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 |
15 September 2015, 13:37 | #4 |
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. |
15 September 2015, 17:13 | #5 |
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.
|
15 September 2015, 17:48 | #6 |
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. |
15 September 2015, 20:12 | #7 |
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.. |
15 September 2015, 22:43 | #8 | |
Code Kitten
Join Date: Aug 2015
Location: Montreal/Canadia
Age: 52
Posts: 1,178
|
Quote:
http://amigadev.elowar.com/read/ADCD.../node004D.html |
|
16 September 2015, 00:08 | #9 |
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 |
16 September 2015, 02:21 | #10 | |
Code Kitten
Join Date: Aug 2015
Location: Montreal/Canadia
Age: 52
Posts: 1,178
|
Quote:
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 WAITto $FFFE. Also, ReadOnlyCat != Scenecat. |
|
16 September 2015, 11:00 | #11 |
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 |
16 September 2015, 11:15 | #12 |
ex. demoscener "Bigmama"
Join Date: Jun 2012
Location: Fyn / Denmark
Posts: 1,629
|
|
16 September 2015, 12:00 | #13 |
Registered User
Join Date: Aug 2015
Location: UK
Posts: 15
|
Don't get me wrong, I LOVE breakfast prods, but those are daisies
|
16 September 2015, 15:11 | #14 | ||
Code Kitten
Join Date: Aug 2015
Location: Montreal/Canadia
Age: 52
Posts: 1,178
|
Quote:
Quote:
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. |
||
16 September 2015, 18:54 | #15 |
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. |
21 September 2015, 21:02 | #16 |
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
|
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 |
|
|