Jump to content

Photo

Aquarius Bitmap Graphics Tool


149 replies to this topic

#1 chjmartin2 ONLINE  

chjmartin2

    Moonsweeper

  • 265 posts
  • Location:Massachusetts

Posted Sat Nov 27, 2010 2:32 PM

I have put together this tool to allow you to convert an 80x72 16 color bmp file into an aquarius basic program. I used Quickbasic 4.5 to do this under DOSBox because frankly, I am not a good programmer and I had found a BMP file reader for GW-Basic. (That tool is really cool too - it lets you convert 16 color bmp files into composite cga At vogons)

I wanted a way to do some graphics on my Aquarius and I couldn't find any kind of utility, so I went ahead and took on the challenge. The lack of a true graphics mode was very frustrating at first, but I figured out something that I think is really neat. If you take each character byte by byte, so for example, a full block would be 1,1,1,1,1,1 and you determine its binary value(in this case, 63) you will find that the character in the character map right before it is just one less than its binary value and so forth. The graphics characters are two sets and so if the binary value is 31 or less just add 160 to it and you can the corresponding character. If it is greater than 31 just add 192 and you'll get the corresponding character. This made conversion from a series of dots to a character very easy. (Nice job to whomever laid out the character map.)

Anyway, the converter loads in the bitmap (which must utilize the color pallette included in the package) and then determines the optimal color for each 2x3 block. (As you all know we are limited to 2 colors per character block, but at least they can be one of 16.) Then the converter looks at the color distance from each of the two it picks and assigns accordingly. (I am not sure exactly what happens in the case of 6 different colors per block and it did not impact my output, so I've chosen to blistfully ignore it for now.)

Because I didn't have a lot of memory on my physical aquarius to work with (you didn't think I would go through this much work just to see it on an emulator) I had to figure out how to encode the data in a way that I could then decode on the aquarius. Since I am not a good programmer and I do not know machine language, all I could do is go ahead and write a basic program using a basic program. I managed to get it to work with my 16K cartridge installed, but I'd love to get it to work on a stock aquarius.

I took three sets of data, one for the character, one for the foreground color and one for the background color and went ahead and run length encoded them. So if I had color 15,15,15,15,15 that would turn into 15, 5. I then wrote a program to decode it and display it. (I know you like how I stored the foreground color and then PEEKED it back to do both fore and background.)

Lastly, if any of you have a better way to encode and decode a bitmap (like directly loading from cartridge to video) then let me know, because this is the best I could come up with.

The attached zip has a folder called AqBasic which are the Aquarius Basic Program output from the converter, you can use the Quicktype feature on Virtual Aquarius to check them out. It also has a BMP folder with the source images for you to play around with. The resource directory contains the conversion program (Quick Basic 4.5 - have to run qb45 from the directory that contains BMP files) and the Pallette to use in Photoshop if you want to do your own conversions.

Original BMP
Attached File  homcol.bmp   2.93KB   95 downloads

DOS BOX Converter
utility.jpg

ON EMULATOR
homvaq.jpg

ON REAL AQUARIUS
homra.jpg


To do (maybe): Figure out how to get the data compressed enough to run on a stock aquarius
Make a better converter (like the guy who makes the awesome C64 ones) in Windows that lets you do the down converting and everything

Attached Files



#2 Jay Silverheels OFFLINE  

Jay Silverheels

    Moonsweeper

  • 375 posts
  • Location:Washington D.C.

Posted Sat Nov 27, 2010 5:56 PM

Are you kidding me?! That looks great! I'm impressed.

#3 jaybird3rd OFFLINE  

jaybird3rd

    Quadrunner

  • 6,930 posts
  • Location:806.4616.0110

Posted Sat Nov 27, 2010 6:32 PM

Wow, very nice job! I should seriously consider adding this capability to my Aquarius Screen Builder. It already has the ability to import text, but importing bitmaps as "bloxel" data would be a powerful addition. The "slideshow cartridge" program that I wrote can easily display (uncompressed) text and character data directly from the cartridge, and it would be very easy to display these converted bitmaps from the cartridge as well. This would be much faster than drawing them in BASIC, and would not require any expanded RAM. It's too bad that you're limited to two colors per character, but I'm sure you can get around that limitation by "tweaking" the bitmap in such a way that no more than two colors appear in a given 2x3 pixel area.

That's also very interesting about the method of locating the correct "bloxel" character in the character set according to its binary value. I knew there had to be a reason why those characters were assigned the way they were, but I haven't used them enough to have figured it out on my own. It's a pretty clever way of getting around the lack of true pixel graphics on the Aquarius.

I'll definitely give your utility a try myself before the weekend is over.

