80-Bus News


April–June 1982, Volume 1, Issue 2

Page 25 of 55


So let’s look at the patch areas. The first patch, (although it’s not obviously so) is the start jump. For either NAS or CP/M versions the three bytes will be the same, C3 ODD3, but for the CP/M version, this jump will be located at 100H, whilst the NAS version will have the jump at 0C80H. (Don’t forget that my assembler prints absolute addresses the ‘right way round’ and not ‘low byte first’ as they would actually require to be loaded, so the above would be loaded as C3 D3 OD.) The next patch area is. the one concerned with getting an input. As printed, it contains the CP/M version. For the NAS version this becomes a system call to ‘BLINK’. However, unlike CP/M function 1 (the input function), the keyboard input is not automatically echoed to the display, so the call to ‘BLINK’ is followed by a system restart to ‘ROUT’. Now ‘BLINK’ corrupts HL and DE, and my notes about the patches say that all registers must be preserved, so HL and DE must be ‘PUSHed’ before the system calls and ‘pOPped’ afterwards. The next patch is the ‘output to display’, with the NAS version, this couldn’t be simpler, a system restart to ‘ROUT’, as ‘ROUT’ also kindly preserves all the registers there is no need to PUSH and POP them, so this patch is all of two bytes long and 14 NOPs to fill the empty space. The last patch is also dead easy, 4 system call to ‘MRET’ and a NOP to fill the one remaining empty space. So having patched the area it should look like this:

0C80 C3 ODDS JP START ; Skip round patches and the text 0C83 F5 GETCHR: PUSH HL ; Save registers


0C85 DF RST SCAL : Internal subroutine call OC86 7B DEFB BLINK ; Keyboard entry routine 0C87 F7 RST ROUT ; Display the character 0C88 D1 POP DE ; Restore registers

0c89 Fi POP HL


OC8B 00 00 00 00 DEFB O,0,0,0 ; Pad to 16 spaces

OC8F 00 00 00 00 DEFB 0,0,0,0

0C93 F7 OUTCHR: RST ROUT ; Display a character 0c94 C9 RET

0C95 00 00 00 00 DEFB 0,0,0,0 ; Pad to 16 spaces

0c99 00 00 00 00 DEFB 0,0,0,0

OcgD 00 00 00 00 DEFB 0,0,0,0

OCAI 00 00 DEFB 0,0

OCA DF EXIT: RST SCAL ; Internal subroutine call OCA4 5B DEFB MRET ; Return to NAS-SYS

OCA5 00 DEFB O ; Pad to 3 spaces

Good, getting there, now there are a couple of others before we go any further. The CP/M version uses code 1AH to clear the screen, and the line feed following a carriage return, code 0AH, is explicit and not implied as it is in the NAS version. Well, the ‘oOlear screen’ character, labelled CS only appears once at OCDSH and this is easily changed to 0CH for the NAS version. The other one, the line feed, again appears only once at ODDiIH and this should be changed to OOH. By the way I haven’t tried this program under the NAS regime, so if it doesn’t work, drop me a line with the correct answer, to collect your ‘Prize Dodo of the Month’ medal.

So on to the program. We all know the rules of ‘Hangman’ don’t we, so there’s no need to reiterate them here. I’m one of those people who isn’t into flow charts, so I’m not going to provide one, the program flows in what I would call a linear fashion, executing in a straight line, skipping the bits that aren’t required as determined by the conditions set from the previous operation.

This is an OCR’d version of the scanned page and likely contains recognition errors.

Page 25 of 55