The Editors and Readers of COMPUTE!
If you have any questions, comments, or suggestions you would like to see addressed in this column, write to "Readers' Feedback," COMPUTE!, P.O. Box 5406, Greensboro, NC 27403. Due to the volume of mail we receive, we regret that we cannot provide personal answers to technical questions.
A Volatile BASIC
I have a Commodore 64.1 want to copy the BASIC ROM to the underlying RAM (locations 40960-49151). Currently, I'm doing this with a FOR/ NEXT loop:
FOR I = 40960 TO 49151 : POKE I, PEEK(I) : NEXT
This loop requires a little more than 30 seconds to execute. Can you show me a faster way to move BASIC?
The fastest way to move large blocks of memory is to use the 64's native language—6502 machine language. Figure 1 is a machine language program that moves BASIC from ROM to RAM.
You'll probably want the program in the form of a BASIC loader:
10 FOR I = 679 TO 702 : READ A : POKEI, A : NEXT 20 DATA 169, 0, 133, 251, 168, 169, 160, 133 30 DATA 252, 162, 32, 177, 251, 145, 251, 200 40 DATA 208, 249, 230, 252, 202, 208, 244, 96
Type in this program and type RUN. When you're ready to move BASIC, type SYS 679. The cursor should reappear in about one second. BASIC has been copied to RAM.
Once you've moved BASIC into RAM, you can modify it as you wish. To put your modifications into effect, you must turn off the BASIC ROM with this statement:
POKE 1, PEEK(1) AND 254
There are many interesting modifications to BASIC that you can make. You could use a FOR/NEXT loop to search for certain BASIC messages or command names.
As a sample modification, let's change the question mark used by the INPUT statement into a colon: POKE 43846, 58. The ASCII value for a colon is 58. Location 43846 normally holds the number 63—the ASCII value for the question mark.
Sheldon Leemon suggests other changes in Mapping The 64, from COMPUTE! Books.