430 If you have not already seen this program, then what it does is to wait one second for a key to be pressed. If no key is pressed within one second then nothing happens (command mode is returned to). If a key is pressed within one second, its character is printed on the screen and command mode is returned to immediately. Line 10 simply assigns the value &FFF4 to the variable called OSBYTE. If you are familiar with operating system calls then you will recognise OSBYTE as the name of a MOS rotine and &FFF4 as its call address. Line 20 assigns the value &3500 (an address, as it happens) to the resident integer variable P%.
When the program is run, the value in P% is transferred by the machine operating system (MOS) into a register in the 6512 microprocessor called the ‘program counter’ (abbreviated to PC). The program counter is one of six registers which reside in the 6512. The registers, their abbreviations and their uses are listed below. The 6512 registers Program counter – PC (PCL – low byte, PCH – high byte) A 16-bit register which contains the address of the next instruction to be executed. In the example shown above, the initial value of PC is taken from P%. The contents of the program counter are altered by ‘jump’ and ‘branch’ instructions, thereby diverting the flow of the program.
Accumulator – A An 8-bit general purpose register used for all arithmetic and logical operations. X register – X An 8-bit general purpose register often used to contain entry and exit parameter values for MOS routine calls, also used to contain the ‘offset’ for indexed addressing modes (see later), or as a counter. An 8-bit general purpose register often used to contain entry and exit parameter values for MOS routine calls, also used to contain the ‘offset’ for indexed addressing modes (see later), or as a counter. Y register – Y