431 Program status register – P An 8-bit register set up and used by the microprocessor itself. Each bit has its own meaning, concerned with the results of arithmetic and logical operations, and with interrupt status. A detailed description of this register is beyond the scope of this manual. Of occasional interest is the state of bit 0, the carry flag (abbreviated to C). This is set if a carry occurs during an add operation, and is cleared if a borrow occurs during a subtract operation. Following an operating system call, the state of C has a significance which varies according to the particular call involved.
An 8-bit register which contains the least significant byte of the address of the next free stack location (the most significant byte is always &01). The stack is a portion of memory (&100-&1FF) used for the temporary storage of data (such as return addresses from subroutines). Data is ‘pushed’ onto the stack in sequence, then removed by ‘pulling’ it off again. The last byte to be pushed on is the first byte to be pulled off (this is often referred to as a ‘last in, first out’ queue).
Stack pointer – SP The assembler delimiters ‘[’ and ‘]’, and general assembly language syntax rules Assembly language statements within a BASIC program must be enclosed between a pair of square brackets (see lines 30 and 90 in the above example). When the BASIC program is RUN , the assembly language statements between the square brackets are assembed into machine code, which is inserted into memory starting at the address specified by P%. An assembly language program consists of a number of assembly language statements, separated by new lines or colons (as in BASIC).
Each assembly language statement consists of an optional label (which must always be preceded by a dot), followed by an instruction. An instruction consists of a three letter assembly language mnemonic followed by an operand (or an address) (both of the latter may be absent depending upon the mnemonic). If a label is included, it must be separated from the mnemonic by at least one space. There need not be any spaces between the mnemonic and the operand. Any character following the operand and separated by at least one space from it will be ignored by the assembler which will move on to the next colon or line for the next statement.
A comment may be placed after the operand and should be preceded by a backslash ( \ ). Any text following a backslash in an assembly language statement will be ignored by the assembler up to the next colon or end- of-line.