# 80-Bus News

## April–June 1982 · Volume 1 ·Issue 2

Program flow is as follows:

 1) Put up the title 2) Initialize the ‘letters tried’ buffer and the ‘trys’ counter 3) Throw a random number from 1 to the maximum number of words 4) Locate that word and copy it to a ‘word buffer’ 5) Display the ‘I’ve chosen a word’ message 6) Test to see if the maximum number of trys has taken place 6a) If not the maximum number of trys, go on to 7 6b) If so, display the ‘lose’ message 6c) Display the word 6d) Display the ‘another go’ message 6e) Get an input, validate it and restart or exit as appropriate 7) Display the ‘what letter’ message and get a letter 8) Check the ‘letters tried’ buffer 8a) If not in the ‘letters tried’ buffer, go on to 9 8b) Display the ‘letter tried’ message then back to 6 9) Put the letter in the ‘letters tried’ buffer 10) Count this try 11) Sean through the word to see if the letter’s there 11a) If not found go on to 12 11b) If found flag it by making bit 7 high (adding 80H) 12) Test the word to see if all the letters now flagged 12a) If not all flagged, then on to 13 12b) Display ‘you’ve won’ message, then back to 6c 13) Display the ‘trys’ message, and the number of trys so far 14) Display the word, flagged characters as letters, unflagged as ‘–’ 15) Display two newlines then back to 6

As you can see the philosophy is simple, and presents no problems to the programmer.

Now onto the bits in detail, from the above, it’s obvious we need three workspaces, one to hold the word, one to hold the letters tried and one to hold the number of trys taken. We also need two others, a three byte workspace for the RANDOM routine (which must be primed with three numbers, any numbers), and space for the program stack.

In order then, the workspace ‘RING’ is the workspace for the RANDOM routine, it is primed with the numbers 01H, 02H and 03H, although so long as this work space contained any old rubbish it wouldn’t matter (it’s random after all). The only thing the RANDOM routine doesn’t like is if all three workspace bytes are 00H.

WBUF is the ‘word buffer’, this must be one byte longer than the longest word it is expected to hold, so this is what limits the word length to 9 characters, and subsequently allows me to indulge in a nice fiddle of which more anon.

TRYS is the one byte store where we keep count of the number of trys taken. To simplify matters, the contents will be in packed BCD, as we are hardly likely to indulge in more than 99 trys.

Next comes the ‘letters tried’ buffer, CHRTRD, which will be the maximum number of trys plus one long. Now in the system equates I defined the maximum number of trys, NTRYS, as being 12H (HEX, as the comparison will be done in packed BCD, 12H is the representation of 12 in packed BCD), therefore if we make the length of CHRTRD equal to NTRYS in HEX, it’s got to be longer than the maximum number of trys without us having to worry exactly how long it is, let the assembler take the strain, that’s what I say.