English Amiga Board


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

 
 
Thread Tools
Old 31 October 2021, 22:30   #1
DanielAllsopp
Registered User
 
DanielAllsopp's Avatar
 
Join Date: Feb 2018
Location: Northumberland, UK
Posts: 272
Copper Loops & Horizontal Waits

Hey!

I see there's already a thread on horizontal waits in a copper list, I think this slightly different, but please forgive me if I'm going over old ground here. Basically, I'm following this example from ross about repeating a copper list, which I think I understand (sort of).

Here's a link to ross's example, and here's what happens when I attempt to implement the technique in my code:



What I really need to happen is to have just the name changed to white, and then after the name, the palette changes back to green. What I do sort of figure out is that the more copper commands you have, waiting horizontally, the less time you have to change the colour.

My copper list looks like this (please assume COP1LCH and COP2LCH are set correctly etc.):

Code:
  dc.w $6901,$ff00 ; wait for line $50
  dc.w $ef81,$ffff ; skip loop for lines >=$f0
  dc.w COPJMP2,$0000 ; copjmp2
  dc.w $ffff,$fffe

CooperLoop:
  dc.w BPLCON3,$0000
  dc.w COLOR24,$0072
  dc.w COLOR25,$02c5
  dc.w BPLCON3,$0200
  dc.w COLOR24,$00b2
  dc.w COLOR25,$023a

  dc.w $0053,$00fe
  dc.w BPLCON3,$0000
  dc.w COLOR24,$0ddd
  dc.w COLOR25,$0eee
  dc.w BPLCON3,$0200
  dc.w COLOR24,$0000
  dc.w COLOR25,$0666

  dc.w $0085,$00fe
  dc.w BPLCON3,$0000
  dc.w COLOR24,$0072
  dc.w COLOR25,$02c5
  dc.w BPLCON3,$0200
  dc.w COLOR24,$00b2
  dc.w COLOR25,$023a

  dc.w $ff81,$ffff ; skip loop for lines >=$f0
  dc.w COPJMP2,$0000 ; copjmp2

  dc.w $ffff,$fffe
At first I thought it was working, but then I noticed the '1' and '2' are white but should be green, and then the white starts getting changed at a totally different location. There are 6 bitplanes in use here.

Am I trying to be too clever here with horizontal waits, and should I just load a separate white font for those characters? The copper is some beast to tame mind!

Thanks for any help!
Daniel

Last edited by DanielAllsopp; 01 November 2021 at 22:27. Reason: Fixed drunken typos and grammar
DanielAllsopp is offline  
Old 31 October 2021, 23:10   #2
roondar
Registered User
 
Join Date: Jul 2015
Location: The Netherlands
Posts: 3,421
Ah, there's a trick to it. Due to the Copper using the top bit of the wait command for the status of the Blitter as well as rasterline positions over $80, waiting on horizontal positions only works as you do it until you hit rasterline $80.

At that point, the wait has to change to dc.w $8053,$00fe/dc.w $8085,$00fe. Then, at rasterline $100, it has to change back to dc.w $0053,$00fe/dc.w $0085,$00fe. Basically, you can't mask bit 15 with the Copper wait mask - so you need to set it as needed for the raster position used.

See here for more info:
http://amigadev.elowar.com/read/ADCD.../node005A.html and
http://amigadev.elowar.com/read/ADCD.../node005B.html
roondar is offline  
Old 31 October 2021, 23:28   #3
ross
Defendit numerus
 
ross's Avatar
 
Join Date: Mar 2017
Location: Crossing the Rubicon
Age: 53
Posts: 4,476


That's what my code here does:
Code:
.w8	cmpi.w	#$7f80,6(a5)
	bls.b	.w8
	bchg	#7,(a0)
I advise you to 'split' the copper list in two for cases <$80 and >=$80.
I think I wrote examples, maybe..
ross is offline  
Old 01 November 2021, 22:50   #4
DanielAllsopp
Registered User
 
DanielAllsopp's Avatar
 
Join Date: Feb 2018
Location: Northumberland, UK
Posts: 272
Meh! I've been looking at this all day today and I just don't have enough time to change the two colours I need. Ignoring the > scanline $80 issue for now, I can test setting the two colours by using the background colour. I'm simulating the timing of setting two colours here by setting the same colour twice:

Code:
CooperLoop:
  dc.w $0001,$00fe
  dc.w BPLCON3,$0000
  dc.w COLOR00,$00f0
  dc.w COLOR00,$00f0
  dc.w BPLCON3,$0200
  dc.w COLOR00,$00f0
  dc.w COLOR00,$00f0

  ;-----

  dc.w $0053,$00fe
  dc.w BPLCON3,$0000
  dc.w COLOR00,$0fff
  dc.w COLOR00,$0fff
  dc.w BPLCON3,$0200
  dc.w COLOR00,$0fff
  dc.w COLOR00,$0fff

  ;-----

  dc.w $0085,$00fe
  dc.w BPLCON3,$0000
  dc.w COLOR00,$00f0
  dc.w COLOR00,$00f0
  dc.w BPLCON3,$0200
  dc.w COLOR00,$00f0
  dc.w COLOR00,$00f0

  ;-----

  dc.w BPLCON3,$0000
  dc.w COLOR01,$0000
  dc.w COLOR00,$0000
  dc.w BPLCON3,$0200
  dc.w COLOR01,$0000
  dc.w COLOR00,$0000
