-
Notifications
You must be signed in to change notification settings - Fork 64
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Bitmap data storage layout for VERA #36
Comments
What exactly is it you are missing? Bitmaps are documented here: https://github.com/commanderx16/x16-docs/blob/master/VERA%20Programmer's%20Reference.md#bitmap-mode-1248-bpp |
I got the bitmap data layout finally as that was recently added to the docs. Now the palette is giving me issues. There is hardly any documentation on converting an 8 bit palette to 12 bit. I thought it may be me so I tried a DOS program in x86 assembler. Took me 30 mins to write a bitmap viewer. I said DOS is easy, let me try Amiga...this time about an hour in 68K ASM to write a bitmap viewer and that uses bitplanes. I said...ok let me try C64. 45 mins and I rendered a full screen bitmap. For me on the x16, it has been 3+ months and I can't get a fullscreen bitmap rendered correctly. I get the outline of a photo, but all the colors are messed up. |
Colors in the palette are 16-bit values in little-endian order, but only use the 12 least-significant bits. In other words, for each color in the palette, starting at $1FA00 For instance, try this in BASIC: Notice that all the white became red. That's because color index 1 starts as $FFF (white), but we've clobbered the green and blue components to 0. We can change it to lime with by restoring the green component and clobbering the red component: |
OK...that part I get...my conversion code is as follows. Is this correct? gb = (g & 0xF0) | ((b & 0xF0) >> 4); fwrite(&gb, sizeof(uint8_t), 1, outfile); |
As long as r, g, and b are each 8-bit color components, then that looks correct to me. gb and r would need to be uint8_t as well, which I'm assuming is the case. |
Yep. They are all uint8_t. It has to be my asm routine to copy the palette into VERA. When you embed a file into code via "!bin "filename", does the file need to have the load address at the beginning? |
No, but you need to manually copy it to VRAM. When you include it with !bin, it is loaded into system RAM just like the rest of your program. |
OK. My palette file has the load address in it. I have a routine that copies it into VRAM. If removing the load address does not work, then it has to be the ASM routine to copy to VRAM. |
Documentation is lacking for the bitmap storage on VERA.
The text was updated successfully, but these errors were encountered: