English Amiga Board


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

 
 
Thread Tools
Old 31 January 2020, 23:55   #1
mcgeezer
Registered User

 
Join Date: Oct 2017
Location: Sunderland, England
Posts: 1,770
Bitplane Calculations

I'm struggling here with a particularly (for me) bitplane scenario, I think there's a few problems it could be but I suspect it's to do with my math or logic of what is going on.

Here's a screen shot.



I'm trying to copy the bitmap stored in the IFF file within PPaint there, and make a copy of the sprite but manipulate the bitplanes so that the hooded mask appears orange without affecting the rest of the guys colours.

I'm using a cookie cut with $CA minterm.

In the Red square the code is taking a source and destination bitplane, a 1 in d6 aligned to a 3 in d7 would copy bitplane 1 to bitplane 3 from source to destination respectively. However the output is not what I'm seeing because the guys trousers are all screwed up... almost as if the bitmap data is being lost in the 5th bitplane..

I have a feeling the minterm is wrong and I need to or'ing the data from source to destination, but it should be taking the destination bitplane anyway and copying the data based on the mask which is set (and I know this is right).

A second pair of eyes on this would really be usefui, happy to post source if needed.

Graeme
mcgeezer is offline  
Old 01 February 2020, 01:55   #2
lmimmfn
Registered User

 
Join Date: May 2018
Location: Mullingar
Posts: 86
Apologies if I waste your time as I have very little experience of Amiga assembly( but I have a lot of programming experience) , however orange is colour 15, don't you have it the other way around, that you should be blitting from 5 bit plane Bob but with only 4 bitplanes so it would drop down to a different colour? Or blitting from 4 bitplanes to 3
I. E. If the hood is colour 15 orange( simplification as you've 2 colours for the hood) then purple should be colour 7 when blitting as 3 bitplanes.
All the other colours of the character( trousers etc.) should be colour 6 or less.

In your example of copying bitplane 1 to 3 the hood should only have 1s with the rest being 0s. The trousers are grey because to make them blue requires 1s for the 4th bitplane.

Summary, make the trousers only use colours 0-7 so they work for 8 and 16 colour bitplanes.

I've been thinking about this recently that some cool effects are possible just by having palettes from upper bitplanes as offset colours from the lower ones, kinda like half brite but with more control.

I think I'm crap at explaining

Last edited by lmimmfn; 01 February 2020 at 02:24.
lmimmfn is offline  
Old 01 February 2020, 11:16   #3
mcgeezer
Registered User

 
Join Date: Oct 2017
Location: Sunderland, England
Posts: 1,770
So I'm fairly sure in that I'm right about the $CA minterm function being the cause of the problem here.

What is happening is the mask is controlling whether a 1 or 0 is set in the destination bitplane.

From the HRM..."When blitting the car to the background we would want to use a function that, whenever the car mask (fetched with DMA channel A) had a bit set, we would pass through the car data from B, and whenever A did not have a bit set, we would pass through the original background from C. The corresponding function, commonly referred to as the cookie-cut function, is AB+AC, which works out to an LF code value of $CA."

What needs to happen is the car data needs to be OR'd into the original background C.

Not sure if the blitter is capable of this with one go.
mcgeezer is offline  
Old 01 February 2020, 12:31   #4
ross
Per aspera ad astra

ross's Avatar
 
Join Date: Mar 2017
Location: Crossing the Rubicon
Age: 50
Posts: 2,544
Quote:
Originally Posted by mcgeezer View Post
So I'm fairly sure in that I'm right about the $CA minterm function being the cause of the problem here.

What is happening is the mask is controlling whether a 1 or 0 is set in the destination bitplane.

From the HRM..."When blitting the car to the background we would want to use a function that, whenever the car mask (fetched with DMA channel A) had a bit set, we would pass through the car data from B, and whenever A did not have a bit set, we would pass through the original background from C. The corresponding function, commonly referred to as the cookie-cut function, is AB+AC, which works out to an LF code value of $CA."

What needs to happen is the car data needs to be OR'd into the original background C.

Not sure if the blitter is capable of this with one go.
Hi Graeme, just a quick answer, maybe I'll look at it better later (I didn't follow the Rolling Thunder thread from which I think it all started),
but there are some inaccuracies in your reasoning.

$CA minterm is D=A'C+AB (not AC+AB) and is already an OR (masked) to destination.
A (the mask) is not a selector for 0 or 1 but B or C (from the equation, if A=1 select B, if A=0 select C).
Of course you can exclude the mask from the equation, but B thus loses meaning in the selection of source colors.
EDIT: 0 or 1 in source B can have a significance for other planes too, you must be sure that B bit is in the destination when (mask)A=1

Anyway if you want D=B+C the minterm is $EE (and you can disable A source so BLTCON0=$07EE).
If you want to avoid too many blitter idle cycles you can use A as image source so D=A+C, minterm $FA, BLTCON0=$0BFA (a pretty standard blitter OR usage).

Last edited by ross; 01 February 2020 at 13:06. Reason: I struggle with English to make me understandable :)
ross is offline  
Old 01 February 2020, 13:21   #5
mcgeezer
Registered User

 
Join Date: Oct 2017
Location: Sunderland, England
Posts: 1,770
Thanks Ross, this is now working. I was driving home and then figured i needed to do the or after the cookie cutting.

Graeme
mcgeezer is offline  
Old 01 February 2020, 13:32   #6
jotd
This cat is no more
jotd's Avatar
 
Join Date: Dec 2004
Location: FRANCE
Age: 48
Posts: 4,092
now we know you have started re-doing Rolling Thunder. this is going to be good.
jotd is offline  
Old 01 February 2020, 15:22   #7
mcgeezer
Registered User

 
Join Date: Oct 2017
Location: Sunderland, England
Posts: 1,770
Quote:
Originally Posted by jotd View Post
now we know you have started re-doing Rolling Thunder. this is going to be good.
Only feasibility at the moment - dont get your hopes up just yet.
mcgeezer 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
Calculations for a simple blit? deimos Coders. Asm / Hardware 19 24 December 2019 14:28
Can you mask a bitplane? Steril707 Coders. Asm / Hardware 2 17 August 2017 10:53
Blitting one bitplane Shatterhand Coders. Blitz Basic 13 01 February 2017 16:13
Bitplane removal on the fly gifgit request.UAE Wishlist 6 11 October 2015 20:31
bitplane modulos bluea Coders. General 0 09 July 2006 01:58

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 11:52.


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