English Amiga Board


Go Back   English Amiga Board > Coders > Coders. General

 
 
Thread Tools
Old 26 April 2010, 19:04   #1
Krumelur
 
Posts: n/a
Rip graphics: what's the secret with the 4th bitplane?

Hi,

I'm a PC developer and have always been interested in the Amiga. I'd like to do some programming practice and bring a simple game from the Amiga to the PC. I chose Pac Mania by Namco.
First thing is to rip the graphics. I'm using "GfxRip" which does a pretty good job but I don't fully understand the Amiga's memory layout.
Have a look at the attached image.
The ghosts already look correct. I have set the color depth to 5 bit which gives me 32 colors in total (selecting any other color depth breaks the found graphics). I had the unique number of colors in the game counted and the result was 24, so I decided I'd need 5 bits and the result proves me right.
The thing is now: I'm hiding bitplane number 4, 5, 6, 7 and 8. If you look top right at the image, "0, 1 and 2" are shown the others are set to "7", meaning: there is nothing. If I switch on plane 4, the graphics get overlayed with horizontal lines. So I assume only 3 planes are used but how does that match with the 5 bit color depth?
Also: how do I get the palette right? It should be or must be somewhere but GfxRip cannot find it (I'm broswing an uncompressed state dump of WinUAE).

Cannot anybody give me a few hints?

Thanks!

k
Attached Thumbnails
Click image for larger version

Name:	pm.png
Views:	331
Size:	77.8 KB
ID:	25133  
 
Old 27 April 2010, 08:54   #2
pmc
gone
pmc's Avatar
 
Join Date: Apr 2007
Location: completely gone
Posts: 1,596
Hello Krumelur

Before I say anything, there are guys on here who are *far* better at this type of stuff than me so I might not be giving you the best ways to do this stuff, but...

You can find palette information by looking at the colour registers. I would recommend loading the game into WinUAE with the HRTMon cartridge ROM attached. Get to where you want in the game, go into HRTMon and enter the "e" command (without the quotes...)

This will show you the custom registers. Scroll down the list until you get to $180 and that's the value that's in color00, $182 is color01 etc.

Remember that the palette isn't set on the Amiga and, due to the way the copper can be used, the palette can be changed mid screen for example if required. So, it's probably also worth looking at the game's copper list.

With HRTMon, use the "cop" command. This will return the address of the copper list in use. Then use the "h" command with the returned address to see a hex dump of the copper list and again look for $0180 which will tell you what color00 has been set to. You might find that there's multiple $0180 entries in the copper list so that way you'll be able to see what color00 has been set to at various points down the display. You'll know where down the display as, most likely, there'll be a preceeding copper wait instruction somewhere - it'll look something like: $4101,$fffe

You can also find out lots of other things about the display by looking at the copper list, for example how many bitplanes the display is set for by looking at the bplcon0 ($0100) register...

Last edited by pmc; 27 April 2010 at 09:39. Reason: Edited the address for BPLcon0 to be correct - thanks Asman! :-)
pmc is offline  
Old 27 April 2010, 09:26   #3
Krumelur
 
Posts: n/a
Quote:
Originally Posted by pmc View Post
Hello Krumelur
You can find palette information by looking at the colour registers. I would recommend loading the game into WinUAE with the HRTMon cartridge ROM attached.
That's great. Thanks. I'll see where I can find a ROM dump of this, err...ROM cartridge.

René
 
Old 27 April 2010, 09:27   #4
TCD
Registered User

TCD's Avatar
 
Join Date: Sep 2006
Location: Germany
Age: 42
Posts: 24,012
Quote:
Originally Posted by Krumelur View Post
I'll see where I can find a ROM dump of this, err...ROM cartridge.
It's built-in
TCD is offline  
Old 27 April 2010, 09:35   #5
Asman
68k

Asman's Avatar
 
Join Date: Sep 2005
Location: Somewhere
Posts: 718
Quote:
Originally Posted by pmc View Post

You can also find out lots of other things about the display by looking at the copper list, for example how many bitplanes the display is set for by looking at the bltcon0 ($0040) register...
Hi pmc,

