Fusion-c tile based scrolling MSX2

Par wimpie3

Champion (368)

Portrait 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?

!login ou Inscrivez-vous pour poster

Par aoineko

Master (163)

Portrait 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.

Par wimpie3

Champion (368)

Portrait de wimpie3

12-01-2021, 22:09

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

Par aoineko

Master (163)

Portrait 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.

Par Grauw

Ascended (10018)

Portrait 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.

Par thegeps

Paladin (854)

Portrait 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)

Par wimpie3

Champion (368)

Portrait de wimpie3

13-01-2021, 06:24

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

Par ericb59

Paragon (1046)

Portrait 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();

	}

}