English Amiga Board


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

 
 
Thread Tools
Old 13 January 2020, 17:38   #1
mcgeezer
Registered User

 
Join Date: Oct 2017
Location: Sunderland, England
Posts: 1,648
AGA Dual Playfield Colour Assignment

I'm mucking around with some dual playfield stuff on the A1200.

I've assigned my colours into the colour regs 0-31 and I'm expecting 0-15 to be assigned to playfield 1 and 16-31 assigned to playfield 2.

While Playfield 1 is fine it seems playtfield 2 has all of the colours screwed up. I've had a read of the bits on BPLCON3 regarding if Playfield 2 is given priority - however this isn't the case.

Is there anything special I need to do to get dual playfield working on AGA, am I missing something obvious?

I'll probably get to the bottom of it later through trial and error but just wanted to ask as it wasn't shown after a search.

mcgeezer
mcgeezer is offline  
Old 13 January 2020, 17:50   #2
roondar
Registered User

 
Join Date: Jul 2015
Location: The Netherlands
Posts: 1,635
Hmm, the documentation I could find does suggest you use BPLCON3 to set the palette offset. Is this the same documentation as you used?
Code:
bplcon3     EQU   $106	; 0  = EXTBLNKEN - external blank enable
			; 1  = BRDSPRT - EXTBLKZD - external blank ored
			;      into trnsprncy- sprites on BORDERS!
			; 2  = ZDCLKEN - zd pin outputs a 14mhz cloc
			; 3  = NO FUNCTIONS - SET TO ZERO
			; 4  = ECS BRDRTRAN Border opaque
			; 5  = ECS BRDRBLNK Border blank
			; 6  = AGA SPRES1 \sprite hires,lores,superhires
			; 7  = AGA SPRES0 /
			; 8  = NO FUNCTIONS - SET TO ZERO
			; 9  = LOCT - palette high or low nibble colour
			; 10 = PF2OF2 \
			; 11 = PF2OF1  } second playfield's offset in coltab
			; 12 = PF2OF0 /
			; 13 = BANK0 \
			; 14 = BANK1  } LOCT palette select 256
			; 15 = BANK2 /
			;

BANKx = Selects one of eight color banks, x=0-2.

Bits PF2OF2,1,0 in BPLCON3 determine second playfield's offset into the
colour table. This is now necessary since playfields in DPF mode can have
up to 4 bitplanes. Offset values are as defined in register map.
The bits 10 and 11 must be set as default to made the old 16 colours dual
playfiled, so remember that ($106,$c00) (Thanx to MUCSI/Muffbusters)
PF20Fx = Determine bit plane color table offset whe playfield 2 has priority
in dual playfield mode:

	PF20F || AFFECTED BITPLANE ||OFFSET	(From C-18 AGA doc)
	-------------------------------------------------------
	| 2 | 1 | 0 || 8 | 7 | 6 | 5 | 4 | 3 | 2 | 1 ||(decimal)
	-------------------------------------------------------
	| 0 | 0 | 0 || - | - | - | - | - | - | - | - || none
	| 0 | 0 | 1 || - | - | - | - | - | - | 1 | - || 2
	| 0 | 1 | 0 || - | - | - | - | - | 1 | - | - || 4
	| 0 | 1 | 1 || - | - | - | - | - | 1 | - | - || 8 (default)
	| 1 | 0 | 0 || - | - | - | 1 | - | - | - | - || 16
	| 1 | 0 | 1 || - | - | 1 | - | - | - | - | - || 32
	| 1 | 1 | 0 || - | 1 | - | - | - | - | - | - || 64
	| 1 | 1 | 1 || 1 | - | - | - | - | - | - | - || 128
From https://github.com/rkrajnc/minimig-m...a/RandyAGA.txt

Never used AGA Dual Playfield yet so perhaps we're missing something?
roondar is offline  
Old 13 January 2020, 17:52   #3
mcgeezer
Registered User

 
Join Date: Oct 2017
Location: Sunderland, England
Posts: 1,648
So yeah, i read those docs...

and then I read this doc...

https://github.com/rkrajnc/minimig-m.../aga/AGA.guide

Specifically....

Code:
 | 12   | PF2OF2=0   | Determine bit plane color table offset when playfield 2|
 |      |            | has priority in dual playfield mode