I guess you mean about bplcon0 ( $0100 ) register, right ?

regards
Asman is offline  
Old 27 April 2010, 09:36   #6
pmc
gone
pmc's Avatar
 
Join Date: Apr 2007
Location: completely gone
Posts: 1,596
@ Asman - LOL - oooops, yes mate I did.

I've got blitter registers on the brain.
pmc is offline  
Old 27 April 2010, 09:40   #7
pmc
gone
pmc's Avatar
 
Join Date: Apr 2007
Location: completely gone
Posts: 1,596
Quote:
Originally Posted by Krumelur
That's great. Thanks. I'll see where I can find a ROM dump of this, err...ROM cartridge.

René
Go to the ROM section in WinUAE and select HRTMon from the cartridge ROM drop down.
pmc is offline  
Old 27 April 2010, 12:43   #8
Leffmann
 
Join Date: Jul 2008
Location: Sweden
Posts: 2,265
I haven't checked the game, but this sounds like the common method to save RAM and disk space, and to increase performance a bit. If each ghost consist of 8 colors there's no need to draw them all in 5 bitplanes each. You'd just store a single 3 bitplane ghost and then use its mask to alter the other 2 bitplanes to get 4 different ghosts.

Simpler example: if you want to draw 24 differently colored circles on the screen you wouldn't keep 24 circles of 5 bitplanes each in RAM, you'd just keep a single circle of 1 bitplane and draw/clear the bitplanes as needed to get a circle in the wanted color.
Leffmann is offline  
Old 27 April 2010, 23:50   #9
Krumelur
 
Posts: n/a
Quote:
Originally Posted by Leffmann View Post
I haven't checked the game, but this sounds like the common method to save RAM and disk space, and to increase performance a bit. If each ghost consist of 8 colors there's no need to draw them all in 5 bitplanes each. You'd just store a single 3 bitplane ghost and then use its mask to alter the other 2 bitplanes to get 4 different ghosts.
Yeah, that sounds a lot like it. Look at the new screenie I have attached. It shows 1bit mode. You can see that each ghost has three planes and then there are two images with horizontal bars. I think that's what you're talking about. The question is now: how can I get these to be shown correctly in GfxRip? If I set planes to 3 it looks wrong - 1st ghost is good, then there are 4 scarmbled one and then there's another okay image.
It only looks okay if I set 5 bits and hide plane 4 and 5.
Attached Thumbnails
Click image for larger version

Name:	ghosts.png
Views:	265
Size:	28.1 KB
ID:	25145  
 
Old 28 April 2010, 02:27   #10
Leffmann
 
Join Date: Jul 2008
Location: Sweden
Posts: 2,265
What you're seeing there are the masks for each ghost image. There are two of them and they have a dashed look because they are 32 pixels wide, and the latter 16 pixels on each line are cleared.
Leffmann is offline  
Old 28 April 2010, 10:24   #11
Krumelur
 
Posts: n/a
Quote:
Originally Posted by Leffmann View Post
What you're seeing there are the masks for each ghost image. There are two of them and they have a dashed look because they are 32 pixels wide, and the latter 16 pixels on each line are cleared.
Okay. Get it. Thanks. But why are the masks 32 pixels wide if the sprite is 16 pixels only? Or has the Amiga 32bit registers so you can mask 32 pixels in one step?

If you were to program this game (PacMania) on the Amiga, how would you save the tiles? They are 32x32 pixels but the game is in isometric perspective.
I can think of two ways. Paint them/design them isometric. Then make all rows start at x-column 0 (shift 1st row by 31 pixels, 2nd row by 30 pixels...) and save them as. Then when painting, shift the lines back to the correct x-position.
Second method would be to store the isomectric tile as is but that would waste memory because the tile would be wider as required. And memory was expensive back then :-)
I ask, because I cannot get a clear image of the tiles in GfxRip. They are somehow there.


René
 
Old 28 April 2010, 10:27   #12
Retro1234
Boo

Retro1234's Avatar
 
Join Date: Jun 2006
Location: 5150
Posts: 4,592
This might intrest you
http://sprites.walen.se/?level=search&searchterms=pac

