Adding BASIC commands can be accomplished by locating machine language subroutines in RAM that is safe from NEW and LOAD. Two ideal places are above RAMTOP or below address 16384, such as in Hunter’s NVM. You call the commands with USR; either in immediate mode or from within a program. This example gives details for placing routines above RAMTOP or in the Hunter NVM.
STORE transfers a screen image (display file) above RAMTOP to be re-displayed by the RECALL command.
Enter listing one exactly as shown. Notice that you enter hex codes directly into the REM at line one. Line 6 translates these to decimal codes as it POKEs your program to the chosen RAM area.
LISTING ONE
1 REM 2A0C40114871011803EDB0C9214871ED5B0C40011803EDB0C9
2 SAVE "ST/R[illegible]"
3 FAST
4 LET L=30000
5 FOR F=16514 TO 16563 STEP 2
6 POKE L,(PEEK F-28)*16+PEEK (F+1)-28
7 LET L=L+1
8 NEXT F
9 POKE 16388,48
10 POKE 16389,117
11 NEW
SYNTACTIC SUM: 13187, 8K ROM
SAVE the program by entering RUN. Now when you LOAD the tape, the program RUNs and transfers the routines to memory automatically.
STORE by using RAND USR 30000, RECALL by RAND USR 30012. STORE won’t work in immediate mode since CLS always follows immediate entry.
After loading the routines in upper memory, RAMTOP is lowered to 30000, thereby protecting them from NEW and LOAD. To shield the STOREd screen from NEW and LOAD, relocate RAMTOP to 29000: POKE 16388,72; POKE 16389,113.
To change listing one for use with the Hunter NVM located at 8K, delete lines 9 and 10 and change line 4 to LET L=8192. New calls are STORE, RAND USR 8192, and RECALL, RAND USR 8204.
ASSEMBLY LISTING
7530 2A0C40 STOR LD HL,(DFILE) 7533 114871 LD DE,7148 7536 011803 LD BC,0318 7539 EDBO LDIR 753B C9 RET 753C 214871 RACL LD HL,7148 753F ED5B0C40 LD DE,(DFILE) 7543 011803 LD BC,0318 7546 EDB0 LDIR 7548 C9 RET
Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.