VIC-20 “smooth move”.

Updates:

  • 2024-01-05 – Added YouTube video of the program.

I got stuck on my multi-part Sky-Ape-Er dissection tangent, so I thought I’d do something different for today’s VIC-20 Tuesday.

The VIC-20 uses programmable character based graphics, You can change the pixels that make up a letter “A” to be a small 8×8 icon of a spaceship, for instance. But, when you move that letter A to different spots on the screen, it jumps 8 pixels at a time making movement quite jerky (as demonstrated by all my VIC-20 programs):

Since I don’t have time to write a full article at the moment, I’ll share this small VIC-20 program and come back to discuss what it is doing, and why it is doing it, later.

30 print"{clear}{reverse on}frames:"
60 for c=0 to 7:print chr$(65+c);chr$(73+c):print:next
70 gosub 950
100 poke 36869,255
105 rem
108 rem go thru each row of the character
109 rem
110 for ln=0 to 7
115 rem
118 rem read value, multiply by 256 to make 16-bits
119 rem
120 read v:v=v*256
125 rem
128 rem go thru each frame character
129 rem
130 for ch=0 to 7
135 rem
138 rem split 16-bit value into 8-bit values
139 rem
140 b1=int(v/256)
150 b2=v-(b1*256)
155 rem
158 rem poke shifted value in each charater
159 rem
160 poke 7176+ch*8+ln,b1
170 poke 7176+ch*8+ln+64,b2
175 rem
178 rem shift 16-bit value to the right one bit
179 rem
180 v=v/2
190 next
200 next
210 gosub 950
900 poke 36869,240:poke 198,0
910 end
950 get a$:if a$="" then 950
960 return
1000 DATA 60,126,255,255,255,255,126,60

Until then…

5 thoughts on “VIC-20 “smooth move”.

  1. MiaM

    Side track: You might already know this, but the hardware can smooth scroll (1 pixel per step) the entire display vertically and semi-smooth scroll (iirc 4 pixels per step) horizontally. Eventually you need to do a non-smooth scroll while resetting those smoth scroll registers at the same time. As this affects the full screen you need to use your technique for any stationary objects or objects that don’t move the same way as everything else. I assume that you can set the x scroll value for each scan line if you use assembler, so you could have a stationary score line and horizontal semi-smooth scrolling for a game like Scramble. I haven’t tried but I assume that you can’t turn on and off the display multiple times for each field though – that would otherwise be handy for vertical scrollers to have a stationary score line.

    Reply
      1. MiaM

        It’s documented in the programmes reference, and IIRC various magazines had articles about it, but mostly/only as a way to set the position of the screen, and also alter the screen size (you can almost double the amount of visible chars on screen, at least on a PAL machine, if you let the screen use as much as possible of the border).

        The cartridge based action games that Commodore sold used the cursor down and cursor right keys to move the screen to center it. The default values might had been correct for NTSC, they sure were incorrect for PAL. Side track: Strange that the default values weren’t changed for the cartridges that clearly were produced in Europe and only sold in Europe (the Handic/Datatronic branded ones, somehow licences produced).

        Not sure if anyone actually used it to do smooth scrolling though. Probably not. In general the development of game development seems to not had come that far at the heydays of the VIC 20. Compare with the C64 games from the early years, they were rather bad as compared to games released only a few years later. If the VIC 20 had held on a few years more it might had seen far better games. Also compare with the time it took until border sprites became common on the C64.

        Reply
        1. Allen Huffman Post author

          I did see a demo of wider screen width on YouTube. Had no idea. Also interesting about the PAL cartridges. I bet I could use some of this to reimplement a few of my BASIC games to alter the screen in small increments to get smooth movement of the meteors or whatever, only updating the player graphic to keep it stationary. That would be a huge speed up.

          Reply
  2. Pingback: VIC-20 “smooth move” revisited. | Sub-Etha Software

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.