Jump to content
IGNORED

Bitmap to 7800 Graphics Converter


Recommended Posts

Hi Everyone:

 

I've just completed BMP7800

BMP7800 is a utility to convert 256-Color Bitmaps to 7800 data.

 

It takes a .BMP file (only 256 colors are supported) and converts it to an assembly include file to be used with the ".include" directive in DASM in your source program. The colors are determined by the order the utility 'finds' the colors as it process the bitmap file. (This can be changed with the '-c' option explained below.)

The utility also supports 'mixed mode' bitmaps, where more than one display mode is contained within a single bitmap.

 

It uses the .NET 4 Framework, and is called from the command line:

 

bmp7800 -i:(name) -o:(name) [-c(color list)] [-m:(display mode)] [-z(scan lines per zone)] [-s(starting x,y point)] [-e(ending x,y point)] [-a] [-f]

 

Options:

-i: The absolute path/filename of the input bitmap file (e.g. -i:C:\DEV\7800\CHARMODE.BMP) - Required

-o: The absolute path/filename of the output assembly file (e.g. -o:C:\DEV\7800\CHARMODE.S) - Required

-c Specify the color palette index order, separated by commas (e.g. -c219,4,173) - Optional, order is by discovery if not specified.

-m: Display mode, valid values are (-m:160a, -m:160b, -m:320a, -m:320b, -m:320c*, -m:320d*) - Optional, default is 160a if not specified.

-z Number of scan lines per zone, valid values are 1-16 - Optional, default is 16 if not specified

-s Starting x,y point. This specifies the upper-left corner of the graphics within the bitmap you are trying to convert. This option is

usually (but not always) used when working with a mixed mode bitmap. - Optional, default is 0,0 if not specified

-e Ending x,y point. This specifies the lower-right corner of the graphics within the bitmap you are trying to convert. This option is also

usually (but not always) used when working with a mixed mode bitmap. - Optional, default is the end of the bitmap if not specified

-a Append mode. This option is used when working with a mixed mode bitmap. It tells the utility to a) append the data to the Output file, and b)

don't pad the bytes out to a page length. You would use this option for every pass of the utility (including the final one - see example) - Optional

-f Final mode. This option is used with the '-a' option above. It allows append mode to add the data to the output file, but additionally

pads the bytes out to a page length. It also allows the final preparation for DASM. (see example below) - Optional

 

*320c and 320d modes are not supported, yet.

Please note that when working with bitmaps that will be used for a single resolution on the 7800 (i.e. most of the time), you do not use the '-a' or '-f' options.

There is some error checking done by the application, and it will stop to let the user know if there is something wrong.

 

Upon successful completion, the utility will display to the user:

* The display mode

* The size of the input bitmap

* The zone size (i.e. number of scan lines per zone)

* The starting and ending points.

* The color indices, in the order it found them or was specified.

 

It will also display any warnings, i.e. if the output file isn't found when specifying the '-a' option (which is needed for the first run), or if the height of the bitmap is not evenly divisible by the zone height.

 

Examples:

(Please note that I had to convert these to PNG graphics so they would display)

post-1787-0-09136800-1464042512.png

BMP7800 -I:CHARMODE.BMP -O:CHARMODE.S -C1,2,3 -M:160A -Z16 -E127,127

(Please note that you do not need the '-M:160A', '-E127,127' or the '-Z16' option here; I put it in for completeness).

post-1787-0-42193200-1464042512.png

DEL CHARMODE320.S
BMP7800 -I:CHARMODE320.BMP -O:CHARMODE320.S -A -C8,9,13,6,10,14,1,2,16,4,17,18 -M:320A -Z8  -S0,0  -E127,47
BMP7800 -I:CHARMODE320.BMP -O:CHARMODE320.S -A -C8,9,13,6,10,14,1,2,16,4,17,18 -M:160A -Z16 -S0,48 -E127,95
BMP7800 -I:CHARMODE320.BMP -O:CHARMODE320.S -A -C8,9,13,6,10,14,1,2,16,4,17,18 -M:160B -Z16 -S0,96 -E127,111 -F

(Also note that being we are using 'append' mode here, you must delete the file first to make sure we aren't appending to an existing file)

...and, for the 320A mode, you don't need any color index past '-C8' (because it only uses one color), and the same with 160A mode and '-C8,9,13'. I just did that because I like things to line up. :D

 

post-1787-0-75235400-1464042512.png

bmp7800 -i:Sprites.bmp  -o:Sprites.S  -e127,127 -m:320a

.

 

post-1787-0-07849000-1464042513_thumb.png

bmp7800 -i:Sprites2.bmp  -o:Sprites2.S  -e1023,15 -m:320b -z16 -c8,7,6

.

NOTE: modes 320C and 320D have not been implemented yet.

I hope this will help everyone. I have also included source code, which is written for Visual Studio .NET 2012 in C#.

Thanks,

Bob

 

 

Thanks to RevEng and Albert for some ideas and discussion. :)

BMP7800.zip

