Jump to content







Photo

52-pixel bitmap tool

Posted by , 26 February 2006 · 50 views

(52 and 48 pixel Pac-Man logos by DEBRO)I have attached a tool that converts a 52-pixel wide BMP file to assembly code that can be plugged into a kernel. The BMP file should be set to 256 colors, but the program only reads it as monochrome. To set the colors for each line, you have to manually change the data in the C code. If you don't have a compiler, you can edit the assembly code too.You will see from the code that it uses a lot of ROM. The routine takes 56 bytes per line. However as most homebrews are less than 32K, you can probably fit in your image. Also the shape and colors of the bitmap are static due to immediate addressing. If you need to save space or want animation, you may be better off with a 51-pixel image.The maximum height within a single 4K bank is about 67 lines.Let me know if you have any questions, because there could be some detail I forgot to explain. Have fun!

Attached Thumbnails

  • Attached Image

Attached Files






Hello,

I like the idea of reading a bitmap, since I plan to do the same for use in a track editor, and I don't want to spend countless hours making a track editor utility (e.g. like the Indy 500 editor.)

The only issue I see with your code (and potentially mine) is it appears that you assume a fixed-size header. As I understand, this isn't always the case. Or am I wrong?

EDIT: just checked since I want to read BMP files too. The header is a fixed size but the image data doesn't necessarily start right after it - I think that palette data may be there instead. Anyway, offset $0A contains the offset to the start of image data, in case you get a weird BMP file.
  • Report
I don't remember all the details, but I did study the BMP structure at one time. I remember that there is header data, pallette data, and finally graphics data. Clearly the pallette data will be longer for a 16 bit color image than an 8 bit one.
  • Report
This is pretty cool. I'm not sure how much the extra 4 pixels is worth having to unroll the loops this way, though.
  • Report

mos6507, on Tue Feb 28, 2006 9:01 PM, said:

This is pretty cool.  I'm not sure how much the extra 4 pixels is worth having to unroll the loops this way, though.
It depends. I'm using it for my title screen so I can get a font similar to the one used in the 7800 Ms. Pacman. I may look similar to the 48-pixel one I did but I can tell the difference. Maybe I'll post a screen shot of both and let you decide.

Now that I used the tool and optimized the code that was produced, I might look into seeing if I can squeeze more pixels out of this like John suggested.

Good work Zach.

I hope the other [stella] members will know about this :)
  • Report

mos6507, on Tue Feb 28, 2006 8:01 PM, said:

This is pretty cool.  I'm not sure how much the extra 4 pixels is worth having to unroll the loops this way, though.
I consulted with Nathan about the worth of four extra pixels before doing the work. It's easy to appreciate the extra width the first time you see it on a TV. It'll be unlike anything you've seen before on a 2600. Furthermore, remember that an 8K and 32K game cost the same to publish, so in a sense, ROM is cheap.
  • Report
I can see why Nathan would certainly clamor for more pixels - the artist who is creating the bitmap will always want and appreciate every last pixel you can squeeze out - but, IMO, 90% of the time most folks won't notice unless you tell them and show them a comparison.

I could be wrong. :)
  • Report

vdub_bobby, on Wed Mar 1, 2006 1:58 AM, said:

I can see why Nathan would certainly clamor for more pixels - the artist who is creating the bitmap will always want and appreciate every last pixel you can squeeze out - but, IMO, 90% of the time most folks won't notice unless you tell them and show them a comparison.
Probably so. Since I've seen the comparison I don't know which I like better. Well, I do like the 52-pixel version but I might be satisfied with the 48 pixel version. The 52 pixel version does look better IMO and I might be able to squeeze more pixels into this too. It may come down to ROM space for me.

I was going to post a screen shot but I can't add an attachement to my post :)
  • Report
No attachments are allowed to blog comments.
  • Report
About time that Dennis runs his own blog :)
  • Report
As far as creativity with fonts, some creativity can be used in giving the illusion of more than 48 pixels already by shearing the graphic with HMOVE (think italics).
  • Report

Cybergoth, on Wed Mar 1, 2006 10:33 AM, said:

About time that Dennis runs his own blog :)
I thought I read somewhere that he does already...hmmmm

EDIT: http://www.atariage....dpost&p=1010132

;)
  • Report

vdub_bobby, on Wed Mar 1, 2006 3:00 PM, said:

Cybergoth, on Wed Mar 1, 2006 10:33 AM, said:

About time that Dennis runs his own blog :)
I thought I read somewhere that he does already...hmmmm

EDIT: http://www.atariage....dpost&p=1010132

;)
Yeah it was an experiment. I haven't been back there since January or the first part of February after they deleted my last post. I just haven't found the time to update a blog lately. http://dnsdebro.blogspot.com/
  • Report

DEBRO, on Wed Mar 1, 2006 11:35 AM, said:

I was going to post a screen shot but I can't add an attachement to my post :)
Thanks for sending me the screen shot, Dennis. I added it to the top of the thread.
  • Report
Hm... The big one is no real improvement IMO. Especially the Pac-C looks even better in the small one. It seems as if a 49 pixel bitmap to do a proper "P" would be good enough :)
  • Report
How 'bout doing a tool for 56 pixels? The leftmost four and rightmost four pixels would have to fit one of these patterns:
XXXX
XXX-
XX-X
XX--
X-XX
X--X
X---   (with the next pixel also being blank)
-XXX
--XX
---X  (with the previous pixel also being blank)
----
and not these
X-X-
-XX-
-X-X
-X--
--X-
Code should be fairly straightforward.
  • Report

supercat, on Wed Mar 1, 2006 6:20 PM, said:

How 'bout doing a tool for 56 pixels?  The leftmost four and rightmost four pixels would have to fit one of these patterns:
It's a good idea, but I've got a homebrew to finish. I going to stick with 52 pixels for the Four-Play title screen becuase Nathan's artwork doesn't work in 56. So far, you've only seen the text, but there is more.

I think Nathan's work will provide a better example of the advantages of 52 pixels.
  • Report

May 2012

S M T W T F S
  12345
6789101112
13141516171819
202122 23 242526
2728293031