GENERAL RULES FOR PROGRAM WRITING
Although for a user program to be functional it need only work with the exact system it was written for, following a few simple rules reduces program modifications for 6800 systems using other monitors. Following these rules will make your programs more professional and versatile. Some general guidelines are as follows:
1.) Minimize the number of references made to the ROM.
2.) Do not use strange,
3.) For large programs, vector I/O through a jump instruction for ease of change to match other I/O packages. Example:
DON’T | DO | à |
JSR INEEE | JSR INPUT | |
JSR INEEE | JSR INPUT | à INPUT: JMP INEEE |
JSR INEEE | JSR INPUT | à |
4.) Try not to use the SWTBUG® RAM any more than necessary. With the exception of using it as stack storage and memory diagnostics, there is no real reason to use the SWTBUG® RAM area.
5.) Define the stack area at the beginning of the program. Example: Start LDS #$ A042. Relocating the stack location to A042 at the beginning of each of your programs will prevent you from having to reload the program counter addresses A048 and A049 each time you RESET and restart your program.
6.) Most programs should have a provision for exiting them without hitting the RESET button. A jump to CONTRL (7E E0E3) instruction in your program will cause SWTBUG® control to resume when executed.
MEMORY DIAGNOSTICS
The earlier memory diagnostics ROBIT, MEMCON and CDAT supplied by SWTPC were compatible only with MIKBUG®. The new versions ROBIT 2, MEMCON 3 and CDAT 2 are compatible with both MIKBUG® and SWTBUG®.
PROGRAM DESCRIPTION
Although the source listing of SWTBUG® is well commented, the following subroutine by subroutine description should be of use to those who wish to gain the maximum advantage of its routines.
TEMPORARY STORAGE LOCATIONS
IRQ (A000) | This location is used by the standard IRQ interrupt request feature. When an |
| interrupt is generated, processor control will jump to the location stored in |
| IRQ. |
BEGA (A002) | This location is where the beginning address is stored for the punch and end |
| of tape routines. |
ENDA (A004) | This location is where the ending address is stored for the punch and end of |
| tape routines. It is also used by the byte search routine. |
NMI (A006) | NMI is used by the |
| generated, processor control will jump to the location stored in NMI. |
13