14. 1.2kbytes of PM software - The ‘Junior on TV’ program

Chapter 12 of Book 3 introduced the Printer Monitor system program. Now that we are familiar with its operation, it is time to describe the software involved in detail. Readers may wonder why this should be necessary, considering that the program can be used adequately without this knowledge. There are two arguments in favour of analysing the PM software: 1. It will help the programmer to develop his/her own software. 2. Various PM subroutines (or parts of subroutines) can be incorporated into user programs — see the examples used in chapters 12 (Book 3) and 13 (Book 4). This does not mean, however, that we are going to dwell on each and every byte, for as can be gathered there are a total of 1268 bytes in all! in any case, after reading three (and a bit) books on the Junior Computer, most readers should be completely up-to-date with the 6502 machine language.

  1. Any system program consists of a main routine as well as a number of subroutines. The main PM routine is based on a well-known principle: the computer waits for a key to be depressed and then checks to see which key was operated. Next, the corresponding key function is executed and the machine returns to a central ‘cross-roads’ in the program and waits for another key to be depressed, thereby completing a circuit, so to speak. An initialisation routine is only run occasionally, usually at the start of a particular program, for instance. The Printer Monitor initialisation routine is shown in figures 1a and 1b. It is very similar to the RESET routine of the original monitor program and is run during the first and second starts of PM (see chapter 12 of Book 3). The section of program after the label LABJUN in figure 1b is also run after the BREAK key is depressed and when the text ‘JUNIOR’ is to be output as an error message or otherwise. The STEP routine (figure 1b) is run whenever an instruction has been