Hac-Man Retrochallenge: How do we do graphics?

hacman cursor addressing

As mentioned in my last post, there are a lot of old, interesting and scary idioms that RSTS/E programmers had to employ if they were to write any kind of game on the system.  Of course, the term “graphics” has to be stretched quite a lot with a text-mode VT100, but when you’re in 1981 and can’t afford an Atari, one does what one must.

The screenshot above shows some of the graphic handler routines in Hac-Man.  You’ll note this looks somewhat like BASIC, only with some extensions.  (This describes virtually every dialect of BASIC with “Extended” in the title…)  RSTS/E BASIC has what is known as EXTEND mode.  This allows for longer variable names and multiline statements and comments.

I’m using the DEF FN functionality of BASIC to wrap some code that displays VT100 escape sequences to the user’s terminal.  FNAD$ is a function that performs direct cursor addressing.  It is not obvious from my snippet of code, but RSTS/E is a 7-bit ASCII system and one had to do some tricks to get the escape code to pass to the terminal without the system intercepting it.  Earlier on, there is a line in my code that defines the escape character (which would normally be decimal 27).

910 ESCH$=CHR$(155) ! Default escape character
for RSTS/E

Code 155 is simply code 27 with the high bit set.  RSTS ignores it and it is echoed back to the terminal.

To make this game work, we also need to turn on the alternate character set.  That’s in the function FNLD$.  Here’s what the program listing looks like normally:


normal character program listing

The GFL$ array holds our playfield, which I will describe in a later post.  Doesn’t look like anything.

Here is the listing in special character mode:

special character program listing

The playfield is being murdered by line wrap, but you can see blocks and dots there.

An aside on editing:  RSTS/E had an older revision of TECO, but with screen editor capabilities via the TECO program VTEDIT.  (EDT also had a screen editor, but back in the day I much preferred VTEDIT;  also, today, EDT’s screen mode doesn’t seem to work in Tera Term.)  Such an editor was a virtual necessity when developing in any language on the 11/60.  This playfield was first composed in TECO as a plain text file, and then copied, and edited again to add code around the text.

The next few posts will explain more about my graphics and my input logic.  Then, I’ll be almost ready to move Hac-Man and his ghosts around the screen!


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s