horizontal scrolling (MSX development MSX Forum)MSX Resource Center               
              
English Nederlands Espa�ol Portugu�s Russian French         

MSX Forum


MSX Forum

MSX development - horizontal scrolling

Goto page ( Previous Page 1 | 2 | 3 Next Page )
Author

horizontal scrolling

ro
msx guru
Posts: 2477
Posted: April 12 2005, 09:20   
Games like Nemesis (gradius) etc are MSX1 screen scrollings (pattern/cells/tiles whatever) they are very easy. just store the gamemap in Ram and keep a pointer to read VRAM data to screen. very fast.

MSX2 screens are slow (e.g. screen 5) for scrolling. you have to create some tricks to make the scrolling smooth (like screen adjust etc)

remember when using copy; in high transfer mode X can only X AND #FE (bit 0 is always zero) so only EVEN X positions posible (high speed copy using BYTE transfer)
Modes like transparant copy etc use NIBBLE transfer.. but are SLOW as hell.
choose your pick (read the fucking manual )
[D-Tail]

msx guru
Posts: 3131
Posted: April 12 2005, 10:12   
Common trick I used (in BASIC, yes) to scroll smoothly horizontally:
a) set VDP(19)=3 (SETADJUST(7,0))
b) copy (0,0)-(255,31),0 to (0,0),1
c) set VDP(19)=2
d) copy (0,32)-(255,63),0 to (0,32),1
...
o) set VDP(19)=-4 and 15 (or something like it)
p) copy (0,224)-(255,255),0 to (0,224),1
q) swap pages 0,1
r) start all over at step a (q&a should be done within 1/60 sec, b&c also, d&e also ...)

Might be nice to do this all in a loop-thing
snout

msx legend
Posts: 5011
Posted: April 12 2005, 10:15   
If the routine is fast enough (hint: use XBASIC if it isn't) you can make things as smooth as possible by using the highly underestimated

ON INTERVAL=x GOSUB y
ro
msx guru
Posts: 2477
Posted: April 12 2005, 10:24   

Basic?
snout

msx legend
Posts: 5011
Posted: April 12 2005, 10:35   
scary, huh?
norakomi
msx professional
Posts: 870
Posted: April 15 2005, 02:42   
Aha,
now I see what the status registers are used for.
I never used them before and didnt know what they were used for.
(as you see Im just beginnin to learn my bit of assembly........)

Thanks so much for the tips, now im ready to work on my scrolls !!!
Im starting to love assembly !!!!

great !!!
Sonic_aka_T

msx guru
Posts: 2345
Posted: April 15 2005, 14:50   
norakomi, why don't you first try to make a text-scroller like I suggested... You know, one of those old-skool demo's... This will help you with all the basics you will also need for your game, such as commands, pointers and data tables, 'multiplication', page swapping and, if you want, the horizontal scroll (adjust) registers... It will probably take you way less time, and you should learn a lot from it. In my experience, seeing results, and seeing that you *can* do things is also a really good motivator. Well, just a suggestion though...
norakomi
msx professional
Posts: 870
Posted: April 26 2005, 00:41   
If I am using screen 5 page 0 and I have 5 sprites in screen and a background

what should i do to scroll the screen 1 pixel to the left (using the hor. scroll register, or maybe someother ways) without changing the position of the sprites?
norakomi
msx professional
Posts: 870
Posted: April 26 2005, 00:43   
ps. I managed to achieve a smooth background scroll which doesnt affect the software sprites !!! Thanx

but how does it work with normal sprites?
Sonic_aka_T

msx guru
Posts: 2345
Posted: April 26 2005, 01:43   
Just adjust their coordinates. If you're scrolling one pixel to the left, add one to *all* the sprite's X coordinates. I doubt all your sprites are standing still though, so you're probably better off doing this when you update them because of their own movement.
ro
msx guru
Posts: 2477
Posted: April 26 2005, 12:50   
have all sprites (re)set during every frame so you don't have to "manually" update sprites while scrolling. ADD/SUB (neg) the scroll value to the X (or Y) position.

A frame can be once per vblank for example (or in case of 2fps; update on every other int)

what ya need is some sorta animation engine (which reminds me...)
norakomi
msx professional
Posts: 870
Posted: April 27 2005, 21:13   
if I scroll the background (hor screen adjust register) 1 pix to the left you will see all the sprites scroll 1 pix. to the left also.
If I then scroll all the sprites 1 pix to the right and repeat this you will see:

a smooth background scroll.
sprites which keep moving rapidly 1 pix left and 1 pix right.

this looks ugly.
have all sprites (re)set during every frame 

this sounds logical !! is there a easy way to do this?
 (or in case of 2fps; update on every other int) 

ok...... but... how?

(ps. I work in assembly)
ro
msx guru
Posts: 2477
Posted: April 28 2005, 17:52   
If you had done the sprite setting on VBLANK or a lineinterrupt at the bottom of the screen, you would not have that ugly sprite hopping effect.

remember to set adjust and increase sprite X somewhere at the bottom of the screen in 1 routine. it'll amaze you

1 frame is actually 1/50 or 1/60 of a second (it's your VDP/Monitor refresh rate)
your eyes can only detect about 24 fps so every other interrupt (1/25 or 1/30) will keep things smooth... so you'll end up with 1 frame change every 2 ints.

Do you know how to program interrupts? it's what you NEED to have your stuff run smooooooth (you need *some* timer)

Vblank stands for Vertical Blank which happens every 1/50 or 1/60 of a second at line 212/256.. so that makes it perfect to change screens/sprites/whatnot. (beter use lineint on line 212... but I'll explain that later if ya wish)

cheers.
ARTRAG
msx guru
Posts: 2224
Posted: April 30 2005, 10:45   
Hy norakomi
send me your email if you need the files of my horizontal scrolling in screen5.
I have the original Promo of Total parody and the new parallattic (2layers) version of the 8 directins scroll routine at 1/50sec. I'm working on sprtites now.
let me know.


pitpan
msx master
Posts: 1567
Posted: April 30 2005, 23:07   
Maybe it is not relevant, but it was mentioned before to make a text-scroller as a training for a full horizontal scroller. I did a MSX1 pixel-smooth text scroller working at full frame rate (50/60 Hz) and the code is available at

http://forum.karoshicorp.com

Visit the SNIPPETS SECTION, it is just there. The routine of the scroller itself is 83 bytes long. I suppose that it can be used as-is in SCREEN 4 without need of border masking.

 
Goto page ( Previous Page 1 | 2 | 3 Next Page )
 







(c) 1994 - 2010 MSX Resource Center Foundation. MSX is a trademark of MSX Licensing Corporation.