• Please review our updated Terms and Rules here

Make PET video 100% snow free.

...my true vintage trash is the TRS-80 Model I...
I see what you did there.

...which also has "snow", I guess I'm not sure what the big deal is. (I figure it's part of the charm at this point)
Yeah, I don't see why anybody would mind it. When you're comparing with modern machines, a bit of snow is nothing compared to putting up with a monochrome display with only a thousand or so characters on it.
 
One other reason I like the original vintage gear is that it is normally 100% repairable and also easy to modify and most of the firmware is well documented by enthusiasts (though some is not).

With more modern parts FPGA's etc, they can be difficult without the right programmers and the ROM code and JED files sometimes might not be open source. I think that happens when the makers are wanting to make money out of their projects or at least fund them, so the details are kept secret to stop others replicating their work, which is fair enough, from their perspective, if they have poured time and resources into their projects and feel that they don't want to give them away.

Secret firmware code though hiding in IC's, as forum members will know from other posts, drives me crazy!

My personal vintage computer interests though are somewhat like other areas, such as Amateur Radio, where there is a free spirit of sharing. All of my vintage computer projects I write up in detail, everything is free for others to use at their will.

Back onto the topic of the thread though, about snow in video;

There is another way to get around it. The method was used in digital video Timebase Correctors, though its application was different, it was used to generate a still video frame. You can update the video memory anytime if you are not reading it out, so there is simply enough video memory for two consecutive video fields (in an interlaced system) or two frames in a non interlaced system. The actual video that gets to the screen is delayed. While one field is being read out, the other is being written to the other half of the memory.

In freeze mode, all that happened was the writes to the memory half being written are allowed to finish, then writes get suspended and then the two field memories just get read out relentless in a loop. Having a system like this is a lot faster than only allowing memory manipulations only in the vertical blanking interval, the video memory can be updated anytime. I can see why it might never have been deployed in a vintage computer because of video RAM costs at the time, but this sort of thing might possibly be done in modern video cards with a lot of video RAM as they can produce freeze frames.

It can use up a lot of memory though, for monochrome video its 2 fields storage, if still frames are required. For NTSC color it requires storage of 4 fields, because as well as the odd & even field, the burst phase is different on each pair of odd and even fields and with PAL it requires 8 fields storage, just for one still frame because of the unique color phase over the 8 fields.

There is a very helpful IC out there though for video field storage, it is the AL422B made by Averlogic, it is a 392,216 (384k) x 8 bit Fifo. Using a 16MHz clock and 20mS time per field, the number of 8 bit memory locations used per field is 320,000 so there is still some room to spare when storing a whole field in each IC at this high pixel clock rate. It is very convenient part due to the minimal support circuitry required. Using a couple of these compact chips in a vintage computer replica design would solve any snow issues, and make for a faster computer, if that was a requirement.

I once designed a freeze frame machine for NTSC & PAL and published all of the details in case anyone wanted to make one. I have posted the link before but won't again unless somebody requests it. It doesn't have much of an application these days because most video sources now come from systems with live pause buttons. Though I mentioned in the article that one application of a freeze frame machine has been used by Hollywood in the movies & TV. The scenario was sometimes seen in vintage TV shows, such as Mission Impossible. Typically there is a closed circuit TV camera looking at some top security area. The secret agent or similar attaches a circuit board to the camera's video output feed, it captures & freezes the image and outputs it down the camera cable. So the security guard watching the monitor in the control room sees what looks like a normal situation, while in reality all sorts of antics are going on.
 
There is another way to get around it. The method was used in digital video Timebase Correctors, though its application was different

That would be one heck of a heavy hammer to use just to fix CRT snow. And... actually, I have a number of objections to this, some of which I think will be kind of obvious if one thinks about it very long...

You can update the video memory anytime if you are not reading it out, so there is simply enough video memory for two consecutive video fields (in an interlaced system) or two frames in a non interlaced system. The actual video that gets to the screen is delayed. While one field is being read out, the other is being written to the other half of the memory.