#4 chjmartin2 ONLINE  

chjmartin2

    Moonsweeper

  • Topic Starter
  • 265 posts
  • Location:Massachusetts

Posted Sun Nov 28, 2010 3:12 PM

Here are some screencaps of all of the images that I have converted over to Aquarius.

arielaq.jpg aztecaq.jpg
britaq.jpg c64aq.jpg
cartaq.jpg jeraq.jpg
jessaq.jpg marioaq.jpg
mattaq.jpg mickaq.jpg
monaaq.jpg papaaq.jpg
patsaq.jpg popaq.jpg
popeyeaq.jpg

Attached Thumbnails

  • staraq.jpg


#5 Jay Silverheels OFFLINE  

Jay Silverheels

    Moonsweeper

  • 375 posts
  • Location:Washington D.C.

Posted Sun Nov 28, 2010 4:26 PM

I can't tell you how much I love this. Next, is animation. ;-)

Seriously, this is just cool. Thank you.

#6 the-topdog OFFLINE  

the-topdog

    Stargunner

  • 1,724 posts
  • Location:Washington State, USA

Posted Mon Nov 29, 2010 12:26 PM

These past 12 months, the Aquarius has seen a revival like nothing else I have witnessed in vintage computing. This is awesome!

Edited by the-topdog, Mon Nov 29, 2010 12:26 PM.


#7 psquare75 OFFLINE  

psquare75

    Dragonstomper

  • 697 posts
  • Location:Assonet, MA

Posted Tue Nov 30, 2010 10:31 AM

You should scan an aquarius game box and convert it. :D

#8 mvdsteenoven OFFLINE  

mvdsteenoven

    Chopper Commander

  • 158 posts
  • Location:Netherlands

Posted Tue Nov 30, 2010 12:34 PM

Awesome! That is really great stuff!

But, I don't get that 4th image, just above Jerry
Some kind of bird or something :?

#9 the-topdog OFFLINE  

the-topdog

    Stargunner

  • 1,724 posts
  • Location:Washington State, USA

Posted Tue Nov 30, 2010 12:52 PM

Awesome! That is really great stuff!

But, I don't get that 4th image, just above Jerry
Some kind of bird or something :?


Hey! Leave the Commodore logo alone! :D

#10 Curt Vendel OFFLINE  

Curt Vendel

    River Patroller

  • 4,441 posts
  • Location:Carmel, New York

Posted Tue Nov 30, 2010 2:23 PM

How are Aquarius keyboards holding up with age, I am wondering if they get stiff and unresponsive after non-use for long periods of time.

Did anyone ever try to interface a disk drive to an Aquarius?

#11 Chuck D. Head OFFLINE  

Chuck D. Head

    River Patroller

  • 3,178 posts
  • Mod Mod Mod
  • Location:Woodland, WA

Posted Tue Nov 30, 2010 2:34 PM

How are Aquarius keyboards holding up with age, I am wondering if they get stiff and unresponsive after non-use for long periods of time.


I've only had mine a short while, but it seems to be similarly tactile to any other 25 year old chicklet keyboard. The rubber keys are easier for me than the larger plastic ones of the Coco and the like.

Did anyone ever try to interface a disk drive to an Aquarius?


Again, I'm an Aquari-noob so I dont know the answer, but I am getting a warm fuzzy feeling that Curt is taking an interest..... :love:

#12 Chuck D. Head OFFLINE  

Chuck D. Head

    River Patroller

  • 3,178 posts
  • Mod Mod Mod
  • Location:Woodland, WA

Posted Tue Nov 30, 2010 2:37 PM


Awesome! That is really great stuff!

But, I don't get that 4th image, just above Jerry
Some kind of bird or something :?


Hey! Leave the Commodore logo alone! :D


I was going to pick on the one below mona lisa; is that a logo for a new brand of spy camera?? morgan

#13 jaybird3rd OFFLINE  

jaybird3rd

    Quadrunner

  • 6,930 posts
  • Location:806.4616.0110

Posted Tue Nov 30, 2010 2:52 PM

How are Aquarius keyboards holding up with age, I am wondering if they get stiff and unresponsive after non-use for long periods of time.

I own six of them, and they've all worked fine for me so far, even the ones that arrived dirty and beat up. They're also fairly easy to take apart and clean.

Did anyone ever try to interface a disk drive to an Aquarius?

There were two disk drive interfaces, as far as I know: a QuickDisk interface and drive, which used 2.8" media, and a homebrew interface for the Commodore 1541. Both had the interface hardware inside a cartridge, along with special versions of Extended BASIC which contained additional DOS commands. The QuickDisk had a passthrough cartridge port on the back of the drive, for use with RAM cartridges.

