home *** CD-ROM | disk | FTP | other *** search
/ Run Magazine ReRun 1992 July & August / rerun-1992-07-08-side-a.d64 / lookload.txt < prev    next >
Text File  |  2022-09-20  |  3KB  |  17 lines

  1. Look and Load
  2. By Wayne Martin
  3.  
  4. Programmers love to stick pet machine language routines in the 4K of memory between $C000 (49152) and $CFFF (53247), so I wanted to find another, safer spot for a utility program I had written. I'd never seen an ML program stored in RAM memory under the Kernal ROM, so I figured that would be a safe place. When loaded, my program sits in the background waiting for the F7 key to be pressed. Then, it lists the disk directory and loads any program you choose, just by pressing F7 again. Because of its location, loading and running another program will not affect Look and Load.
  5.  
  6. Whenever you want to use Look and Load, just select Look & Load from Menu 64. If you've copied the Look & Load files to a work disk, type LOAD "LOOK & LOAD",8 and enter SYS267 [return] to load KR and reset the interrupt vector. If the interrupt vector is returned to normal (by pressing RUN-Stop/Restore or a reset button), SYS290 will re-activate it.
  7.  
  8. During the interrupt period that occurs every 1/60 of a second, the computer checks to see if F7 was pressed. If so, then upon return from the interrupt routine it will jump to the ML routine located in RAM under the Kernal ROM. My routine clears the screen and prints the disk directory. Press the space bar to slow the directory and any other key to stop it. To resume scrolling, press the space bar again. Use the cursor up/down key to move the highlighted area to the directory listing that you want to load. Press F7 again to load the program. You can load any Basic or ML program.  If you do not wish to load a program, press return to clear the screen and return to Direct mode.
  9.  
  10. How It Works
  11.  
  12. Examine the program and you will see four sections of Data statements. The first copies the Basic and Kernal ROMs to their underlying RAM memory.The second  pokes the list and load program to an area in the newly copied Kernal RAM. The memory between $F8E2 (63714) and $FB96 (64406) is used only for tape operations, therefore I can poke my program in this area and still use the other Kernal routines.Now comes the tricky part. In order to use the new Kernal RAM, the Kernal ROM must be turned off to force the computer to use the program in RAM memory. This is done by changing the value in memory location #1 to 53. Upon completion of the program a 55 is stored there.
  13.  
  14. The switching must be done in an area of memory that is not affected by other computer operations. There is an area between $010B (267) and $013E (318) that is only used during tape loading and cannot be overwritten by the stack, so the third set of Data statements pokes a short machine language routine into $010B that will do the required bank switching. It also holds the KR Load program.
  15.  
  16. The last set of Data statements takes all the above and saves the two programs, KR Load and KR, to your disk. KR is an entirely new Kernal RAM. One warning: If you use a FastLoad cartridge, do not use the Monitor function as it changes the interrupt vector in RAM under Kernal ROM and thereby causes the program to hang up.
  17.