Mode 72 development

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

Re: Mode 72 development

Post by Jubatian » Fri Mar 23, 2018 5:44 pm

I did an update to the mode, no significant functional changes (some added options for m72_bull_cnt), but it involved large rewrites in sprite modes. This was for that I discovered some possible optimizations in ROM sourced sprites which I decided to introduce all over, mostly to have a cleaner setup for introducing any further sprite mode. I tested the results fairly well, there shouldn't be any problem to experience, but if there is, you know who to blame! :)

So please test (just check it out and compile the game with it, if all went well, it will just keep working).

rocifier
Posts: 71
Joined: Thu Jan 22, 2015 6:35 am

Re: Mode 72 development

Post by rocifier » Sat Mar 24, 2018 12:45 pm

Jubatian wrote:
Fri Mar 23, 2018 5:44 pm
I did an update to the mode, no significant functional changes (some added options for m72_bull_cnt), but it involved large rewrites in sprite modes. This was for that I discovered some possible optimizations in ROM sourced sprites which I decided to introduce all over, mostly to have a cleaner setup for introducing any further sprite mode. I tested the results fairly well, there shouldn't be any problem to experience, but if there is, you know who to blame! :)

So please test (just check it out and compile the game with it, if all went well, it will just keep working).
So far so good with the new update! I appreciate you working away optimising/rewriting stuff like that.

User avatar
Jubatian
Posts: 1355
Joined: Thu Oct 01, 2015 9:44 pm
Location: Hungary
Contact:

Re: Mode 72 development

Post by Jubatian » Mon Mar 26, 2018 5:30 pm

Another modification came: I unified the text mode with that of Mode 40/41/42, so these modes can share character sets now. Mode 72 no longer contains a generator.

You should check your game, if you keep it as-is, the characters of the character set will show up mirrored. To fix it, delete the character set file and modify the Makefile to use M40_C64_GRAPHICS instead (which is the same charset like the example contained), look in the example's Makefile for details, particularly Line 19 where the inclusion is added. For an own character set, you can use Mode 40's generator from now.

With this modification I guess Mode 72 is good to go, that is, I think I will merge it into the Master soon. And with that, you may also easier apply my VSync mixer modification on top of it which saves approximately 256 bytes of RAM.

rocifier
Posts: 71
Joined: Thu Jan 22, 2015 6:35 am

Re: Mode 72 development

Post by rocifier » Tue Mar 27, 2018 8:51 am

Jubatian wrote:
Mon Mar 26, 2018 5:30 pm
Another modification came: I unified the text mode with that of Mode 40/41/42, so these modes can share character sets now. Mode 72 no longer contains a generator.

You should check your game, if you keep it as-is, the characters of the character set will show up mirrored. To fix it, delete the character set file and modify the Makefile to use M40_C64_GRAPHICS instead (which is the same charset like the example contained), look in the example's Makefile for details, particularly Line 19 where the inclusion is added. For an own character set, you can use Mode 40's generator from now.

With this modification I guess Mode 72 is good to go, that is, I think I will merge it into the Master soon. And with that, you may also easier apply my VSync mixer modification on top of it which saves approximately 256 bytes of RAM.
done! thanks

rocifier
Posts: 71
Joined: Thu Jan 22, 2015 6:35 am

Re: Mode 72 development

Post by rocifier » Wed Mar 28, 2018 10:33 am

Hey Jubatian, I tried adding -DM72_USE_XPOS to the kernel flags and using m72_xpos but it doesn't seem to update/scroll the tiles. How do I use it? I tried incrementing and decrementing it by 1 and by 8.

User avatar
Jubatian
Posts: 1355
Joined: Thu Oct 01, 2015 9:44 pm
Location: Hungary
Contact:

Re: Mode 72 development

Post by Jubatian » Wed Mar 28, 2018 10:44 am

rocifier wrote:
Wed Mar 28, 2018 10:33 am
Hey Jubatian, I tried adding -DM72_USE_XPOS to the kernel flags and using m72_xpos but it doesn't seem to update/scroll the tiles. How do I use it? I tried incrementing and decrementing it by 1 and by 8.
When you set M72_USE_XPOS nonzero (you need to actually set it nonzero!), the m72_xpos variable takes over the role of the upper bits of the elements of the m72_rowoff array. So you just write VRAM pointers into m72_rowoff, and use m72_xpos for fine scrolling (0 - 7 pixels). I checked it now, it seems to work all right as far as I perceive (although sure it could be that you are excepting a particular behavior which I am just not aware of).

rocifier
Posts: 71
Joined: Thu Jan 22, 2015 6:35 am

Re: Mode 72 development