Okay, sure. So you have two copies of the framebuffer that trade places; one of them is the sole property of CRT refresh, the other can be updated by the CPU. Dumb questions:

  1. Are these two memories kept in sync? If so, how? I mean...
  2. Does the CPU *know* it has to maintain two copies of the framebuffer and make all changes atomically to only the copy it has access to? Are you using vertical refresh interrupts to notify the CPU which framebuffer is in the lead?
  3. If you're *not* doing that, well, how does delaying the output a frame help? Snow is the result of contention between the CRT and the CPU when the CPU is given priority. If you just slap a timebase corrector in front of a snow-y video system isn't it just going to delay the snow by 50 or 60ths of a second? Are you imagining some scenario where we have the delayed framebuffer as a backstop, so if we see a CPU write happen we, in real time, switch so we're "playing back" the last frame's contents instead of "real time" on the assumption the "stale" contents will reduce in less screen disruption than the "current" contents? (Which, honestly, seems just as likely to me to *cause* snow or tearing as correct it?)
  4. If the idea is that you're "forking" updates so writes go to both memories but the CRT has priority to the "visible" memory and the CPU has priority to the "background" one... uhm, aren't you going to be screwed when they change places, because the visible one is no longer going to be current when it's switched to the background? (Because by definition it missed any otherwise snow-generating updates that were sent.) Is the idea here you're going to use this FIFO chip to store conflicting writes for later replay? I mean... I'm kind of baffled at this point.
Switching between foreground and background framebuffers on a vertical interrupt is a technique that's used in some classic computers for "tear-free" screen updates and simple animations, but it relies on atomically updating multiple independent framebuffer entities, which the programmer "knows about". By all means, I might be missing something obvious here, but... explain further, please?

Having a system like this is a lot faster than only allowing memory manipulations only in the vertical blanking interval, the video memory can be updated anytime.

1: If you're using a 6502, with its nice predictable 50% bus duty cycle, you can get hitless video memory sharing for free as long as you're willing to clock your CPU in sync with your video generation. Every PET after the first one did this, as did "most" other 6502 computers.

2: If you're using some other CPU, wait states aren't the end of the word. The TRS-80 Model I had "snow". The Model III doesn't, and it does this by inserting wait states if a write to display memory happens during the active area of a line. (IE, writes are allowed all the rest of the time, IE, horizontal and vertical blanking areas.) Worst case this can delay a clashing write by around 40 microseconds or so. (A mod to add this same behavior to the model I exists.) Strictly speaking this *could* be enough to cause a little audio distortion in some action video games (sound on a TRS-80 is all about delay loops), but in real life, no, it wasn't bad enough for anybody to care.

3: If we're chucking more modern parts like 384k FIFOs into our classic computer remake we also have the option of chucking, I dunno, dual port RAM or double-clocked SRAM in instead, right? (Maybe induldge in a little light cycle-stretching?) Because those would seem to make a lot more sense than some weird external double-buffer add-on?
 
Last edited:
… wait. Maybe I figured it out? Is the idea here you have 2 frames worth of FIFO that you trade off reading the framebuffer into, but the arbitration is set up so the CPU gets higher priority than the FIFO fill? (IE, we can fill the background FIFO asynchronously, thereby relaxing the “chasing the beam” timing requirements? In this case it’s the video address generator that gets wait stated…)

I mean, sure, I guess that could work. With the downside that you’d have to *completely* redo the video address generation circuitry and implement a whole new system for walking through the FIFOs on the output side. But… man. That seems like a heck of a big rock to drop on a small problem, especially considering other options that can behave much more like the original circuits are readily available.
 
… wait. Maybe I figured it out? Is the idea here you have 2 frames worth of FIFO that you trade off reading the framebuffer into, but the arbitration is set up so the CPU gets higher priority than the FIFO fill? (IE, we can fill the background FIFO asynchronously, thereby relaxing the “chasing the beam” timing requirements? In this case it’s the video address generator that gets wait stated…)

I mean, sure, I guess that could work. With the downside that you’d have to *completely* redo the video address generation circuitry and implement a whole new system for walking through the FIFOs on the output side. But… man. That seems like a heck of a big rock to drop on a small problem, especially considering other options that can behave much more like the original circuits are readily available.
It could save some parts here, and lose some parts there.

The sort of memory that the AL422B is is designed to automatically increment the address from its clock input, so it saves an awful lot of support chips and address counters. It was designed with video signals in mind. Normally, rather than serializing the 8 bit output data, instead it is customary in video work to pass the data to a DAC that essentially does the same thing in a different way. I'm not really sure if overall it could be better, but it might be worth looking at its data sheet.

You can easily see the way I used these chips in my machine. But this machine was totally free of a CPU, but it just occurred to me that these chips could also help in computers and I do know that modern video cards are capable of perfect uninterrupted and un-corrupted video output, presumably because (partly at least) of the large memory and frame buffering abilities.
 
t could save some parts here, and lose some parts there.

The sort of memory that the AL422B is is designed to automatically increment the address from its clock input, so it saves an awful lot of support chips and address counters.

