PacManPlus Posted May 23, 2016 Share Posted May 23, 2016 (edited) 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) 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). 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. bmp7800 -i:Sprites.bmp -o:Sprites.S -e127,127 -m:320a . 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 May 31, 2016 by PacManPlus 17 3 Quote Link to comment Share on other sites More sharing options...
toiletunes Posted May 23, 2016 Share Posted May 23, 2016 Thank you for being awesome. 4 Quote Link to comment Share on other sites More sharing options...
RevEng Posted May 23, 2016 Share Posted May 23, 2016 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! [edit - basic 7800 Dev Wiki entry added] 4 Quote Link to comment Share on other sites More sharing options...
Marc Oberhäuser Posted May 24, 2016 Share Posted May 24, 2016 3 Quote Link to comment Share on other sites More sharing options...
Trebor Posted May 24, 2016 Share Posted May 24, 2016 Very cool...[both the utility and the man]...Thank you! 2 Quote Link to comment Share on other sites More sharing options...
DracIsBack Posted May 24, 2016 Share Posted May 24, 2016 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. 2 Quote Link to comment Share on other sites More sharing options...
PacManPlus Posted May 24, 2016 Author Share Posted May 24, 2016 Thanks, Guys. I was hoping this would be useful 2 Quote Link to comment Share on other sites More sharing options...
+Atarius Maximus Posted May 25, 2016 Share Posted May 25, 2016 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! 2 Quote Link to comment Share on other sites More sharing options...
+frankodragon Posted May 25, 2016 Share Posted May 25, 2016 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? 1 Quote Link to comment Share on other sites More sharing options...
RevEng Posted May 26, 2016 Share Posted May 26, 2016 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) 2 Quote Link to comment Share on other sites More sharing options...
TXG/MNX Posted June 2, 2016 Share Posted June 2, 2016 AWESOME tool hope you can add the 320C and 320D modes aswell soon... I was playing around with the 7800Basic but stopped because I found the graphics converting to hard. This seems nice, also cool it's commandline so it can be scripted. 1 Quote Link to comment Share on other sites More sharing options...
SlidellMan Posted July 4, 2016 Share Posted July 4, 2016 That's a neat little tool you have there, Mr. DeCrescenzo! I was going to send a PM in regards to assembly how-tos, but changed my mind after thinking about it. 1 Quote Link to comment Share on other sites More sharing options...
Savage38 Posted October 7, 2016 Share Posted October 7, 2016 Thanks for this! Exactly what I was needing. Tis going to save me so much time. 1 Quote Link to comment Share on other sites More sharing options...
Roy Posted February 8, 2017 Share Posted February 8, 2017 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! 1 Quote Link to comment Share on other sites More sharing options...
Heaven/TQA Posted April 26, 2017 Share Posted April 26, 2017 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 Quote Link to comment Share on other sites More sharing options...
PacManPlus Posted April 26, 2017 Author Share Posted April 26, 2017 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 2 Quote Link to comment Share on other sites More sharing options...
Heaven/TQA Posted April 26, 2017 Share Posted April 26, 2017 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 . 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? Quote Link to comment Share on other sites More sharing options...
Heaven/TQA Posted April 26, 2017 Share Posted April 26, 2017 well... when using a default 8x16 dummy BMP a simple bmp7800... generates a source file with 128 hex values per line... when looking into memory it does $9000... $0980... etc next line data Quote Link to comment Share on other sites More sharing options...
PacManPlus Posted April 26, 2017 Author Share Posted April 26, 2017 Hey! I'm at work right now, but please PM me the BMP file you are using and I will take a look at it. Please make sure it's set at 256 colors... I don't know what will happen otherwise... Thanks, Bob 2 Quote Link to comment Share on other sites More sharing options...
Heaven/TQA Posted April 26, 2017 Share Posted April 26, 2017 Sent Quote Link to comment Share on other sites More sharing options...
Traxx Posted April 3, 2022 Share Posted April 3, 2022 Thank you PacManPlus,I've been doing graphic data by hand in binary Quote Link to comment Share on other sites More sharing options...
PacManPlus Posted April 3, 2022 Author Share Posted April 3, 2022 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 Quote Link to comment Share on other sites More sharing options...
Ecernosoft Posted June 11, 2022 Share Posted June 11, 2022 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. ? Quote Link to comment Share on other sites More sharing options...
Ecernosoft Posted June 11, 2022 Share Posted June 11, 2022 But lets be honest, I seriously don't know anyone who uses 320D. Quote Link to comment Share on other sites More sharing options...
Synthpopalooza Posted June 13, 2022 Share Posted June 13, 2022 (edited) 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 June 13, 2022 by Synthpopalooza 1 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.