Both interfaces are very rare; I believe there were only a few units made of each. A cassette interface was built into the computer, so that's really the only established standard for persistent storage on the Aquarius. I've often thought about skipping the floppy drive altogether and developing a flash cartridge, as a follow-up to my new cartridge boards: all of the Z80 CPU signals are available through the cartridge port, and there are no real backward compatibility issues to worry about, so it's possible to start totally from scratch.

#14 psquare75 OFFLINE  

psquare75

    Dragonstomper

  • 697 posts
  • Location:Assonet, MA

Posted Tue Nov 30, 2010 2:56 PM

Straight to SD card, perhaps? :ponder:

#15 jaybird3rd OFFLINE  

jaybird3rd

    Quadrunner

  • 6,930 posts
  • Location:806.4616.0110

Posted Tue Nov 30, 2010 3:04 PM

Straight to SD card, perhaps? :ponder:

Sure, why not? With a microcontroller to handle the I/O, it could even use a native FAT32 filesystem directly. There are all kinds of options that you don't necessarily have with other classic computers, because on those machines, the new solution also has to be backward compatible with the original floppy drives. There were so few disk drives made for the Aquarius that this isn't a limitation.

#16 mvdsteenoven OFFLINE  

mvdsteenoven

    Chopper Commander

  • 158 posts
  • Location:Netherlands

Posted Wed Dec 1, 2010 12:09 PM

Did anyone ever try to interface a disk drive to an Aquarius?


I have a schematic for a 5.25" floppy drive interface. But the interface has no room for an EPROM, so it is pretty useless.

#17 chjmartin2 ONLINE  

chjmartin2

    Moonsweeper

  • Topic Starter
  • 265 posts
  • Location:Massachusetts

Posted Sat Dec 4, 2010 2:19 PM

I have been trying to work on this program and I have a lot of inspiration but I just can't seem to get it done. First I decided that using just the bloxel characters is very limiting. The Aquarius has 40 characters by 24 characters. The bloxel resolution is 2x3 (2 wide by 3 tall) but they are made from 8x8 bit characters. So you really have 40 * 8 = 320 x 24 * 8 = 192. I want to write a program that takes a 320x192 image and converts it into the best fit of any of the 8x8 characters versus the colors in each 8x8 cell. It is not going well. First I tried to make an image of each character and run it through a mosaic program and that didn't do well. Then I tried to make a font file for windows and tried to use an image to ascii converter. The converter worked great, but it doesn't support .FNT fonts and I can't make a true type font. My last thought would be to somehow write a program to compare the bits of the characters to the bits of the 8x8 square that I've downsampled to 2 colors. I can get the image loaded, I can downsample each 8x8 block to 2 colors (I had to do this for my first program) but what I can't do is figure out which character to use for the 8x8 cell. The problem is that when I was going from bitmap to bloxel - I had every choice I wanted, any combination of the 64 available in each 2x3 cell. By using the characters, I also want to match the "essence" of the character, which is what the good image to ascii converters do, or good mosaic programs do. I think I could match this by having two arrays of 8,8 each filled with the bit values of the source image and the various aquarius characters and then compare how many bits match and take the one with the highest matches - the problem is that this means each 8x8 block would have to be compared to 256 characters and each bit in each block has to be compared (8x8=64 comparisons) we have 40 x 24 x 256 x 64 computations, roughly 15.7 million. Obviously no big deal for a modern computer, but a big deal for the high level language through an emulator that I am using. I'd like to figure out a method to reduce the 8x8 blocks down to a single number or a set of three numbers and figure out a way to do the same for the source blocks and be able to do one comparison for each block. As an example I could create a unique value for each block by converting it to the binary equivalent but that seems silly and I only want to do it because I think in base 10 and not binary. Does anyone have any thoughts about a good way to make the comparison? I feel like I am too close to the problem because I have fought with so many ways to do it, but I think the image quality will be much higher if I use the other characters in the character set as there are graphics characters beyond the bloxel's that could be used as well.

#18 Jay Silverheels OFFLINE  

Jay Silverheels

    Moonsweeper

  • 375 posts
  • Location:Washington D.C.

Posted Sat Dec 4, 2010 2:44 PM

I'll skip all the gushing about how much I love what you are doing with this, and that I expressed a dream for this years back at the Aquarius Yahoo group.

Thinking out loud, here (I am not a programmer, and do all programming work by trial and error):

-First categorize the Aquarius character set (all 512, including negatives) into classes based on the number of lit pixels within the 8x8. (65 levels, from 0 lit pixels to 64 lit pixels)

-Starting with the first 8x8 square of the two-toned source image, count the number of lit pixels, so you know which class to compare it to.

