Jump to content
IGNORED

CV Basic: scrolling


Recommended Posts

Can I do a horizontal scroll in CV Basic? Nothing fancy, just moving the screen left and repeating the pixels over and over again. I can't find anything in the manual about how to scroll. In INTY Basic, there is a SCROLL function. Is there anything similar here?

Link to comment
Share on other sites

It's like trying to do smooth scaling on the Sega Genesis... you just can't do it. But you can fake it! There are games with subtle tricks that will make you THINK you're getting fast, smooth scrolling out of the machine. Imagic's Nova Strike is a great example. Only a small portion of the screen scrolls... most everything else is static, giving you a convincing illusion of movement and a convincing illusion of parallax to boot!

 

It's all about fooling the eye with these old game systems. What they can't do, you replace with sleight of hand. See also the waterfalls on Sonic 2 for the Genesis, which LOOK for all the world like they're transparent, except they're not... every other pixel of the fall is drawn, giving you the impression on a CRT screen that the waterfall is in fact transparent. Playing the game on a LCD screen pulls the curtain back and reveals how the trick is done, but it still looks pretty sharp regardless.

Link to comment
Share on other sites

Posted (edited)
On 5/11/2024 at 8:15 AM, drfloyd said:

is it possible because of the SGM and extra RAM, we agree ?

I've done a small sample for you as well. A bit larger than Nano's one and (I think) without tearing (try the rom in a plain Colecovision and let me know).

 

If you want to try your own picture follow these steps:

 

1. Edit ScrollTest.bmp adding your own image in the first 256x192 quarter of the picture (top left) - NOTE the code is scrolling only the lower 256x64 part.

2. Copy the same image in the top right quarter of the picture

3. Copy the first half of the image (512x192) on the lower part of the image with an offset of 4 pixels

4. run tmscolor -z -t -b -o result.bmp ScrollTest.bmp ScrollTest.bas - NOTE1 small errors due to color bleeding could be acceptable, it depends on the case. NOTE2 make sure that the total tile count is <=255

5. copy this code in ScrollTest.bas just after the second DEFINE command, replacing the SCREEN command generated by tmscolor

    ' replace the SCREEN command in the stub generate by TMSCOLOR
	SCREEN image_pattern,0,0,32,24,64
	#X = 0
	WHILE 1
	WAIT
	if (#X and 1) then 
		SCREEN image_pattern,#X/2+64*8,256,32,16,64
	else 
		SCREEN image_pattern,#X/2+64*8+64*24,256,32,16,64
	end if
	IF CONT.RIGHT THEN #X = (#X + 1) and 63
	IF CONT.LEFT THEN #X = (#X - 1) and 63
	WEND

6. run the compiler by cvbasic ScrollTest.bas output.asm
7. run the assembler gasm80 output.asm -o output.rom

8. run output.rom, use the RIGHT and LEFT to move the screen

 

Enjoy

 

ScrollTest.bmp

 

ScrollTest.bas output.rom

Edited by artrag
  • Like 1
Link to comment
Share on other sites

Posted (edited)

The explanation for this technique is this:

 

All the tiled used for in the scrolling for the different offsets (in the example just 2, but the image works also with 4 offsets), should fit in the tileset (256 tiles)

In the sample used color bleeding occurs in few points, it can be acceptable or not, depends on the cases. 

Level design should avoid that the number of tiles passes the limit of 256 and color bleed.


For each offset you need to define a separate level map. Here there are two level maps, one on top of the other, at offset 64*24.

According to the value of the the map coordinate, you choose which level map has to be used has origin of the data to be copied by SCREEN

 

Advanced technique

Due to the fact we consider only horizontal scrolling, you could have 3 different tile banks of 256 tiles each specialised for the area of the screen to be rendered.

This increases the variety of tiles and tile combinations that can be supported and can be achieved with the simple tool tmscolor.

The solution is to cut the source image with the whole level in 3 stripes of height 64 pixels.

For each of them, generate the offset images as above.  You will end with 3 images (one per bank) with 2 (or 4) offsets each.

Use tmscolor to generate the tile definitions of each bank and DEFINE VRAM PLETTER address,length,label to load the 3 banks in VRAM

For each offset, assemble the data of the 3 PNTs (one per bank) in a single map.

Use SCREEN as above on the assembled map

 

 

 

 

Edited by artrag
Link to comment
Share on other sites

Posted (edited)

ScrollTest.basoutput.rombuild.batScrollTest.bmp

 

The files in attach show the same idea as above, BUT with 4 offsets. The movement is 2 pixels at time, much smoother.

The used tiles are 225, and I've removed the color bleeding manually in the intermediate frames.

As above, the code is very easy:

Quote

    MODE 0
    DEFINE CHAR PLETTER 0,225,image_char
    DEFINE COLOR PLETTER 0,225,image_color
    SCREEN image_pattern,0,0,32,16,64
    #X = 0
    WHILE 1
    WAIT
    SCREEN image_pattern,#X/4+64*8+64*16*((#X) and 3),256,32,16,64
    IF CONT.RIGHT THEN #X = (#X + 1) and 127
    IF CONT.LEFT  THEN #X = (#X - 1) and 127
    WEND

 

There are 4 level maps stacked in the image_pattern data, each is 64x16 and is representing a given offset

The correct map is chosen according to the offset (#X and 3) at position #X/4

 

If you want to try your own image, note that the code is scrolling a 256x64 area, so this time I've cropped the first third of the screen in ScrollTest.bmp 

 

1. Edit ScrollTest.bmp adding your own image 256x64 in the first quarter of the picture (top left) - NOTE the code is scrolling only the lower 256x64 part.

2. Copy the same image in the top right quarter of the picture

3. Copy the first half of the image (512x64) on the lower part of the image 3 times with an offset of 2 pixels

4. run tmscolor -z -t -b -o result.bmp ScrollTest.bmp ScrollTest.bas - NOTE1 small errors due to color bleeding could be acceptable, it depends on the case, edit the image if you do not like them. NOTE2 make sure that the total tile count is <=255

5. copy the code above in ScrollTest.bas just after the second DEFINE command, replacing the SCREEN command generated by tmscolor

 

Compile, assemble and run

Enjoy!

 

 

 

Edited by artrag
  • Like 1
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...