Ok... Spent an hour or two rewriting most of the code today to use interrupts at 64us intervals instead of having precise timed loops.
The code ended up about the same size but is now easier to maintain and it makes it possible to run an application software in the foreground without disturbing the video that is in the background handled by the interrupts.
About 2/3'rds of the CPU time is spent inside the interrupt handler doing video & sync outputs. The remaining 1/3'rd is available for the foreground application/game. That should be plenty for a Chip-8 interpreter to run at full original speed.
The output is still a little bit glitchy since I haven't yet been able to de-jitter the interrupt handler, but for the time being it just adds to the 1970's retro feeling :-)
Discussions
Become a Hackaday.io Member
Create an account to leave a comment. Already have an account? Log In.
I wonder if there is a way to make a composite display with 16x9 aspect ratio that will have square pixels on a 16x9 monitor in "streched" mode. Your pixels actually look kinda sqaure - is it just that 64:32 is close to 16:9?
I guess true 16:9 would be 64x36. I wonder if that would be possible. The vertical is no longer a nice power of two, but still ...
Oh, I see that Chip-8 specifies 64x32.
Are you sure? yes | no
By some incredible luck they ended up quite square on 16:9 using seven lines vertically and five instruction cycles (625 ns) horizontally. Using 8 lines per pixel and I'm outside of the PAL display area, and with 6 cycles horizontally I also end up outside of the display area.
The loop-unrolled video-output code have 3 cycle extra delay for each pixel, removing them I could squeeze in 208 pixels horizontally with bitbanging only - not using the SPI or EUSART peripherals.
The dox says that the pixels was about square also on the 4:3 back in the days. This implies that they used much wider left/right empty margins on the screen for chip8 back then....
Are you sure? yes | no
Nice video wrencher!
Are you sure? yes | no
Yup... 64*32 should be enough for anyone - or anything ;-
Are you sure? yes | no
It makes me want a 64x32 LED display...
Are you sure? yes | no