BMP7800SourceCode.zip

Edited by PacManPlus
  • Like 17
  • Thanks 3
Link to comment
Share on other sites

Ideas are cheap, and code isn't. :)

 

What I love about this utility is it's simple and straightforward to use for basic sprite-sheets, but allows you to pull off complex tricks too. Want to pull from multiple sprite-sheet bitmaps and combine different modes into one graphics data block? It does that. Want to do the same, except using different regions from a single sprite-sheet bitmap? It does that too.

 

Thanks for coding and sharing this tool Bob, and sharing the source code too! :D

 

[edit - basic 7800 Dev Wiki entry added]

  • Like 4
Link to comment
Share on other sites

Thanks Bob! Love stuff like this!

 

As an aside, this got me all pumped up thinking about one of my interests in the 80s ... seeing digitized photos on an 8bit computer. So common place now, but in 1986, it was COOL to see that!

 

Loved the digitized shots you used in your unreleased REzolve project.

  • Like 2
Link to comment
Share on other sites

I haven't tried this out yet, but I'm excited about the possibilities for 7800Basic developers. Creating graphics is a pretty big roadblock for new users and this could lower the bar a little bit. Thanks for sharing this Bob!

I agree. Is it in the works to be implemented with 7800Basic as it seems to be available so far for the DASM assembler?

  • Like 1
Link to comment
Share on other sites

I'd be glad to add an "incgraphicblock" statement, or something along those lines. IMO using the sprite-sheet approach of BMP7800 vs. the single-sprite approach of 7800basic's incgraphic doesn't simplify things, so much as trade-off areas of complexity.

 

SPRITE-SHEET: makes palette management easier for multiple related sprites. Editing multiple sprites at the same time is easier.

SINGLE-SPRITE: rearranging graphics is easier. color-import of multiple palettes possible. no need to specify each sprite's byte-index and byte-width.

 

When using the proposed "incgraphicblock", the 7800basic coder would need to supply the info that incgraphic would automatically supply. (same as assembly coders do)

  • Like 2
Link to comment
Share on other sites

  • 1 month later...
  • 3 months later...
  • 4 months later...

For anyone looking for something other than photoshop or gimp, I have started using Aseprite to make my spritesheets.

 

Works great with Bob's program when you specify Aseprite to use its indexed color mode and use a canvas size of either 128 * 64 or 128 * 128 depending on 8 or sixteen high zones. Export as a bmp and feed it to BMP7800.

 

Late to the party here, but thanks for the program bob! :thumbsup:

  • Like 1
Link to comment
Share on other sites

  • 2 months later...

have some question to the tool... I am not able to convert a proper bmp file...

 

so...in Gimp... it only works with greyscale bmp (so I loose colors)... and i need to reduce to 3 colors instead of 4... but then I loose again another color in gimp...

 

further... if I have a gfx which is 160x48... do I need to expand it to 1024x48 and then transfer 3x each zone and append?

 

is there another tool to generate interlave sprite sheets? if not... I guess I need to write my own :D

Link to comment
Share on other sites

Hey!

 

I'll try to help. What is happening when you try to convert four BMP file? Do you get an error? or a corrupt file? What does the output on the screen say?

Also Technically it is three colors, as one of them (the first one) is for the background.

 

Regarding the size, if you are using the same screen mode (i.e. 160A) for the entire .BMP, you don't have to run it 3 times. Run it once for the whole bitmap, specifying the size of the zone (-z8, or -z16, etc.) and it will figure out where the splits are.

PM me if you still have trouble.

 

Bob

  • Like 2
Link to comment
Share on other sites

bob... thanks...

 

why 3 colors incl. background? 01,10,11,00? are 4 combos ;) but I am not familiar. I am wondering that i managed all the stuff 2003 and totally fail 2017 :D.

 

so issue with converting complete 160x48 logo gfx was with BMP7800.exe -i:desire.bmp -o:desire.s the generated source file does not work out of the box in my code....

 

so how would that be generated in the source? what is the layout 40 bytes zone1 40 bytes zone2 40 bytes zone3 assuming standard default values 160a and default zone size 16?

Link to comment
Share on other sites

  • 4 years later...
  • 2 months later...
On 4/3/2022 at 8:31 AM, PacManPlus said:

Awesome!  Glad to see this getting some use!

 

At some point I need to add 320C and 320D modes.  Does anyone use them?

 

Thank you,

Bob

I do! I used them in my failed (for the something time) attempt at making beach runner, but I just don't have the patience to make games on my own, HOWEVER, I'm willing to help others make their games. ?

Link to comment
Share on other sites

I've messed with 320D ... experimentally, but it was an experiment in interlace to try to get the equivalent of 320B with lower DMA costs.  I still don't think it worked very well.

 

What you could do in this case, is generate a 320B fontmap from this, then de-interlace it into two 320D maps.  The idea is you combine a font swap with a color register cycle to make interlacing on vertical lines.

Edited by Synthpopalooza
  • Like 1
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...