MSX1 Smooth scroll issues

Page 1/3
| 2 | 3

By PingPong

Prophet (3885)

PingPong's picture

25-08-2007, 21:40

Hello, All.
I'm taking into consideration to write a game with smooth horizontal scroll.

In order to achieve this goal, i've planned this way to do, and i need to ask you if it's possible.

take into consideration please:
- I work in screen 2 using the first 2/3 of the screen, two sections of 256 tiles each one.
- I do the scroll using prepared tiles in ram, shitfted by 1 bit each set
- I need a large number of scrolling tiles, 128 for each part of screen (first 1/3, second 1/3)

My solution:

I have the 256 charater set splitted into two subset of 128 chars, called subset1 and 2

a) at first VBLANK i write the name table with charater codes using the first 128 chars on screen. (subset 1)
b) then, in the active area i blit the subset2 (that is not displayed) with 1 pixel scrolled data (128*8=1024 bytes)
c) the next VBLANK i write the name table, enabling the subset2 wrote before at (b)
d) i do the same of (b) but with the subset1
e) goto (a)

at each vblank i need to execute steps (a) or (c) in the vblank period, then (b) or (d) after the vblank period.

Now, taking in consideration that i need to work with 2/3 of the screen, i need to write at each vblank 2*128 bytes (name table)
outside of vblank i need also to write 128*8 = 1024bytes by blitting data. Sections are the two screen2 top sections so i need to write additional 2048 bytes.

Now, i ask to all, it's possible with msx1 I/O vdp limits?

Login or register to post comments

By NYYRIKKI

Enlighted (5918)

NYYRIKKI's picture

25-08-2007, 21:56

2.5K should be ok if you get timing right.

By dvik

Prophet (2200)

dvik's picture

25-08-2007, 22:26

I don't think its doable the way you describe it. If you're blitting the new tiles in the display area you need to blit 2048 bytes at 28 CPU cycles per byte. This requires 2048 / (228 / 28) = 252 scanlines. The bg map can be blitted faster, 18 CPU cycles per byte is doable with unrolled loops in non display area. So blitting the bgmap will take 512 / (228/18) = 41 scanlinest then you also have some control code so the real numbers are a bit higher even with unrolled loops.

On a 50Hz PAL system you may fit it but it doesn't leave much CPU for other tasks. You can also move some of the tile blit into non display area and save some CPU cycles but its still quite tight.

I think you need to go to either lower number of tiles like Malaika or to do mirrored mode like the GnG demo. Both has advantages and disadvantages.

By PingPong

Prophet (3885)

PingPong's picture

25-08-2007, 22:58

I don't think its doable the way you describe it. If you're blitting the new tiles in the display area you need to blit 2048 bytes at 28 CPU cycles per byte. This requires 2048 / (228 / 28) = 252 scanlines. The bg map can be blitted faster, 18 CPU cycles per byte is doable with unrolled loops in non display area. So blitting the bgmap will take 512 / (228/18) = 41 scanlinest then you also have some control code so the real numbers are a bit higher even with unrolled loops.

On a 50Hz PAL system you may fit it but it doesn't leave much CPU for other tasks. You can also move some of the tile blit into non display area and save some CPU cycles but its still quite tight.

I think you need to go to either lower number of tiles like Malaika or to do mirrored mode like the GnG demo. Both has advantages and disadvantages.

@Dvik:Maybe could be done by using 1 vblank to do the first 1/3 and a second to do the second half?
(Lowering the fps and increasing the scroll at 2pixels per frame)
in this way i have to move only 1024 bytes+bg map..

By dvik

Prophet (2200)

dvik's picture

26-08-2007, 06:32

Yes, lowering the fps is of course another solution. How you choose to split the tasks over the two frames doesn't matter that much. You could do all vdp blitting in one frame and game contol in the other, or do some blitting in both frames. The important thing is to blit all of the bgmap in the same non-display area to avoid flickering.

By ARTRAG

Enlighted (6832)

ARTRAG's picture

27-08-2007, 21:08

About the VDP issue, note that you can replicate the character sets of banks 1 & 2 leaving the bank 3 "standard"
Moreover you can replicate only the shape of the tiles in bamk 1 & 2 leaving all the color definitions of the 3 banks as "standard"

This can help, as you do not need to update colors if you want only orizontal scrolling, moreover in this way
you can have the same tile with different colors depending if it is in bank 1 or 2
Consider that, if you plan some parallax, you colud have different speeds of tile update

some tiles could scroll slowely while others could be faster, so you can limit the # of tiles to update at 50Hz

By dvik

Prophet (2200)

dvik's picture

27-08-2007, 21:35

The way we deal with the 50/60Hz problem in our new game (which is quite CPU intensive) is that we use the last 20% of every frame in 50Hz to low priority tasks that don't need too quick updates and in 60Hz we combine all these low priority tasks in every 6th frame (which is fully dedicated to the low prio stuff and doesn't do any of the things done in the other 5 frames).

This has some other benefits too. The game will run at the same speed in both 50Hz and 60Hz and you'll get full utilization of the CPU. The only limitation for you is of course that your blitting routines need to be adjusted to 60Hz but in reality this is not an issue since you most likely have other tasks that needs 20% of the cpu.

By dvik

Prophet (2200)

dvik's picture

27-08-2007, 21:44

Moreover you can replicate only the shape of the tiles in bamk 1 & 2 leaving all the color definitions of the 3 banks as "standard"

I just tested on my $1200 Yamaha CX5M and mirroring the tiles also mirrors the sprites locates in the top 1/3 of the screen, so if you use mirroring I'd recommend you to not use sprites (at least in the top 1/3 of the screen)

By ARTRAG

Enlighted (6832)

ARTRAG's picture

27-08-2007, 22:19

does it happen even if you replicate only the shapes?
does it happen even if you reploicate only the first two banks only?

By dvik

Prophet (2200)

dvik's picture

27-08-2007, 22:22

It does happen if I replicate only the shapes (which is unfortunate since the GnG demo does just that).

I haven't tried to replicate only the first two banks though. My guess is that the sprites will be mirrored from the top 1/3 to the second 1/3 but not to the lower 1/3.

I was hoping that having a $1200 machine would help but apparently money doesn't solve everything.

By Vincent van Dam

Hero (513)

Vincent van Dam's picture

27-08-2007, 22:25


I was hoping that having a $1200 machine would help but apparently money doesn't solve everything.

*LOL*

Page 1/3
| 2 | 3