Post by rocifier » Wed Mar 28, 2018 8:53 pm

Jubatian wrote:
Wed Mar 28, 2018 10:44 am
rocifier wrote:
Wed Mar 28, 2018 10:33 am
Hey Jubatian, I tried adding -DM72_USE_XPOS to the kernel flags and using m72_xpos but it doesn't seem to update/scroll the tiles. How do I use it? I tried incrementing and decrementing it by 1 and by 8.
When you set M72_USE_XPOS nonzero (you need to actually set it nonzero!), the m72_xpos variable takes over the role of the upper bits of the elements of the m72_rowoff array. So you just write VRAM pointers into m72_rowoff, and use m72_xpos for fine scrolling (0 - 7 pixels). I checked it now, it seems to work all right as far as I perceive (although sure it could be that you are excepting a particular behavior which I am just not aware of).
Oh I see it is for fine scrolling. I misunderstood and didn't realize I still had to set m72_rowoff. I'll try again with this new knowledge, thanks.

User avatar
Jubatian
Posts: 1355
Joined: Thu Oct 01, 2015 9:44 pm
Location: Hungary
Contact:

Re: Mode 72 development

Post by Jubatian » Thu Mar 29, 2018 5:14 am

rocifier wrote:
Wed Mar 28, 2018 8:53 pm
Oh I see it is for fine scrolling. I misunderstood and didn't realize I still had to set m72_rowoff. I'll try again with this new knowledge, thanks.
Just a bit of clarification then on possible use-cases:

It is intended for situations where you want to use a fixed VRAM (21 tiles width) to minimize RAM footprint, so you can fill m72_rowoff in advance, then forget about it. It is good for games where the level data is in ROM, and you copy it into VRAM as you scroll (moving around VRAM contents as needed by memmove, the AVR is fast, it can easily do that. Flight of a Dragon also works this way for free-directional scrolling).

rocifier
Posts: 71
Joined: Thu Jan 22, 2015 6:35 am

Re: Mode 72 development

Post by rocifier » Thu Mar 29, 2018 6:27 am

Jubatian wrote:
Thu Mar 29, 2018 5:14 am
rocifier wrote:
Wed Mar 28, 2018 8:53 pm
Oh I see it is for fine scrolling. I misunderstood and didn't realize I still had to set m72_rowoff. I'll try again with this new knowledge, thanks.
Just a bit of clarification then on possible use-cases:

It is intended for situations where you want to use a fixed VRAM (21 tiles width) to minimize RAM footprint, so you can fill m72_rowoff in advance, then forget about it. It is good for games where the level data is in ROM, and you copy it into VRAM as you scroll (moving around VRAM contents as needed by memmove, the AVR is fast, it can easily do that. Flight of a Dragon also works this way for free-directional scrolling).
Ah I see. So in my case I am just going to try and use m72_rowoff. But I can't notice any visual difference with the following code I adapted from the sample, not sure why.

Code: Select all

void UpdateScroll() {
	x_offset++;
	if (x_offset == 160) x_offset = 0;

	for (u8 i = 0; i < BG_HEIGHT; i++) {
		m72_rowoff[i] = (u16)&main_vram[i][(x_offset >> 3)] + ((x_offset & 7) << 12);
	}
}
My vram row count is BG_HEIGHT 32, and the length of each row is 48 tiles.

EDIT: I can see the vram scrolling in the emulator debug, but the tiles don't change on the display ?

User avatar
Jubatian
Posts: 1355
Joined: Thu Oct 01, 2015 9:44 pm
Location: Hungary
Contact:

Re: Mode 72 development

Post by Jubatian » Thu Mar 29, 2018 6:40 am

rocifier wrote:
Thu Mar 29, 2018 6:27 am
Ah I see. So in my case I am just going to try and use m72_rowoff. But I can't notice any visual difference with the following code I adapted from the sample, not sure why.
If you are just doing a full-screen horizontal scroll, there shouldn't be a visual difference (both methods are equally capable of doing it, it is just that with the default method, you can scroll each tile row independently for parallax effects). The code you posted should work all right for the default configuration (M72_USE_XPOS zero or not set).
rocifier wrote:
Thu Mar 29, 2018 6:27 am
EDIT: I can see the vram scrolling in the emulator debug, but the tiles don't change on the display ?
I don't understand what do you mean here (what is exactly happening and what are you expecting). Could you send some sample in PM? (I know that these features work correctly the way I intended them to work as I tested them, however I can't know how are you expecting it to work. Maybe resolving this will be good source for clarifying documentations then)

Post Reply

Who is online

Users browsing this forum: No registered users and 13 guests