-Compare each member of the like class to the source square. The one with the most same pixels lit, is the winner.

-If there is a tie, then...?

Wait, now, I'm thinking you should do the same thing, but be comparing unlit pixels, because it may be more damaging to the image to have extra pixels where they shouldn't be, rather than missing pixels where they should be.


No matter what, I am eagerly looking forward to what comes out of this. Please don't give up. I want to see the world through the Aquarius' eyes. ;)

#19 chjmartin2 ONLINE  

chjmartin2

    Moonsweeper

  • Topic Starter
  • 265 posts
  • Location:Massachusetts

Posted Sun Dec 5, 2010 3:57 PM

Quick Basic was just way too slow for my use, so I decided to bite the bullet and at least learn Freebasic. Freebasic is actually pretty cool and lets me work in a better environment. I can write QuickBasic type of commands and make it work. Feels much closer to home. I didn't like it at first but then I downloaded an IDE for it and now I really like it. Here is a link to the IDE (bundled with FreeBasic.)

http://fbide.freebasic.net/

So... I used that program and with just a little bit of tweaking I was able to get my bitmap converter compiled. It runs right from windows. Just plop the executable into a directy with properly formatted bitmaps and you are done. It'll show a cheap console window, but man, it runs soooo much faster. I turned on all of the debug code and it still flies through. I had an attachment up but realized that some of my file IO didn't convert over correctly. Didn't REALLY test it. So... next thing out will be a proper converter.

I want to do more to it to make it a proper converter before I put anything else out. I am going to try to use the routines to build a windows screen, select a file, etc. and make it look more like a real application. This work will be important because I tried to start creating my character converter in QuickBasic and it ran out of memory very quickly. Since I have to move to Freebasic, I'm just going to go ahead and do it the right way. I want to learn how to bring in a bitmap of any size and colors and down convert. I'd like to have a cropping tool and adjust brightness/contrast, and for kicks an editor would be great. I think I have a good shot at doing these things, so that is what I will try.

Edited by chjmartin2, Sun Dec 5, 2010 4:36 PM.


#20 chjmartin2 ONLINE  

chjmartin2

    Moonsweeper

  • Topic Starter
  • 265 posts
  • Location:Massachusetts

Posted Sat Dec 11, 2010 12:53 AM

Ok... I have the basic converter working really well. Before I release the code/app I want to allow for user selectable character sets. Anyway, here are some sample images using the complete character set. I am actually really impressed with my own work! Ha! I think you'll like them.

Aquarius.jpg ass.jpg
bart.jpg brit.jpg
bugs.jpg cleav.jpg
dandd.jpg kiss.jpg
mario.jpg skelet.jpg
windows.jpg zelda.jpg

#21 Jay Silverheels OFFLINE  

Jay Silverheels

    Moonsweeper

  • 375 posts
  • Location:Washington D.C.

Posted Sat Dec 11, 2010 8:54 AM

Awesome, again. These are really looking nice.

Loving it, over here.

However, I noticed you are still using the inferior character set rom that comes standard with the VAQ.

You may want to download Jaybird3rd's definitive character rom dump. The VAQ allows you to import a different character rom.

Edited by Jay Silverheels, Sat Dec 11, 2010 8:59 AM.


#22 jaybird3rd OFFLINE  

jaybird3rd

    Quadrunner

  • 6,930 posts
  • Location:806.4616.0110

Posted Sat Dec 11, 2010 9:05 AM

Yes, indeed! Nice work.

Here is a copy of the character ROM, in case you'd like to give it a try:

Attached File  AquariusCharacterSet.bin.zip   1.2KB   123 downloads

#23 chjmartin2 ONLINE  

chjmartin2

    Moonsweeper

  • Topic Starter
  • 265 posts
  • Location:Massachusetts

Posted Sat Dec 11, 2010 9:22 AM

I will try and post new stuff soon. I can't get enough of it. You guys will like the converter. Promise you'll play with it - I want to see somebody else's work! :)

#24 Jay Silverheels OFFLINE  

Jay Silverheels

    Moonsweeper

  • 375 posts
  • Location:Washington D.C.

Posted Sat Dec 11, 2010 9:24 AM

I promise!! ;-)

#25 chjmartin2 ONLINE  

chjmartin2

    Moonsweeper

  • Topic Starter
  • 265 posts
  • Location:Massachusetts

Posted Sat Dec 11, 2010 9:35 AM

How can you tell which one is which? I am not sure if my program is using the correct character set or the incorrect one. Here is what the converter uses as the character set.

Attached File  aqchar.bmp   2.06KB   109 downloads




0 user(s) are browsing this forum

0 members, 0 guests, 0 anonymous users