...when playfield 2 has priority... that condition is false.
mcgeezer is offline  
Old 13 January 2020, 17:56   #4
roondar
Registered User

 
Join Date: Jul 2015
Location: The Netherlands
Posts: 1,635
I find it oddly worded to be honest. Perhaps because I'm not a native speaker. To me it could both mean "whenever PF2 colours are shown" (i.e. PF1 pixel = transparent so PF2 has priority), or "whenever PF2 is set to be the top playfield".

Don't have any access to an emulator or Amiga here so can't check it either.

Edit: this thread also seems to suggest it's not about priority but simply colour choice - http://eab.abime.net/showthread.php?t=71661

Last edited by roondar; 13 January 2020 at 18:00. Reason: Found a potentially useful thread
roondar is offline  
Old 13 January 2020, 18:14   #5
mcgeezer
Registered User

 
Join Date: Oct 2017
Location: Sunderland, England
Posts: 1,648
Quote:
Originally Posted by roondar View Post
I find it oddly worded to be honest. Perhaps because I'm not a native speaker. To me it could both mean "whenever PF2 colours are shown" (i.e. PF1 pixel = transparent so PF2 has priority), or "whenever PF2 is set to be the top playfield".

Don't have any access to an emulator or Amiga here so can't check it either.

Edit: this thread also seems to suggest it's not about priority but simply colour choice - http://eab.abime.net/showthread.php?t=71661

Yeah, I read this one too... and the default does not make sense.

Code:
 | 12   | PF2OF2=0   | Determine bit plane color table offset when playfield 2|
 |      |            | has priority in dual playfield mode:                   |
 |      |            +-----------+-------------------------------+------------+
 |      |            | PF20F     | AFFECTED BITPLANE             | OFFSET     |
 |      |            +---+---+---+-------------------------------+------------+
 |      |            | 2 | 1 | 0 | 8 | 7 | 6 | 5 | 4 | 3 | 2 | 1 | (decimal)  |
 |      |            +---+---+---+-------------------------------+------------+
 |      |            | 0 | 0 | 0 | - | - | - | - | - | - | - | - | none       |
 |      |            | 0 | 0 | 1 | - | - | - | - | - | - | 1 | - | 2          |
 |      |            | 0 | 1 | 0 | - | - | - | - | - | 1 | - | - | 4          |
 |      |            | 0 | 1 | 1 | - | - | - | - | - | 1 | - | - | 8 (default)|
 |      |            | 1 | 0 | 0 | - | - | - | 1 | - | - | - | - | 16         |
        |            | 1 | 0 | 1 | - | - | 1 | - | - | - | - | - | 32         |
 |      |            | 1 | 1 | 0 | - | 1 | - | - | - | - | - | - | 64         |
 |      |            | 1 | 1 | 1 | 1 | - | - | - | - | - | - | - | 128        |
It says to set PF2OF to $c. This would set bits PF2OF2 and PF2OF1 which would select Offset 64. I suspect not looking at it that the docs are wrong and the bits the wrong way around.

Code:
Code:
 | 12   | PF2OF2=0   | Determine bit plane color table offset when playfield 2|
 |      |            | has priority in dual playfield mode:                   |
 |      |            +-----------+-------------------------------+------------+
 |      |            | PF20F     | AFFECTED BITPLANE             | OFFSET     |
 |      |            +---+---+---+-------------------------------+------------+
 |      |            | 0 | 1 | 2 | 8 | 7 | 6 | 5 | 4 | 3 | 2 | 1 | (decimal)  |
 |      |            +---+---+---+-------------------------------+------------+
 |      |            | 0 | 0 | 0 | - | - | - | - | - | - | - | - | none       |
 |      |            | 0 | 0 | 1 | - | - | - | - | - | - | 1 | - | 2          |
 |      |            | 0 | 1 | 0 | - | - | - | - | - | 1 | - | - | 4          |
 |      |            | 0 | 1 | 1 | - | - | - | - | - | 1 | - | - | 8 (default)|
 |      |            | 1 | 0 | 0 | - | - | - | 1 | - | - | - | - | 16         |
        |            | 1 | 0 | 1 | - | - | 1 | - | - | - | - | - | 32         |
 |      |            | 1 | 1 | 0 | - | 1 | - | - | - | - | - | - | 64         |
 |      |            | 1 | 1 | 1 | 1 | - | - | - | - | - | - | - | 128        |
So if I set PF2OF0 to 1 and unset PF2OF1 & PF2OF2 then that will select offset 16....I'll try it when I get in tonight....pretty sure I tried it yesterday and it was still screwed.
mcgeezer is offline  
Old 13 January 2020, 18:29   #6
roondar
Registered User

 
Join Date: Jul 2015
Location: The Netherlands
Posts: 1,635
If you find the correct values, I'd be interesting in knowing them. Perhaps I'll try something as well - but I'm not sure I'll have time tonight.
roondar is offline  
Old 13 January 2020, 18:31   #7
ross
Per aspera ad astra

