Close

Faster video emu

A project log for TRS-80 Model 1 on a PIC32

TRS-80 Model I emulated on a PIC32MX processor; VGA, PS/2, and SD for tape and disk images. Oh, and glourious cassette sound.

ziggurat29ziggurat29 01/08/2016 at 02:060 Comments

As mentioned, the code for the 'drivers' was used, with permission, from various sources. In particular, I used video code from the Maximite project (I tweaked it for my TRS-80 native resolution (which further required a line-tripling hack for modern monitors) and discarded a bunch that were for features I didn't need). It worked great and was a huge help. One nagging problem was with video performance.

For the most part, it worked good enough. I could tell with my developer's eye that it was a little sluggish, but that sluggishness was quickly compensated for in subsequent non-video activities (the speed throttling tries to keep the emulated cpu's clock's error function at zero, so if an emulated operation takes a longer than expected time, subsequent instructions execute faster than expected until it catches up). So, for all practical uses, it was perfectly fine. But there was a pathological case: that of switching between normal and wide character mode.

The TRS-80 had a 'wide character' mode, which was rarely used. I mean, who would want to reduce an already constrained 64x16 text display to 32x16? Well, one program did, one of my faves: SpaceWarp. SpaceWarp used the wide character mode as a visual effect by rapidly switching between normal and wide to simulate a 'starquake' when you drove into a star (OK, a period. It was ASCII art.) This worked on the original hardware because the wide character feature was implemented in hardware -- it had no software burden -- but here we had to do a full screen repaint pixel-by-pixel when switching modes.

Anyway, long story short (too late, I know): the new code is fast enough to make this unusual effect work.

OK. Maybe I should get back to work on either emulating the WD1771/91 or making BogoDOS....

Discussions