VIC, 64, And PET Supermon
Questions And Answers
Jim Butterfield, Associate Editor
Questions And Answers
Jim Butterfield, Associate Editor
Several questions are frequently asked about Supermon, the machine language monitor program published in various versions for Commodore computers in past COMPUTE! issues. Some are general, but a number of these questions refer specifically to Supermon64 (COMPUTE!, January 1983).
Q How does Supermon compare to other monitor systems: say, VICmon, Extramon, Micromon, etc. ?
A Many of the other monitor packages are more powerful than Supermon, having extra commands. Supermon is particularly good for beginners, because:
- it self-relocates, making it easy to load into various configurations of machines;
- it doesn't alter normal interrupt sequences (except, to a limited extent, where Single Step is implemented).
Q Where does Supermon fit into memory?
A The program called Supermon on disk or tape is not Supermon itself: it's a building program which constructs the "live" Supermon at top-of-memory.
When you load Supermon, you load the building program into the same area normally occupied by BASIC. When you say RUN, an operating version of Supermon is constructed and sealed off so that it won't be disturbed. This version of Supermon normally stays put until you turn off the power.
If you return to BASIC (using the. X command), you should not go back to Supermon by saying RUN - that would build a second working copy of Supermon. In fact, it's best to say NEW the moment you return to BASIC to avoid the chance of this happening.
Q How do I get back to Supermon, then?
A On VIC and Commodore 64, type: SYS 8. On CBM/PET computers, except for original ROM units, type: SYS 4. On original ROM PETS, type SYS 1024.
Q If SYS 8 gets me to Supermon, does that mean that Supermon is located at address 8?
A No. At the appropriate address (8, 4, or 1024), you'll find a zero. Now, zero corresponds to the command BRK (Break). And with Supermon implanted, this command may be taken to read: "Go directly to Supermon. Do not pass GO."
Thus, the zero or Break command "finds" Supermon and takes you there. This is a handy feature. When you are writing a machine language program, you can end a piece of coding with BRK; when you run the program, it will stop at that point and go to the monitor.
Q I tried to disassemble Supermon, using its built-in disassembler, but it didn't look sensible. Am I missing something?
A Don't try to disassemble the "builder" version of Supermon-it's not a finished machine language program since it contains both program and "relocation" information. Look instead at the completed version. In a normal Commodore 64, for example, the finished Supermon will start at hexadecimal address 97ED. In other machines, it's usually easiest to find by looking at the BASIC top-of-memory pointer (hex 34 and 35 on PET/ CBM, hex 37 and 38 on VIC and 64). Supermon starts at the address indicated.
Don't forget that, like any other machine language program, Supermon contains both instructions and data, and you can't meaningfully disassemble data. It's especially difficult with things like mnemonics such as LDX where the three characters are packed into two bytes. For example, values 1C and D8 contain, in packed form, the three letters of the mnemonic BRK - if you can figure it out.
Q I don't like the screen colors of Supermon64. What can I do about them?
A Sorry about that. For lecturing purposes, I picked black and white so that students could see what I was typing and what the computer typed. It looks OK on my monitor, but several others have complained.
An easy way to improve visibility is to change the background color to grey. POKE 53281,12 produces a color combination that many users like. Try values other than 12 if this doesn't suit you.
If you want more control, you can go to where Supermon sets the colors and change the code as you like. You may find these locations with the Hunt command. Try searching the relocated Supermon for the color change to white with:
.H 97ED 9FFF A9 05 20 D2 FF
You should find one occurrence. Change the 05 (ASCII code for "white") to another color, or perhaps to 01 for no color change.
There are a lot more changes to black. Hunt for them with:
.H 97ED 9FFF A9 90 20 D2 FF
You'll find a dozen. You may change each 90 ("black") to the color of your choice or to no change. Each color change, by the way, is associated with a particular display function, so if you want memory displays in green and disassemblies in black, try various combinations.
To make permanent changes, you'll need to change the Supermon builder program. In this case, do your hunts in the BASIC area, e.g.,
.H 0800 11EA ....
Q Command .P doesn't send to the printer. Why?
A This command generates a format suitable for sending to the printer. You must hook in the printer with a BASIC command before calling in Supermon:
OPEN 4,4:CMD 4:SYS 8
(or SYS 4 as your system needs). The same technique can be used to send monitor output to disk. By the way, CBM BASIC 4.0 won't allow you to use SYS 4 if you want to hook in a printer or other output device: you must "Call" the monitor with SYS 54386 to keep the printer connected.
When you're finished with the printer, type .X to return to BASIC, and then:
Q I want to put Supermon somewhere else, not in the top of memory where it normally goes. How?
A Just change the top-of-memory pointer (decimal 52 and 53 in the PET, decimal 55 and 56 in the VIC or 64) to where you want the top-of-Supermon to go, and run the Supermon builder program. Then, if it's necessary, put the top-of-memory pointer back to wherever you want it.
Q Why don't you print an assembly listing of Supermon64 so we can see how it works?
A The uncommented listing runs for 16 pages. With comments and explanations, it would go at least 30 or 40 pages. That's a lot of space, and it's not clear that there is sufficient interest in this rather specialized program to make publication desirable.
Q When I do a .D disassembly, why does the cursor end up on the last line instead of on the line below?
A So that you can type D, Return, and get a continuation of the disassembly. If you don't want to continue, give a cursor down before your next command.
Q Supermon64 doesn't have single step. Right?
A Right. Things get delicate when a user wants to play with the interrupt facility. It seemed to me that the system would be cleaner without the .I command used in previous versions of Supermon.