Classic Computer Magazine Archive COMPUTE! ISSUE 46 / MARCH 1984 / PAGE 10

64 Tape LOADs With Supermon

I have one of the many versions of Supermon64 (COMPUTE!, January 1983), which I have been running on my Commodore 64. I have used it successfully to assemble and run some simple machine language subroutines to move sprites.

My problem is, I cannot successfully save a BASIC program that includes these subroutines.

According to my Programmer's Reference Guide, I should be able to load the machine language routines from within the BASIC program by using LOAD "Machine Language Name",1,1. When I try this, it says PRESS PLAY, stops at the proper place, and says FOUND Machine Language Name. However, when I press the Commodore key, it won't load properly. It will run to the end of the tape if left alone. This leads to the following questions:

  1. Does the Supermon program record the machine language programs in the proper format to be loaded as above?
  2. Is there a way to force the Commodore key character into the keyboard buffer so as not to have that interruption?
  3. I have a Frogger cassette from Sierra On-Line that has you load the program the same way that Commodore recommends for machine language, with LOAD "Frogger", 1,1. Yet this program does seem to have a short BASIC program with a SYS command as part of it, that can be loaded in the normal BASIC way. How do they make both the BASIC and machine language sections load sequentially with the same LOAD command? And how do they make the program come up running, even though only a LOAD command was used?

Furthermore, is there a way that the Supermon program can be relocated, perhaps at the top of memory, so that the BASIC program can be written after the machine language is complete? As it is now, the beginning machine language parts of Supermon seem to come in just above the BASIC program section, at around $0880. I have been able to resave the Supermon program on another tape without the problems mentioned earlier.

Also, I have seen in many programs the use of the memory location at 197 (decimal) to determine which key on the keyboard is being pressed. Although I see in my reference guide that this location holds the value of the key being pressed, that value does not correspond to either ASCII or screen display codes. I must assume that this is some sort of keyboard scan code, but I don't find a key to that anywhere in the reference guide. Can you outline this decoding for me?

John A. Schmitz

Jim Butterfield replies:

  1. The .S (Save) command in Supermon64 writes program tapes which may be loaded from BASIC. Some special considerations:
    1. Tape is written in a special "nonrelocatable" format, so that a simple LOAD "NAME" will return the program to the addresses from which it was saved. It is not necessary (but doesn't hurt) to say LOAD "NAME",1,1 since the tape format means that the program will never be relocated. By the way, this format tape may be read on VIC or 64, but not on PET/CBM.
    2. Commodore machines have a bug that makes it virtually impossible to write tape from addresses above 32766 (hex 7FFE). Supermon doesn't fix the bug, so you cannot write useful tapes from high addresses.
    3. If you have a BASIC program that contains a command to LOAD a machine language program, the load will take place correctly, but then the BASIC program will go back and start to execute from its first statement. This can give the impression that the computer is "locked up." The coding to get around this is quite easy:
      100 IF A = 1 GOTO 200
      110 A = 1
      120 LOAD "NAME"
      200 … continuing
  2. No. The computer looks at the "keyswitch" indicator (address 145) to see if you are holding down the key. In any case, the Commodore key doesn't ever go into the buffer; it's a type of shift key.
  3. Newer models of the Commodore 64 will automatically continue a Load after a pause of a few seconds. Only the early models wait forever for you to tap a key.
  4. Machine language can be "batched" together with BASIC so that both may be loaded in one shot. The most popular methods are:
    1. Placing machine language directly above the BASIC program. Programs constructed in this way handle as easily as simple BASIC programs: They can be loaded or saved easily with no special knowledge. But the BASIC program must not be changed once the whole thing has been put together.
    2. Placing machine language below BASIC. Programs constructed in this way must usually be loaded with LOAD "NAME",1,1 to avoid relocation problems. They are difficult to save, since the user must know the address at which the machine language program begins. An extra feature that can be implemented with this method: We can change some of the computer's "pointers" that lie below BASIC, and cause the machine to change its behavior. For example, pointers can be changed to make the computer "come up running."

Other questions:

Once you run Supermon, it will automatically relocate itself to the top of memory. You are free to return to BASIC and load new programs. Supermon may be recalled with SYS 8.

The value in 197 on VIC and 64 indicates the key being pressed as part of a keyboard x-y grid. Any value less than 64 indicates a key: 64 is no key.

It's probably best to use PEEK(197) together with the GET command. GET tells you which key; 197 tells you if it is still being held down.