Classic Computer Magazine Archive COMPUTE! ISSUE 19 / DECEMBER 1981 / PAGE 134

A Primary Tool For Machine Language Programming

Here is the legendary Supermon—a version for Upgrade (3.0 or "New ROM") and 4.0 PETs, all keyboards, all memory sizes, 40 or 80 column screens. You need not know how to program in machine language (ML) to enter this program — or to use it. In fact, exploring with Supermon, you will find that the mysterious world of your computer's own language becomes gradually understandable. You will find yourself learning ML.

Many ML programmers with PET/CBM machines feel that Supermon is the essential tool for developing programs of short to medium length. All Upgrade and 4.0 machines have a "resident" monitor; a program within the computer's ROM which allows you to type SYS 1024 and see the registers, load and save and run ML programs, or see a memory dump (a list of numbers from the computer's memory cells.) But to program or analyze ML easily, disassembler, assembler, hunt, and single-step functions are all practical necessities. Supermon provides these and more.

Even if you've never assembled a single instruction and don't know NOP from ROL, this article will lead you step-by-step through the entry and SAVE of Supermon. And even if you do not plan to explore ML right now, you might consider putting this program into your library. If you ever decide to work a bit in ML, Supermon will prove invaluable.

How To Enter Supermon

  1. Type in the BASIC program (Program 1). It is the same for all versions. Then save it normally by typing SAVE "CONTROL". This program will be used later to automatically find your memory size, transfer Supermon to the top, and report to you the SYS address you use to activate it.
  2. Now the hard part: type SYS 1024 which enters you into the machine language monitor. You will see something like the following:

    Figure 1.

        PC      IRQ     SR   AC   XR   YR   SP
    .;  0401    E455    32   04   5E   00   EE

    Then type: M 0600 0648 and you will see something similar to (the numbers will be different, but we are going to type over them which, after hitting RETURN on each line, will enter the new numbers into the computer's memory.):

    Figure 2.

    .M 0600 0648
    .:  0600 28 58 FF FF 00 0B 06 AD
    .:  0608 FF FC 00 21 06 03 AD A9
    .: 0610 CB 85 1F A9 0C 85 20 A5
    .:  0618 34 85 21 A5 35 85 22 A0
    .:  0620 00 93 06 06 D0 16 20 38
    .:  0628 06 F0 11 85 23 20 38 06
    .: 0630 18 65 34 AA A5 23 65 35
    .:  0638 20 43 06 8A 20 43 06 20
    .:  0640 50 06 90 DB 60 EA EA A5
    .: 0648  1F D0 02 C6 20 C6 1F B1

    We have divided Supermon into 21 blocks with 80 hexadecimal numbers per block to make typing easier. There is a final, shorter block with 64 numbers. Type right over the numbers on the screen so that line 0600 looks like it does in Program 2. Then hit RETURN and cursor over to the A5 on line 0608. (Set a TAB to this position if your keyboard has a TAB key.) Then type over the numbers in this line and so on. When you have finished typing your RETURN on line 0648, type in: M 0650 0698 and the next block will appear for you to type over. Continue this way until you finish entering the new version of line 0CC8 at the end. (Hope that no lightning or fuses blow.)

  3. If you have Upgrade ROMs, you will need to correct the lines listed in Program 3 at this-point. To change line 06D0, simply type M 06D0 O6D0 and it will appear so that you can type over it and RETURN as in step 2.
  4. Now Supermon is in your memory and you must SAVE it. Hit RETURN so that you are on a new line and type: S "SUPERMON", 01,0600, 0CCC (to SAVE to tape) or type: S "0:SUPERMON",08,0600,0CCC (to SAVE to disk drive 0).
  5. Finally, you will want to use the Checksum program to see if you made any errors during the marathon. You probably did. but to make it as painless as possible, the Checksum program will flash through your Supermon let you know which blocks need to be corrected. So, type in Program 4 (or if you have Upgrade ROMS, use the first three lines from Program 5). SAVE Checksum just in case. Then LOAD "SUPERMON" (an ordinary LOAD as with a BASIC program will slide it in starting at address 1536, above the end of Checksum). Then RUN. Incorrect blocks will be announced. When you know where the errors are, type SYS 1024 and then M XXXX XXXX for the starting and ending addresses of the bad block. Check the numbers against Program 2 (or Program 3) and in all corrections. If, despite everything, you cannot find an error within a block, make sure that the corresponding number within the DATA statement of the Checksum program is correct. Then SAVE the good version "SUPERMON1" as in step 4. "SUPERMON1" as in step 4.
  6. Your reward is near. LOAD "CONTROL" and then LOAD SUPERMON1. Then type RUN and hold your breath. If all goes well, you should see:

    Figure 3.

          SINGLE STEP
    LINK TO MONITOR -- SYS 31283
    .S "SUPERMON" ,01, 7A33, 8000

And you should be able to use all the commands listed in the Supermon Summary. If some, or all, of the commands fail to function, check the last, short block of code to see if there are any errors.

After Supermon is relocated to the top of your memory, use a ML SAVE to save it in its final form. Instructions are on screen after RUN.