Not really? Where are you "losing parts"?

I mean, let's think about this. If you're trying to emulate a "normal" old computer with memory mapped video you're going to need a block of memory that can be arbitrarily random-accessed by the CPU *and* is regularly serially accessed by the display refresh circuitry to update the contents of what gets shoved out to the CRT on a time-critical basis. Again, let's get clear on what "Snow" is: it's the result of a CPU access to that shared block of memory "starving" the CRT refresh circuitry, thus resulting in garbage being loaded into the output shift register instead of it receiving the contents of the memory the display address circuitry was pointing at when the conflicting CPU action happened.

This chip you're talking about is a FIFO with two independent address counters, and "in" and an "out"; these counters can be incremented, and they can be reset. That's it. There's no random access. So obviously you can't just have the CPU write arbitrary updates directly into the FIFO's memory and treat it like a dual-port memory chip. (Which is, in the end, basically all it is.) So if you're going to try to use it to implement it as a "de-snow-ing" measure then the role you're going have to employ it for is as a cache after the "real" framebuffer to allow for the video refresh read-out to happen asynchronously. (And thereby tolerate interruption from the CPU.) Which... sure, you could do, but again, where are you losing parts? To fill the FIFO you're still going to have a complete video address generator circuit that increments through the framebuffer memory, reads it, shoves it through a character generator (if it's not a pure bitmap), and translates it into dots. The difference is instead of those dots going into a shift register and immediately output the plan here is we're going to shove those dots into this fifo, where they're going to sit for some period and then be drawn out the other side at a fixed rate tied to the CRT sync. So what sort of changes is this going to entail?

  1. Our video address generator can no longer be directly linked to sync generation or other video timing goo, because that's the whole point, it's not synchronous anymore. Essentially what we need here is a generalized DMA circuit that's going to walk through the framebuffer memory as fast as possible and stuff it into the FIFO... but because, again, our point here was that we don't want to WAIT the CPU we're going to WAIT the video address generator instead.
  2. When the DMA is waiting because it's blocked on a CPU access obviously the "write" counter on the FIFO is blocked too. So when designing this system we're going to have to decide how far behind the output should wait behind the input. You said we're going to use two of these FIFOs, so I guess this is easy, have it stall for one frame. When you take all the blanking areas into account the active area off a computer screen isn't going to be much more than half the total vsync frame interval, so this should hopefully be sufficient to make sure the output counter doesn't catch up with the input counter. We hope.
  3. Because our video address generator is now incapable of generating the video sync pulses we're going to need a brand new, completely separate timing chain to generate those. This chain is also going to have to have line and row counters to generate the output clock signals for your AL422B FIFOs...
So... again, where does anything get deleted here? This reads to me like you're basically doubling the number of counter chains in the system, and you're also adding the memory arbitration systems you'd be adding to implement wait states; you're just putting them on the FIFO fill system instead of the CPU.

FWIW, there were, back in the day, CRT controllers like the Intel 8275H that used FIFO memory combined with DMA to cut down on the amount of overhead imposed by sharing the same block of memory between a CPU and video refresh. To be clear, this system typically stalled the CPU when it was filling its FIFOs (two 80 character line buffers), but it still cut down on contention a *lot* because it only had to stall the CPU for 80 byte reads every (however many lines tall your characters were) raster lines instead of 80 perfectly synchronous byte reads *every raster line*. Essentially what you're proposing here is building that except buffering every raster line and (hoping) the contention will always be low enough that you don't overrun your buffer on a given frame.

Considering we're talking about "vintage-like" computers here... again, just spitballing, wouldn't it make a heck of a lot more sense to just us a readily available sub-50ns SRAM (Infineon makes 512Kbyte *10ns* parts you can get 1x priced for $7.00 from Mouser) and do few little clever cycle-stretching mods to give you hitless memory access instead? (One relatively lightweight strategy could simply be "double-clocking" the memory compared to what either the CPU or video circuitry could need to access it at and use latches to give you "wiggle room" on the available access windows. That, in fact, appears to be from the datasheet what the AL422B is doing internally to arbitrate access to the bulk DRAM storage.) That would require a *lot* less in terms of changes to the original video addressing and sync generation circuitry. A modern 10ns SRAM might not be original, but it's no worse than the AL422B by that count.
 
>>> I have had the Tynemouth board installed for several years.

Thanks, I didn't read it like that (hence my response)...

>>> Maybe it is best just to embrace my early blue PET for what it is and what it does with the mods I've already done.

I agree. In my opinion, 'upgrading' one of these PETs actually degrades the 'value'. Adding a RAM/ROM board is reversible. Cutting tracks etc. is (still) reversible - but would still detract from the 'value'.

I think the 'snow' is one of the 'charms' of these early machines and is something to be overcome by the programmer... This is one of the reasons for the 'wait for flyback' signal and the associated ROM code.

Trying to get the original ROM and RAM of the machine to work would also be an advantage. A much longer goal though.

Dave

Thanks for the info.
I am working with assembly source for a modern program called PETrock, a spectrum analyzer that runs at a fast refresh (https://github.com/PlummersSoftwareLLC/PETRock). I'm wondering how hard it would be to modify it to avoid the snow using screen blank or wait for retrace (a.k.a wait for flyback signal?) discussed here (http://www.6502.org/users/andre/petindex/poke/index.html#history) and whether the program would still refresh fast enough to be functional. Seems like an interesting challenge, but not sure of the effort level for value of the result.
 
Waiting for the retrace should be a fairly simple modification.

As to whether it is worth the effort or not, that is a subjective question.

I would (personally) give it a go! But that is my own view.

Dave
 
Given that my true vintage trash is the TRS-80 Model I, which also has "snow", I guess I'm not sure what the big deal is. (I figure it's part of the charm at this point) Although... I guess one area where the Trash 80 differs from the original PET is the TRS-80's circuitry is designed to blank the video output when there's a clashing access so instead of random dots the Trash-80 is limited to black streaks in white areas. Which might be marginally less obnoxious.

The TRS-80 method in the majority of cases where most of the screen is blank dramatically reduces the visual disruption to display.

A port of Breakout to the TRS-80 wouldn't look anywhere near as bad as this:

 
I'm wondering how hard it would be to modify it to avoid the snow using screen blank or wait for retrace (a.k.a wait for flyback signal?) discussed here (http://www.6502.org/users/andre/petindex/poke/index.html#history) and whether the program would still refresh fast enough to be functional.

Does your program disable the normal 60hz clock interrupt of the Commodore PET? This interrupt is generated by the video circuitry when it enters the vertical refresh area and is normally used as the trigger to run the keyboard scan routine, blink the cursor, and update the real-time clock register. If the rest of your program can deal with those interrupts it would seem a relatively straightforward thing to do would be to batch screen updates to happen synchronously with that interrupt. (The description of your program in the Github repo says it happens at around 40 FPS, I suppose with this approach maybe you'd attempt to update the screen every other sync interrupt, or 30 FPS?)

... OK, I guess looking at your serial driver code you disable the vsync interrupt in favor of letting the VIA use it. So... clearly this makes life harder. (Ignorantly looking through the code, it appears you're not using the shift register, you're doing an interrupt for every bit?) It looks like the code already manages to interleave keyboard scanning with serial communication, so would it make sense to enhance this so in the in-between-bits space it would check the state of PB5 on the PIA that the Vsync line is connected to and kick off a chunked-for-the-time-available screen refresh loop that updated the screen contents with updates that were "cached" at times you're *not* in the vertical refresh state? This would let you tack the snow surpression onto the serial driver without having to actually re-enable the vsync interrupt?
 
Last edited:
Does your program disable the normal 60hz clock interrupt of the Commodore PET? This interrupt is generated by the video circuitry when it enters the vertical refresh area and is normally used as the trigger to run the keyboard scan routine, blink the cursor, and update the real-time clock register. If the rest of your program can deal with those interrupts it would seem a relatively straightforward thing to do would be to batch screen updates to happen synchronously with that interrupt. (The description of your program in the Github repo says it happens at around 40 FPS, I suppose with this approach maybe you'd attempt to update the screen every other sync interrupt, or 30 FPS?)

... OK, I guess looking at your serial driver code you disable the vsync interrupt in favor of letting the VIA use it. So... clearly this makes life harder. (Ignorantly looking through the code, it appears you're not using the shift register, you're doing an interrupt for every bit?) It looks like the code already manages to interleave keyboard scanning with serial communication, so would it make sense to enhance this so in the in-between-bits space it would check the state of PB5 on the PIA that the Vsync line is connected to and kick off a chunked-for-the-time-available screen refresh loop that updated the screen contents with updates that were "cached" at times you're *not* in the vertical refresh state? This would let you tack the snow surpression onto the serial driver without having to actually re-enable the vsync interrupt?
Ok. Thanks for that analysis. I did not write the PETrock program, but may try to modify it (or convince the original author to modify it) along the lines that you are describing.
 
Back
Top