Part 5 – Interrupts and other tweaks
Since my last post I’ve made a few structural changes to the project, most notably to the video controller. Rather than just being a collection of ad-hoc lines in the toplevel file, I’ve moved it into a self-contained module and also moved the vgacache out of the SDRAM controller and into this new video_controller module.
As yet another learning exercise, I’ve also added a simple character ROM (character definitions taken from the Minimig boot code), and text buffer, which is merged with the display. This will no doubt provide a useful debugging display as the project progresses!
The new video_controller module will eventually support a certain amount of runtime adjustment to the video, through some registers exposed to the TG68 processor. Currently only 1 32-bit register is implemented, which is the framebuffer address. This means the processor can now scroll the display vertically.
In order to do this smoothly, the framebuffer pointer must be updated during the vertical blanking interval – and the best way to do that is to use a VBLANK interrupt. Therefore I’ve also created a simple interrupt controller. This detects momentary pulses on seven different interrupt lines, and encodes them into the 3-bit IPL signal used by the TG68 processor. I’ve used interrupt level 1 for the VBLANK interrupt, and left the others unused for now. When I come to add keyboard and mouse support, another interrupt will be used to signal that a byte of PS/2 data is ready.
Binary (.sof file) and full source for anyone who might be interested, can be found here.