Pages

Sunday, 3 January 2016

Knight Lore on the TRS-80

This is the result of, quite literally, 5 minutes coding. And it really did work first build!

The update_screen() function implemented on the TRS-80

This is the update_screen() routine, used to display the main menu and the screen after entering a new room. Here-on after, the code calls a blit() routine to update small rectangular areas of the screen. I expect that won't be a lot more work either, but right now my daughter is sitting on my lap wanting me to print another Nemo picture to colour in...

UPDATE: added the blit routine, and rudimentary keyboard input to allow me to play the game.

Looks better than my C port with proper Z-order
 It's quite playable on the emulator.  There's one glitch in the blit routine that causes certain frames to appear as white rectangles, but I'm sure I'll work that out before too long.

The really amazing thing is that I've spent about an hour on this this morning, starting with stock ZX Spectrum code. So back in the day, it would have taken the Stamper brothers about a day to produce a TRS-80 version; if the hires graphics hardware had the bandwidth to handle it.

UPDATE#2: the game is running perfectly (under emulation) on the TRS-80.

The glitches were caused by a clash between Knight Lore and the TRS-80 memory map. Knight Lore builds ~4K of look-up tables for bit-shift and bit-reverse in high memory ($F000) for the rendering routines. I simply moved them down low and the game now runs properly; I still had a couple of minor relocation issues to sort. I also coded the proper keyboard logic to support all keys supported on the Spectrum. In theory the TRS-80 port is complete now.

The game appears to run roughly the same speed as the Spectrum under emulation. The TRS-80 CPU clock (4MHz) is slightly faster than the ZX Spectrum (3.5MHz) but the graphics are likely slower.

For academic interest I'll build a pixel-doubled version next, though it'll run even slower on real hardware of course.

No comments:

Post a Comment