ross's Avatar
 
Join Date: Mar 2017
Location: Crossing the Rubicon
Age: 49
Posts: 2,425
Quote:
Originally Posted by mcgeezer View Post
So if I set PF2OF0 to 1 and unset PF2OF1 & PF2OF2 then that will select offset 16....I'll try it when I get in tonight....pretty sure I tried it yesterday and it was still screwed.
Hi Graeme, PF2OF2 need to be set to 1.

Code:
PF2OF2|PF2OF1|PF2OF0
  1  |   0   |   0      -> offset 16
So a value for BPLCON3=$1000 select the right bank for PF2.

If you want to change bank also for PF1 you need to change BPLAMx bits in BPLCON4.
ross is offline  
Old 13 January 2020, 18:37   #8
roondar
Registered User

 
Join Date: Jul 2015
Location: The Netherlands
Posts: 1,635
So the documentation does number the bits the wrong way round then?
roondar is offline  
Old 13 January 2020, 18:43   #9
ross
Per aspera ad astra

ross's Avatar
 
Join Date: Mar 2017
Location: Crossing the Rubicon
Age: 49
Posts: 2,425
Quote:
Originally Posted by roondar View Post
So the documentation does number the bits the wrong way round then?
No idea if the document is wrong but this bit setting make sense to me.
It's simply a log(2) for the starting point.

So for example if I want a start from 32=2^5 I select 101 and set in bit 12 to 10.
The default value is for a base=8=2^3->011->bit12=0,bit11=1,bit10=1->BPLCON3=$0C00
ross is offline  
Old 13 January 2020, 19:25   #10
mcgeezer
Registered User

 
Join Date: Oct 2017
Location: Sunderland, England
Posts: 1,648
Quote:
Originally Posted by ross View Post
Hi Graeme, PF2OF2 need to be set to 1.

Code:
PF2OF2|PF2OF1|PF2OF0
  1  |   0   |   0      -> offset 16
So a value for BPLCON3=$1000 select the right bank for PF2.

If you want to change bank also for PF1 you need to change BPLAMx bits in BPLCON4.
Thanks Ross, this has sorted it.

I'm still wrapping my head around the logic slightly. I'll get there.

Graeme
mcgeezer is offline  
Old 14 January 2020, 11:13   #11
roondar
Registered User

 
Join Date: Jul 2015
Location: The Netherlands
Posts: 1,635
Quote:
Originally Posted by ross View Post
No idea if the document is wrong but this bit setting make sense to me.
It's simply a log(2) for the starting point.

So for example if I want a start from 32=2^5 I select 101 and set in bit 12 to 10.
The default value is for a base=8=2^3->011->bit12=0,bit11=1,bit10=1->BPLCON3=$0C00
As it turns out, the problem here was me reading this bit of documentation incorrectly and then assuming the PF2-PF0 value was a simple binary representation of the number of the starting colour index. Even though that quite obviously can't work and doesn't fit with the numbers shown.

Eh, thinking is hard sometimes

Next time, I'll just read the table and accept it as is, instead of doing silly things like interpreting the values without considering if that makes sense. After all, that's what I normally do and it works great
roondar is offline  
Old 15 January 2020, 13:06   #12
Steril707
Tigerskunk!

Steril707's Avatar
 
Join Date: Sep 2016
Location: Amiga Island
Posts: 1,271
I hope I may use this thread to ask a simple question that's in a similar vein, though...

If I can assign 16 colours to pf1, and another 16 colours to pf2, can I assign another bank of 16 colours to the sprites, then?

So I'd have 48 colours in total..
Steril707 is offline  
Old 15 January 2020, 13:15   #13
ross
Per aspera ad astra

ross's Avatar
 
Join Date: Mar 2017
Location: Crossing the Rubicon
Age: 49
Posts: 2,425
Quote:
Originally Posted by Steril707 View Post
I hope I may use this thread to ask a simple question that's in a similar vein, though...

If I can assign 16 colours to pf1, and another 16 colours to pf2, can I assign another bank of 16 colours to the sprites, then?

So I'd have 48 colours in total..
Yes, you can, setting some bits of BPLCON4, also separate colors for even and odd sprites.

