Jump to content
IGNORED

Aquarius Bitmap Graphics Tool


chjmartin2

Recommended Posts

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

homcol.bmp

 

DOS BOX Converter

post-20571-129088938053_thumb.jpg

 

ON EMULATOR

post-20571-129088957598_thumb.jpg

 

ON REAL AQUARIUS

post-20571-129088974791_thumb.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

AQGraph.zip

  • Like 2
Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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:

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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. ;)

Link to comment
Share on other sites

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
Link to comment
Share on other sites

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.

 

post-20571-129205026286_thumb.jpgpost-20571-129205026534_thumb.jpg

post-20571-129205026586_thumb.jpgpost-20571-129205026664_thumb.jpg

post-20571-129205026727_thumb.jpgpost-20571-129205026837_thumb.jpg

post-20571-129205026926_thumb.jpgpost-20571-129205027015_thumb.jpg

post-20571-129205027071_thumb.jpgpost-20571-129205027137_thumb.jpg

post-20571-129205028632_thumb.jpgpost-20571-129205028747_thumb.jpg

Link to comment
Share on other sites

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
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...