Roadrace is a C port of ROADRACE.BAS Copyright 1979 by Phil Feldman and Tom Rugg from Tandy BASIC to DOS.
I cut my programming teeth on a TRS-80 back in the 1980's. By today's standards it wasn't much. I taught myself C for college and eventually decided to start porting some BASIC programs to C. Some were easy. This wasn't.
Translating a program on the same platform from one programming language to another is pretty straight forward. It get's messy porting to another platform when the code was not written for compatability and uses a different resolution which isn't available with a different character set that can't be mapped.
The TRS-80's text resolution was 64x16 characters and the graphics character set broke the chacters down to 2x3 cells. This gave it an effective resolution of 128x48. I decided to emulate this on a VGA card by using the 80x50 text mode. The character set includes characters for blank, left filled, right filled and totally filled characters granting an effective resolution of 160x50.
Each character needed to take up three lines for the graphics, so I had to write my own print routines. The program also had used peeks and pokes for graphic characters which had to be abstracted. There was also the matter of timing - compiled C is significantly faster than interpreted BASIC. I ended up writing my own library for emulating the TRS-80.
I dug this up from one of my backups indicating a modified date of 11/16/98. I updated the source with some more useful function names and additional comments to make it less unreadable. The program was written for the MIX Power C Compiler and compiles with "PC.EXE /E ROADRACE.C". The program runs fine under DOSBox. The TRS-80 library I wrote is not exactly ANSI compatable. It was unclear just how to implement many of these abstractions in a standard's complient manner.
This program has been tested under:
TRS80CHR.DAT should be in the same directory as the executable or in your path.