A little bit of Mode 9 insanity

Topics related to the API, programming discussions & questions, coding tips, bugs, etc. should go here.
User avatar
Jubatian
Posts: 1561
Joined: Thu Oct 01, 2015 9:44 pm
Location: Hungary
Contact:

Re: A little bit of Mode 9 insanity

Post by Jubatian »

How it's going? Could you get to display stuff in the 2bpp mode?

(Above with the "whether something else won't break in the kernel" I meant the original kernel as-is which might expect VRAM to be at 0x0100 in one or another routine. Most likely it doesn't, but since it was a common requirement to have it there, something could surface which does and subtly breaks things)
yllawwally
Posts: 73
Joined: Tue Mar 05, 2013 7:29 pm

Re: A little bit of Mode 9 insanity

Post by yllawwally »

Sorry I've been a little busy lately. The newest fix you incorporated, allows mode 92 to work in standard mode. I haven't attempted to convert a picture yet, I'm hoping to do that later today.
yllawwally
Posts: 73
Joined: Tue Mar 05, 2013 7:29 pm

Re: A little bit of Mode 9 insanity

Post by yllawwally »

I'm getting a Symbol 'm90_split' could not be resolved, when trying to activate the new mode. For writing to RAM tiles, do I use settile, or is there another method?
User avatar
Jubatian
Posts: 1561
Joined: Thu Oct 01, 2015 9:44 pm
Location: Hungary
Contact:

Re: A little bit of Mode 9 insanity

Post by Jubatian »

OK, check it out again, I found a bug which would mess up the kernel's SetFont and GetFont routines with Mode 92. But that's not what you experienced, the symbol should have been there. Check whether you actually use Mode92 and not Mode90! (In the Makedile, do you have -DVIDEO_MODE=92 defined instead of -DVIDEO_MODE=90? The symbol will still be "m90_split" for compatibility reason, the two modes sharing prefix)
yllawwally
Posts: 73
Joined: Tue Mar 05, 2013 7:29 pm

Re: A little bit of Mode 9 insanity

Post by yllawwally »

OK I think I figured out what I was doing wrong with the m90_split. I am trying to make a quick test to see if I can change the screen to lines.
I think this code should make vertical lines. However it just makes the top half of the screen black.

Code: Select all

					m90_split = 112;
					for (unsigned int i=0; i < (400);i++)
						vram[i] = 147;
						
User avatar
Jubatian
Posts: 1561
Joined: Thu Oct 01, 2015 9:44 pm
Location: Hungary
Contact:

Re: A little bit of Mode 9 insanity

Post by Jubatian »

The 2bpp mode uses colors 12-15 of the palette (I mentioned it a few posts before). Most likely they are all black in your tileset. You can update the palette either dynamically by writing the colors into the "palette" array (to indices 12-15), or modify the generated tileset's palette to have the colors you need on these locations.
yllawwally
Posts: 73
Joined: Tue Mar 05, 2013 7:29 pm

Re: A little bit of Mode 9 insanity

Post by yllawwally »

I changed the code to modify the palette. However the top half is still black. The bottom half now changes color as would be expected.

Code: Select all

					m90_split = 112;
					for (unsigned char i=0; i < (25);i++)
						palette[0] = i*10;
					for (unsigned int i=0; i < (400);i++)
						vram[i] = 147;
						
User avatar
Jubatian
Posts: 1561
Joined: Thu Oct 01, 2015 9:44 pm
Location: Hungary
Contact:

Re: A little bit of Mode 9 insanity

Post by Jubatian »

Ouch! I meant palette[12] to palette[15], or if you don't want to dynamically alter the palette, open the generated tileset (tileset.s normally), and edit m90_defpalette's last four entries according to your needs (possibly those are all 0x00 in your case). The background color of the 2bpp region is palette[12] (that is, if both bits of the color are 0, this palette entry will be used). I chose these palette entries since it is easier to get text (on the bottom half) and graphics (on the top half) coexisting this way.
yllawwally
Posts: 73
Joined: Tue Mar 05, 2013 7:29 pm

Re: A little bit of Mode 9 insanity

Post by yllawwally »

Ok, I got the palette figured out.
yllawwally
Posts: 73
Joined: Tue Mar 05, 2013 7:29 pm

Re: A little bit of Mode 9 insanity

Post by yllawwally »

It's working pretty good. I just need to find an easy way to convert images to 2bpp, and put into a hex file. Thanks again Jubation.
uzem_000.jpg
uzem_000.jpg (21 KiB) Viewed 6642 times
Post Reply