A little bit of Mode 9 insanity

Topics related to the API, programming discussions & questions, coding tips, bugs, etc. should go here.
yllawwally
Posts: 73
Joined: Tue Mar 05, 2013 7:29 pm

Re: A little bit of Mode 9 insanity

Post by yllawwally »

No prob. Does gettile no longer work?
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 »

Huh? What do you mean with it? I don't see GetTile() function in the interface.

Well, poking around a bit now I see, Mode 9 itself was expanded with that function some time after the version I started out from, not found on the main Uzebox interface, so I missed it. It is not hard to temporarily make an equivalent, it is a bit late here, I will only continue later. You can copy-paste that function for now in Mode 90, since the vram layout is identical, it will work.
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 »

I added a GetTile() and a GetFont() function to complement the kernel's SetTile() and SetFont() functions respectively. The signatures are slightly different to what Mode9 used aiming rather for coherence with the existing kernel than what was done there. It should however work without problems (that is, you can exchange Mode9 to Mode90 without it breaking your code).

https://github.com/Jubatian/uzebox/tree/mode90
yllawwally
Posts: 73
Joined: Tue Mar 05, 2013 7:29 pm

Re: A little bit of Mode 9 insanity

Post by yllawwally »

I got everything to compile, but the screen is messed up.
shrunk.jpg
shrunk.jpg (38.45 KiB) Viewed 4700 times
original.jpg
original.jpg (34.83 KiB) Viewed 4701 times
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 »

For me it looks like you don't have the correct tiles at the correct indices (looking closely tiles consistently map to the characters of the intro text, just different).

When you did the Gimp conversion, are you sure you had your tiles in the correct order? (You have to have them in a 8 pixels tall image, laid out incrementally from left to right)

Do you have the character set at the beginning of your tileset? If not, keep in mind that you have to use SetFontTilesIndex() to tell the Uzebox kernel functions where the font begins (during porting to Mode 90, you might have missed or deleted this somewhere, maybe it even got set somehow indirectly... Mode 9 doesn't initialize it, I am not exactly sure whether anything would make sure it was cleared to zero on startup. In Mode 90 I explicitly set it zero on init).

If neither, check what you use for outputting that text. If those are the Uzebox kernel functions, try first with a "normal" tileset beginning with the font, not calling SetFontTilesIndex(). If that neither works, look at what you get with the example's "tileset.s" (does that produce proper, readable text?).
User avatar
D3thAdd3r
Posts: 3221
Joined: Wed Apr 29, 2009 10:00 am
Location: Minneapolis, United States

Re: A little bit of Mode 9 insanity

Post by D3thAdd3r »

Interesting video mode. For sure the tile indices are off for whatever reason, you can clearly see 'A' is represented instead by the left side of a smiley face. But the weird part unless you changed the code for testing, there is what would be an 'A' in the lower right corner that wasnt there before.
yllawwally
Posts: 73
Joined: Tue Mar 05, 2013 7:29 pm

Re: A little bit of Mode 9 insanity

Post by yllawwally »

I made minimal changes, only the couple of things that weren't compatible with the new mode. Here is what the game itself looks like.
uzem_000.jpg
uzem_000.jpg (51.77 KiB) Viewed 4651 times
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 »

Try the following. The "vram" is a public symbol, so you can use it to access the Video RAM directly. Have your "tileset.s", and try to fill it up directly using a "for" loop. Then check whether what you see corresponds to the tile order you except. If it doesn't, then you need to look at the way you generate the tiles. (To have something to compare to, check the example, and try to generate its tileset yourself from the PNG source, go on until you get it right, or tell or show how it doesn't work for you, for me it would seem too straightforward to see any potential pitfall).

If it works, that is, you experience the correct order when producing your tiles directly onto the VRAM with a "for" loop, then for now I can't imagine what could be going wrong there. So first I say make sure you generate the tileset correctly, and go on with anything else later using any conclusion derived from that.
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 »

Any progress here? Did you try some of what I mentioned? Or did you succeed in resolving the issue yourself? (I can't figure out myself what goes wrong on your end, as far as I see on my setup and tests, the mode and its tileset generator behaves the way I expect).
yllawwally
Posts: 73
Joined: Tue Mar 05, 2013 7:29 pm

Re: A little bit of Mode 9 insanity

Post by yllawwally »

Haven't done much with the mode 90 stuff. I was changing some internal structures, which caused some weird bugs. I think I finally got those nailed down. What weird is some of the stuff was correct, and some incorrect. The rooms look correct, but hallways and monsters are incorrect. I'll try to put a little effort in figuring out what's going on.
Post Reply