So, if you use 4 colors sprites, 24 more colors.
ross is offline  
Old 15 January 2020, 13:45   #14
roondar
Registered User

 
Join Date: Jul 2015
Location: The Netherlands
Posts: 1,635
Even more cool, BPLCON4 and BPLCON3 actually allow you to set this at any time, so you can divide your 256 colours up in several palettes and switch them on the fly to have way more colours on screen for the cost of just setting one or two registers with the Copper.

Because of the low overhead this is a very efficient way of improving colours when using AGA Dual Playfield
roondar is offline  
Old 15 January 2020, 14:00   #15
Steril707
Tigerskunk!

Steril707's Avatar
 
Join Date: Sep 2016
Location: Amiga Island
Posts: 1,271
Okay, that's cool. With 48 colours on screen without trickery you can already have a quite vivid image.
Steril707 is offline  
Old 24 January 2020, 05:56   #16
Auscoder
Registered User

 
Join Date: Jan 2019
Location: Brisbane
Posts: 40
I have been reading and reading this thread, but still don't get it... Dyslexic I must be. I am also setting up an AGA dual playfield trying to transition for an AGA version of my OCS/ECS project : [ Show youtube player ]

my AGA configuration is currently like...

PF1 4 bitplanes (just more foreground color)
PF2 3 bitplanes (maybe I will increase this later.. but can stay at 8 color for now)

For writing the AGA palette I write :

Write 16 color for PF1 in bank 0 colors 0-15
Write 8 colors for PF2 in bank 0 colors 16-23
Write 16 colors for use with attached sprites in bank 1 colors 0-15

PF1 has priority over PF2
Sprites has priority over PF1

Is this possible with this configuration? I am currently writing only 12 bit colors to the high order bits as I don't have any 24bit palette code working outside of writing to a specific bank yet. I understand that this will copy to low order bits anyway.

Where I struggle to understand, how do I get the Miggy to use the correct banks + offsets for PF1, PF2 and sprite.

In OCS/ECS I am using 0-7 for PF1, 8-15 for PF2 and 16-31 for Sprites.
Auscoder is offline  
Old 24 January 2020, 10:32   #17
mcgeezer
Registered User

 
Join Date: Oct 2017
Location: Sunderland, England
Posts: 1,648
Do you have any example code you can show?

BPLCON3 and BPLCON4 is primarily what controls these - did you look at their docs?
mcgeezer is offline  
Old 24 January 2020, 10:57   #18
Auscoder
Registered User

 
Join Date: Jan 2019
Location: Brisbane
Posts: 40
Quote:
Originally Posted by mcgeezer View Post
Do you have any example code you can show?

BPLCON3 and BPLCON4 is primarily what controls these - did you look at their docs?
I only have the code to set the colors in the palettes, have not figured out how to assign palettes to playfields or sprites.

I do this to set the palette per bank

Code:
  ; Write palette to bank 0 hi and low order bits
  ; Bank 0 - Colors 0-31
  dc.w $0106,$0000 ; First 12-bit color palette (LOCT=0)
  dc.w $0180,$0F00
  dc.w $0182,$00F0
  dc.w $0184,$000F
  .. For all colors in bank 0

  dc.w $0106,$0200 ; Second 12-bit color palette (LOCT=1)
  dc.w $0180,$0F00
  dc.w $0182,$00F0
  dc.w $0184,$000F
  .. For all colors in bank 0

  ; Now I switch banks
  ; Bank 1 - Colors 32-63
  dc.w $0106,$2000 ; First 12-bit color palette (LOCT=0)
  dc.w $0180,$0F00
  dc.w $0182,$00F0
  dc.w $0184,$000F
  .. For all colors in bank 1

  dc.w $0106,$2200 ; Second 12-bit color palette (LOCT=1)
  dc.w $0180,$0F00
  dc.w $0182,$00F0
  dc.w $0184,$000F
  .. For all colors in bank 1
I want to use

Bank 0 - Color 0-15 for PF1
Bank 0 - Color 16-23 for PF2 - Or even 16-31 but currently i am keeping PF2 at 3 Bitplanes
Bank 1 - Color 0-15 for sprites

Last edited by Auscoder; 24 January 2020 at 11:02.
Auscoder is offline  
Old 24 January 2020, 11:39   #19
ross
Per aspera ad astra

ross's Avatar
 
Join Date: Mar 2017
Location: Crossing the Rubicon
Age: 49
Posts: 2,425
This:

Code:
;Bank 0 - Color 0-15 for PF1
;Bank 0 - Color 16-31 for PF2
;Bank 1 - Color 32-47 for odd (or 16 colors) sprites [0010]
;Bank 1 - Color 48-63 for even sprites [0011<<4], just in case


  dc.w $010C,%00110010  ;BPLCON4 high order bit for sprite colors
  

  ; Write palette to bank 0 hi and low order bits
  ; Bank 0 - Colors 0-31
  dc.w $0106,%0001000001000000 ; [BANK0|PF2OF,16|LOCT0|SPRLORES|0]
  dc.w $0180,$0F00
  dc.w $0182,$00F0
  dc.w $0184,$000F
  .. For all colors in bank 0

  dc.w $0106,%0001001001000000 ; [BANK0|PF2OF,16|LOCT1|SPRLORES|0]
  dc.w $0180,$0F00
  dc.w $0182,$00F0
  dc.w $0184,$000F
  .. For all colors in bank 0

  ; Now I switch banks
  ; Bank 1 - Colors 32-63
  dc.w $0106,%0011000001000000 ; [BANK1|PF2OF,16|LOCT0|SPRLORES|0]
  dc.w $0180,$0F00
  dc.w $0182,$00F0
  dc.w $0184,$000F
  .. For all colors in bank 1

  dc.w $0106,%0011001001000000 ; [BANK1|PF2OF,16|LOCT1|SPRLORES|0]
  dc.w $0180,$0F00
  dc.w $0182,$00F0
  dc.w $0184,$000F
  .. For all colors in bank 1
ross is offline  
Old 24 January 2020, 12:19   #20
Auscoder
Registered User

 
Join Date: Jan 2019
Location: Brisbane
Posts: 40
Quote:
Originally Posted by ross View Post
This:

Code:
;Bank 0 - Color 0-15 for PF1
;Bank 0 - Color 16-31 for PF2
;Bank 1 - Color 32-47 for odd (or 16 colors) sprites [0010]
;Bank 1 - Color 48-63 for even sprites [0011<<4], just in case


  dc.w $010C,%00110010  ;BPLCON4 high order bit for sprite colors
  

  ; Write palette to bank 0 hi and low order bits
  ; Bank 0 - Colors 0-31
  dc.w $0106,%0001000001000000 ; [BANK0|PF2OF,16|LOCT0|SPRLORES|0]
  dc.w $0180,$0F00
  dc.w $0182,$00F0
  dc.w $0184,$000F
  .. For all colors in bank 0

  dc.w $0106,%0001001001000000 ; [BANK0|PF2OF,16|LOCT1|SPRLORES|0]
  dc.w $0180,$0F00
  dc.w $0182,$00F0
  dc.w $0184,$000F
  .. For all colors in bank 0

  ; Now I switch banks
  ; Bank 1 - Colors 32-63
  dc.w $0106,%0011000001000000 ; [BANK1|PF2OF,16|LOCT0|SPRLORES|0]
  dc.w $0180,$0F00
  dc.w $0182,$00F0
  dc.w $0184,$000F
  .. For all colors in bank 1

  dc.w $0106,%0011001001000000 ; [BANK1|PF2OF,16|LOCT1|SPRLORES|0]
  dc.w $0180,$0F00
  dc.w $0182,$00F0
  dc.w $0184,$000F
  .. For all colors in bank 1
Thanks Ross, This: seems to work well for 16 color sprites and PF1 (big step thank you). I am seeing some issue with palette on PF2 not as I expect. I am looking now to see if maybe I am stomping any BPLCON3 bits inadvertently. Does it make a difference that I am using only 3bpp/8 color for PF2?

So I don't "seem" to be modifying BPLCON3 outside of setting the colors in bank 0 / range 16-23, what I see is PF2 using palette from PF1. Few more things to double check... mission continues.

Last edited by Auscoder; 24 January 2020 at 13:33. Reason: Further Info
Auscoder 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
16c single playfield vs dual playfield for bobs n sprites donnie Nostalgia & memories 1 20 January 2019 18:24
AGA Sprite + Dual Playfield Limits Marle Coders. Blitz Basic 14 12 January 2019 15:14
Help with Dual Playfield Shatterhand Coders. Blitz Basic 15 14 December 2015 14:05
Dual playfield colors and AGA losso Coders. Asm / Hardware 1 03 December 2013 03:48
Dual Playfield BippyM project.Maptapper 6 03 July 2013 01:43

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 00:14.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2020, vBulletin Solutions Inc.
Page generated in 0.09222 seconds with 13 queries