Fusion-c tile based scrolling MSX2

Por wimpie3

Champion (438)

imagem de wimpie3

12-01-2021, 08:34

Can anyone tell me if there is a fusion-c example of a tile based horizontal scrolling for the MSX2 available somewhere?

Entrar ou registrar-se para comentar

Por aoineko

Paragon (1140)

imagem de aoineko

12-01-2021, 21:55

In which screen mode?
In tile-based screen mode (screen 0, 1, 2 et 4), you just have to write your new patterns in the Name table with any VRAM write function.
I don't know if there any function/sample to do that automatically, but it's quit simple to do.
If you need more information, feel free to ask here.

Por wimpie3

Champion (438)

imagem de wimpie3

12-01-2021, 22:09

Pixel based scrolling with tiles would have been a better description. So Manbow-style.

Por aoineko

Paragon (1140)

imagem de aoineko

12-01-2021, 22:19

I know how to do pixel-based vertical scrolling, but I have never experimented with horizontal scrolling.
I won't be able to be of much help.

Por Grauw

Ascended (10821)

imagem de Grauw

13-01-2021, 00:16

I could explain the Space Manbow scroll if you want, but I don’t have any Fusion-C code examples.

Por thegeps

Paragon (1260)

imagem de thegeps

13-01-2021, 02:33

Well, I still have to study v9938 but I think that space mambow horizontal scrolling works in this way:
Set adjust (basic name, I still don't know how to name it in asm) positioning is used to move the screen 7 times, one pixel each frame. Then, at 8th frame the start position is restored and the whole nametable is shifted one column to the left and a new column is plotted to the rightmost position. To preserve scoreboard (upper rows) you have to synch with the related hblank (rasterline)

Por wimpie3

Champion (438)

imagem de wimpie3

13-01-2021, 06:24

Yes I know how it works... I was only looking for source code examples.

Por ericb59

Paragon (1126)

imagem de ericb59

13-01-2021, 15:12

Quick and Dirty Example, with no Vsynch




// Quick & Dirty Horizontal Scroll in Screen 5
// Fusion-C 1.3
#include "fusion-c/header/msx_fusion.h"
#include "fusion-c/header/vdp_graph2.h"
char tile=4;
char sc=0;

void TilesCreation(void)
{
	char i;

	for ( i = 0; i < 15; ++i)
	{
		BoxFill(0,256+i*8,8,256+8+i*8,i,0);
		BoxLine(0,256+i*8,8,256+8+i*8,15,0);
	}
}

void PrintTiles(void)
{
	char i=0;

	char y=0;
	unsigned int sx,sy,dx,dy;
	while (i<24)
	{
		sx=0;
		sy=256+tile*8;
		dx=256-8;
		dy=y;

		HMMM(sx,sy,dx,dy,8,8);	
	
		tile++;
		y+=8;
		sc++;
		if (tile>14)
		{
			tile=0;
		}
		if (y>192)
		{
			y=0;
		}
		i++;
	}
}
void Scroll(void)
{
	sc++;
	SetAdjust(sc, 0);
	if (sc>7)
	{	SetAdjust(0, 0);
		HMMM(8,0,0,0,248,192);
		
		PrintTiles();
		sc=0;
		
	}

}
void main (void)
{

	SetColors(15,0,1);
	Screen(5);
	Cls();
	KeySound(0);			
	SpriteReset();			
	Sprite16();				
	VDP60Hz();

	TilesCreation();
	SetAdjust(0, 0);
	PrintTiles();
	while (1)
	{
	    	Scroll();

	}

}

Por Gakubuchi

Expert (106)

imagem de Gakubuchi

18-09-2022, 12:32

Hi Eric. It seems this example works only with version 1.3? I can't find the "SetAdjust" function in version 1.2 Crying

Por aoineko

Paragon (1140)

imagem de aoineko

18-09-2022, 13:36

Just theory but if you have a function void SetAdjust(char x, char y) the content should be to set the VDP register #18 with ((-x) & 0x0F) | (((-y) & 0x0F) << 4).

EDIT: Be careful. You should not modify R#18 while a VDP command is running.