which produces this output, all nicely lined up!



However, if I set the second COLOR00 to a different colour to the first COLOR00 which will actually visualise the time taken to set a colour, then we can see the issue become apparent:

Code:
CooperLoop:
  dc.w $0001,$00fe
  dc.w BPLCON3,$0000
  dc.w COLOR00,$0f00
  dc.w COLOR00,$00f0
  dc.w BPLCON3,$0200
  dc.w COLOR00,$0f00
  dc.w COLOR00,$00f0

  ;-----

  dc.w $0053,$00fe
  dc.w BPLCON3,$0000
  dc.w COLOR00,$000f
  dc.w COLOR00,$0fff
  dc.w BPLCON3,$0200
  dc.w COLOR00,$000f
  dc.w COLOR00,$0fff

  ;-----

  dc.w $0085,$00fe
  dc.w BPLCON3,$0000
  dc.w COLOR00,$0f00
  dc.w COLOR00,$00f0
  dc.w BPLCON3,$0200
  dc.w COLOR00,$0f00
  dc.w COLOR00,$00f0

  ;-----

  dc.w BPLCON3,$0000
  dc.w COLOR01,$0000
  dc.w COLOR00,$0000
  dc.w BPLCON3,$0200
  dc.w COLOR01,$0000
  dc.w COLOR00,$0000


Blue and white both need to be set with enough time between the number, and the name for both colours to be ready before the name is output! That's not going to be possible in this case.

So, I guess my solution is to use a separate font at ~12k which uses different colour indexes in the palette, keep the name written in green text, or use a single colour font.

Never mind, thanks for the help, and at least I know a little bit more about the copper now
DanielAllsopp is offline  
Old 02 November 2021, 00:38   #5
mcgeezer
Registered User
 
Join Date: Oct 2017
Location: Sunderland, England
Posts: 2,702
Use BPLCON4 mate.
mcgeezer is offline  
Old 02 November 2021, 09:59   #6
DanielAllsopp
Registered User
 
DanielAllsopp's Avatar
 
Join Date: Feb 2018
Location: Northumberland, UK
Posts: 272
Quote:
Originally Posted by mcgeezer View Post
Use BPLCON4 mate.
Ahhh, something to look at today. I've briefly read up on BPLCON4 but not in any great detail, so that's my next port of call!

Cheers!
DanielAllsopp is offline  
Old 02 November 2021, 18:49   #7
DanielAllsopp
Registered User
 
DanielAllsopp's Avatar
 
Join Date: Feb 2018
Location: Northumberland, UK
Posts: 272
Ah, you little beauty mcgeezer...



Code:
dc.w $0005,$00fe
dc.w BPLCON4,$0011

dc.w $0059,$00fe
dc.w BPLCON4,$0411

dc.w $0089,$00fe
dc.w BPLCON4,$0011

dc.w $00e1,$00fe
Now I'm not 100% sure why this is working, and I don't like writing code when I don't know what it does, but I think by setting the second byte value in that register to a value of $0004, or $0411 for the whole word, shifts the colour selection to the left by 4. Tested with 6 and indeed, the text changes to yellow!



Of course, this has altered my COLOR00 value, which is now pointing to whatever is in COLOR04 so all I needed to do was change COLOR04 (which is unused anyway) to $0000 and everything looks hunky dory!

Now... onto the next bit of this challenge, the > scanline $80
DanielAllsopp is offline  
Old 03 November 2021, 00:47   #8
DanielAllsopp
Registered User
 
DanielAllsopp's Avatar
 
Join Date: Feb 2018
Location: Northumberland, UK
Posts: 272
Done, and with 15 minutes to spare before I turn into a pumpkin, aka a forced cut off time of 12am to help keep my sanity!



Thanks again for everyone's help with this one, your names are up in lights!

On to the next Trello ticket tomorrow then!
DanielAllsopp 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
Copper horizontal waits chadderack Coders. Asm / Hardware 6 31 October 2021 19:02
Copper driven blitter waits in WinUAE Jobbo Coders. Asm / Hardware 38 22 May 2021 20:48
Copper, Horizontal Blanking, and DMA AlexBruger support.Hardware 5 19 July 2020 17:31
Multiple copper waits beyond 255 Auscoder Coders. Asm / Hardware 8 29 July 2019 12:56
non-atomic Copper waits for MrgCop? Samurai_Crow Coders. System 0 01 April 2014 20:07

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 04:53.

Top

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