9

I've been programming the C64 on/off for over 30 years (wow). However, I have a few VIC-20's I want to program. I never had a VIC-20 as a kid so I haven't had much exposure to them.

Am I correct in thinking that the VIC-20 cannot perform line-level raster interrupts like the C64 can? How would a programmer, for example, change the background color mid-character? I'm assuming one of the CIA timers would be used?

Other than hardware sprites and scrolling, what other video limitations are there compared to the C64?

Thanks

12

You're correct; the only interrupts on offer in a Vic-20 are those from a VIA — they're plain old 6522s in the Vic-20, not 6526s. The original VIC chip exposes the current scan line via a couple of registers so instead you'd perform a busy loop until it got to the number you wanted, then cue the VIA.

I'm not a C64 expert but besides the lack of hardware sprites and sub-character scrolling, the main limitations are the halved horizontal resolution and the lack of both extended background colour mode and bitmap mode. It's character mode only, each being either 1bpp from cell's colour plus the global background colour or 2bpp from the global background, border and auxiliary colours plus that cell's colour.

Conversely, with no bad lines, the character indexes are reread every scan line. So if you can think of a use for mid-character tile substitutions then that's an option. And the lack of bad lines allows the CPU to run marginally faster.

5

The Compute's Gazette Disk menu used raster tricks to set the background color on a per-line basis, and the Demon Attack cartridge used a black character color as the "apparent" background while it changed the background color every scan line to achieve colorful demons like the Atari 2600 version. My recollection is that the Compute's Gazette menu did not use interrupts (it simply busy-waited for a keystroke) but I'm not sure about Demon Attack. There are some other cartridges from that era that used raster tricks, but I didn't have them back in the day and I'm not sure about the particulars.

If one did want to use interrupts, one would need to make use of the timers on the VIA. The easiest way to exploit them would probably be to figure some number of regularly-spaced intervals near where an interrupt would be useful, set the timer to go off that often, and either busy-wait for the scan line one was interested in, or else return if it wouldn't come around until after the next interrupt. Not a terribly efficient approach, but one that might still be better than simply busy-waiting all the time.

If I ever port Toyshop Trouble to the VIC-20, it will make use of raster timing to set the background color register four times per scan line as toys move left and right. With proper timing, it should be possible to cut the size of the "conflict zone" when a player is near a toy from 8 pixels wide to 4 pixels (I think writes to $900F can occur on arbitrary 4-pixel boundaries). Making that work, however, would require busy-waiting for much of the display period, since a normal "CMP/BNE" loop would have six cycles worth of slop, and I don't know of any way to clean that up without burning two more scan lines.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.