• Please review our updated Terms and Rules here

A dumb (but obscure) Commodore PET video implementation question: Hardware cursor?

VIA clock in Commodore PET: is it important it run at 1mhz?

VIA clock in Commodore PET: is it important it run at 1mhz?

Resurrecting this thread with another ignorant question about arcane Commodore/6502-family obscurities. This is specifically about how the VIA is used in the PET.

According to the datasheet the VIA relies on tracking the CPU's PHI2 clock for coordinating its bus cycles (IE, the PHI2 clock should be the same as the CPU's) *and* it is also used as the heartbeat frequency for its onboard timers. So: is there anything in the BASIC PET kernel/BASIC OS that's going to be using the timer and care if the CPU runs at something other than 1mhz? My vague understand was that the "timekeeper" in a normal PET is the 60hz interrupt (which I think I can generate easily enough), but I guess I don't actually know if the timers are used for anything by the ROMs?

The timing hardware I'm diddling with in my prototype is set up so based on the position of a "turbo" switch it can generate a CPU clock that's either one-eighth pixel clock (normal) or one-half (turbo). So, either 1mhz or 4mhz in 40 column mode. (This timing seems to check out so far, but it's possible the "fast" speed might go down to 2mhz if chip select generation makes things too tight. So far with just the video parts in place 6mhz seems okay, fingers crossed.) If the only downside of having the VIA track CPU speed is things like VIA-generated sound is going to sound off unless the program is patched for higher speeds I don't think I'm going to worry, but if there's something system-level that's going to break I'm wondering if I need to come up with some kind of method to clock the VIA at a constant rate and auto-throttle the CPU when it hits the I/O chips.

(It goes without saying that I might need to switch the CPU speed down to stock if I want things like cassette and IEEE-488 to work with the unmodified ROM routines, but I also don't consider that a massive problem if the system will work okay otherwise.)
 
Possible uses of VIA timer:

cursor blink, repeat key, power on chimes, IEEE and Cassette time outs...

I'm *pretty sure* cursor blink is done by counting the vertical refresh IRQs. There's a mention of it in here, and I think I may have seen the code for this when I was ignorantly shuffling through Steve Gray's custom edit ROM source.

I can't find any information about how timeouts are generated for IEEE; it would be a little odd to use the VIA for that if you already have the RTC interrupt, but I suppose its remotely possible? I wish I was better at reading disassemblies.

So far as I can tell cassette I/O itself lives on one of the PIAs and is digitally bit-banged, so compatibility with the original would probably be out the window running at a "turbo" speed anyway?

If the power-on chimes use the VIA shift register like most sound generation on the PET, then, yeah, they're definitely going to be *wrong* if the VIA is running at 4mhz. Not quite into dog whistle territory but unmodified PET sound software would definitely be singing soprano. My inclination is probably to say "known issue" because any action game is likely to be kind of unplayable at 4x speed anyway, but I guess it'll be interesting to find out.

(I was probably going to start off with BASIC 2.0 instead of 4.0 because the smaller ROM footprint might actually be sort of useful thanks to some developments on the video side, so no chime, but I'm still up in the air about that.)
 
... The IEEE topic opens up a whole can of worms, actually. If this actually comes together I'm going to want some kind of storage device, but I'm badly torn how to implement that.
 
Not really apropos of anything, but I thought someone might get a kick out of this particularly obscure piece of Commodore video hardware history I dredged up to use on my project:

For various reasons I settled on a 12mhz max master/pixel clock. This is not fast enough to do an 80 character display with 8-bit wide characters on NTSC. (The video system was original designed to be optimized for 64 character displays, and this is also about the fastest clock that's rock stable running on the breadboard.) However, I engineered a way to do an 80 column screen with *six bit* wide characters, IE, 480 pixels across. I figured if I wanted to actually use this for a PET mode I'd have to draw my own font, but then I vaguely remembered the never-released "Commodore LCD". Some of the earliest 80 column LCDs had six bit wide character cells, so... long story short, yeah, it turns out the font rom for Bill Herd's LCD prototype is on the web, and it has six bit wide characters in a mostly standard GRAPHICS/BUSINESS layout.

Here's a bad cell phone photo of my video hardware displaying data using the GRAPHICS font:

attachment.php
 

Attachments

  • six_bit_petscii.jpg
    six_bit_petscii.jpg
    147.3 KB · Views: 1
Update on the PET(-like) video card project: It's officially a computer now. As of Friday I can run an ancient version of the PETTESTER ROM I wrote back in 2011 on the breadboard after interfacing a Western Design Center 65C02S to the video hardware and shared memory. (At a selectable 4mhz or 1mhz in the 320x200/40x25 video mode.) Next thing to do is to start wiring up enough I/O to see if it'll run the PET version of Commodore BASIC.

Here's a link to my YouTube video where I describe the hardware if you're up for a yawner. Skip to the last eight minutes or so to see it running PETTESTER as part of the demo loop.

 
Looking really good!

Thanks! I’m actually kind of amazed how ‘easy’ it was to get honest-to-goodness PHI clock sync working for video, and I’m kind of proud of the brainwave I came up with to enable using unified memory access for the character memory as well as the framebuffer. Bet this was a lot harder to make work with DRAM...

Note in real life the screen doesn’t actually flip black every few seconds like it looked in the video (and didn’t really notice in the footage until I’d rendered it), so far as I can tell it’s rock solid. Apparently the camera got into some weird not-quite-matching frame rate cadence with the monitor or something. :p
 
Back
Top