:And this
http://eab.abime.net/showthread.php?...light=pacmania
Retro1234 is offline  
Old 28 April 2010, 11:14   #13
Krumelur
 
Posts: n/a
Indeed, this DOES interest me! But still I'm more after the technical details.
From the screens I cannot find out how the level tiles are stored.

But thanks a lot! This will come handy.

René
 
Old 28 April 2010, 11:56   #14
BippyM
Global Moderator

BippyM's Avatar
 
Join Date: Nov 2001
Location: Nottingham, UK
Age: 44
Posts: 8,948
I can't quite remember how I ripped them off hand, but try setting the first ghost to look right and then use f/g to move the offset until they all look right
BippyM is offline  
Old 28 April 2010, 11:58   #15
Krumelur
 
Posts: n/a
Quote:
Originally Posted by bippym View Post
I can't quite remember how I ripped them off hand, but try setting the first ghost to look right and then use f/g to move the offset until they all look right
I'm not worried about the ghosts. I can see them already in full glory but I'm still wondering about the level tiles.
 
Old 28 April 2010, 12:00   #16
BippyM
Global Moderator

BippyM's Avatar
 
Join Date: Nov 2001
Location: Nottingham, UK
Age: 44
Posts: 8,948
you need to set the screen height correctly. Find where the tiles are and stretch the screen height. Then set the bitplanes and it might lose some so play with the q/a keys until it looks right
BippyM is offline  
Old 28 April 2010, 12:12   #17
Leffmann
 
Join Date: Jul 2008
Location: Sweden
Posts: 2,265
Quote:
Originally Posted by Krumelur View Post
Okay. Get it. Thanks. But why are the masks 32 pixels wide if the sprite is 16 pixels only? Or has the Amiga 32bit registers so you can mask 32 pixels in one step?

If you were to program this game (PacMania) on the Amiga, how would you save the tiles? They are 32x32 pixels but the game is in isometric perspective.
I can think of two ways. Paint them/design them isometric. Then make all rows start at x-column 0 (shift 1st row by 31 pixels, 2nd row by 30 pixels...) and save them as. Then when painting, shift the lines back to the correct x-position.
Second method would be to store the isomectric tile as is but that would waste memory because the tile would be wider as required. And memory was expensive back then :-)
I ask, because I cannot get a clear image of the tiles in GfxRip. They are somehow there.
For this you would typically use the graphics blitter in the Amiga which provides acceleration to simple tasks like this, drawing masked bitmap graphics at arbitrary pixel positions.

The blitter works in 16 bit words and so a 16 pixel wide image might "touch" two adjacent 16 bit words in the screen bitmap, and so most programmers would wrongly think it was a must to add 16 pixels width to all images that were to be blitted on arbitrary positions. This would explain the mask, but I've no idea why the ghost images then are only 16 pixels.

The 32x32 format will be quickest when drawing the tiles, and if I was short on disk space and provided the tiles were narrow enough I would store them as 16x32 on disk, and only skew them into 32x32 when I load them to RAM.

EDIT: looking at some screenshots I see the tiles are 24x32 and 32x32 when skewed and on screen, so they're most likely stored as 32x32 as well, possibly 48x32 seeing as the programmers already did that once with the ghost masks.

Last edited by Leffmann; 28 April 2010 at 12:34.
Leffmann is offline  
Old 28 April 2010, 13:34   #18
Retro1234
Boo

Retro1234's Avatar
 
Join Date: Jun 2006
Location: 5150
Posts: 4,592
I dont know about single tiles but if you X880 - Y848 like Bippy's screen shot you can see the whole level.
Retro1234 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
How to Rip graphics (background and sprite) NubeCheCorre project.Sprites 5 19 September 2010 14:27
Questions about bitplane DMA Leffmann Coders. General 11 15 July 2008 15:08
bitplane modulos bluea Coders. General 0 09 July 2006 01:58
How to put the mask bitplane behind the other bitplanes?? method project.Sprites 6 15 February 2006 02:53
Save State = Rip Graphics & Mods? turk182 support.WinUAE 5 10 September 2004 16:37

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 07:55.


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