Retrochallenge 2018/09, 2019/03
VGA Perfect
September 21, 2018
I took what I learned from the previous post, and applied to the the failed version of the VGA interrupt. Success! I now have a stable VGA signal, 248x240, with no pixels lost when typing on the keyboard. I'm keeping the simple version (which blanks out parts of scalines to handle keypresses) as a backup, and it is called VGA_NOTCHY. The version presented here is really hard to follow, so it's called VGA_SPAGHETTI. The pasta video driver supports both 'full' video mode, which draws every scanline, and 'skippy' mode which draws every other scanline.
In the halftime post, it was mentioned my explanations are text heavy. I agree. I've also spent a lot of time in the weeds of the video driver, so posting assembly code here will help no one. It's all in github if you want to see it. So here's a flowchart of the VGA/PS2 interrupt routine. The red line shows a typical path if there is activity on the PS/2 bus during/between active scanlines. There are shortcuts thru the maze if the keypress is handled during a blank scanline. Maybe I took the TRON LightCycles maze too literally when designing this video driver.
Some important paths to look at: (These cases all seem to work)
- Keypress detected during active video scanline, and the next scanline is also active. path shown in red below
- The first time thru the loop saves machine state, including memory bus status
- The second pass doesn't save state, but outputs scanline, then restores state and returns.
- If another bit of bus activity has occured, this could also just keep doing multiple scanlines in a row, witholding cycles from the main program until either the keyboard has stopped sending bits or there is a blank line.
- Keypress detected during active video scanline, and next scanline is blank. (Either for vertical blanking, or 'skippy' video mode.)
- The first time thru the loop saves machine state, including memory bus status
- The second pass skips all active video, but restores memory bus state, and returns to user program.
- Keypress detected during blank scanline (Either vertical blanking or 'skippy' mode.)
- Machine state (cpu) saved, but not memory bus state.
- After bits are handled, the cpu returns to the user program, without touching the memory bus
(Clicking makes it bigger, but not less messy)
|Newest| . . . |<<Newer| . . . . . . |Older >>| . . . |Oldest|
(view all as one document)