|Developer||N. Mann, Dietrich Weineck|
|Publisher||Markt & Technik|
|Platform||C64, C128, VIC-20|
|Genre||Machine Code Monitor|
|Information||64'er issue 02/1985|
SMON is a machine code monitor for assembling and disassembling, which was firstly published as listing in the German computer magazine 64'er in 1984/85. Later SMON was republished in several publications of magazines like the special issues of 64'er from publisher Markt & Technik. Also an assembler course was published in the 64'er magazine: "Assembler ist keine Alchemie".
- The monitor screen
The 4 Kbyte large, easy and simple assembler SMON is started by the command
SYS 49152 (for versions at $C000). The startup screen switches its frame and border color in complete blue and the following lines appear:
PC SR AC XR YR SP NV-BDIZC ;C000 B0 C2 00 00 EE 10110000
The first line names the CPU registers and the second shows their current content.
The abbreviations in the register line means:
- PC: Program Counter; memory address of the next assembler command
- SR: Content of Status Register
- AC: Content of ACcumulator
- XR: Content of X-index Register
- YR: Content of Y-index Register
- SP: Content of Stack Pointer
- NV-BDIZC: Content of the flags NV-BDIZC in binary coding (0: not set / 1: set)
All numbers are shown and will be taken hexadecimal!
The flags are (from high to low):
Bits: 76543210 Flags: NV-BDIZC
- Bit 7: N (negative flag) - used by mathematical operations with values greater than $7F (127), corresponds to bit 7, the sign bit
- Bit 6: V overflow flag) - signals an overflow of a signed arithmetic operation (with two's complement values)
- Bit 5: - (not used)
- Bit 4: B (break flag) - indicates an interrupt caused by a BRK command
- Bit 3: D (decimal mode flag) - if set mathematical operations will be calculated decimal mode
- Bit 2: I (interrupt disable flag) - used by IRQs
- Bit 1: Z (zero flag) - set if a result value is 0
- Bit 0: C (carry flag) - is set appropriate on mathematical operations if values would leave the $00 - $FF (0 - 255) range or used for logical operations (shifting and rotating)
Read more in the C64-Wiki article Processor Status Register.
SMON supports the following commands:
- A xxxx - Assemble
Assemble Code starting at xxxx. It is possible to use markers (a simple form of symbolic labels) in the form Mxx. A single X ends the assembly.
- B xxxx yyyy - BASIC Data
Create BASIC Data lines for the memory contents from xxxx to yyyy. Note: Line-numbers start with 32000 (defined in ($C087/$C088). The maximal length of a created BASIC line is usually 80 character (the maximal length that can be edited with the C64 BASIC editor). If you want shorter lines (e.g. 72 characters, that are usually the limit for emails and news-postings) set $C9AE to the desired length -7 (e.g. 65 for 72 characters).
- C xxxx yyyy zzzz aaaa bbbb - Convert Program
The memory block from xxxx to yyyy is moved to zzzz. All absolute addresses in the code between aaaa and bbbb that pointed into the moved range are adjusted.
- D xxxx (yyyy) - Disassemble
Disassemble the program starting at xxxx (and ending at yyyy). Changes to the code are possible by overwriting the opcodes.
- F aa bb cc ..., xxxx yyyy - Find Byte
Find all occurrences of the the Byte sequence aa bb cc ... in the memory range xxxx to yyyy. It is possible to specify some nibbles of the search pattern as don't-care by using the wildcard '*'. Note: Unlike most other SMON commands the Find commands are very picky about their syntax. There must be no space between the command name and the arguments given (exception: the Find Byte command requires exactly one space), and a comma before the range.
- FAaaaa, xxxx yyyy - Find absolute Address
Find all references to the absolute address aaaa within the memory range xxxx to yyyy. Note that there is no space between FA and aaaa.
- FRaaaa, xxxx yyyy - Find Relative
Find branch statements that points to address aaaa within the memory range xxxx to yyyy. Note that there is no space between FR and aaaa.
- FTxxxx yyyy - Find Table
Find all tables in the memory range xxxx to yyyy. SMON defines a table as any information, that can not be disassembled.
- FZaa, xxxx yyyy - Find Zero-Page
Find all references to the zero-page address aa within the memory range xxxx to yyyy. Note that there is no space between FZ and aa.
- FIaa, xxxx yyyy - Find Immediate
Find all statements in the memory range from xxxx to yyyy, that use aa as immediate operand. Note that there is no space between FI and aa.
- G (xxxx) - Go
- I xx - I/O Device
Select the I/O device for Load and Save. Common values for xx are 01 for tape or 08 to 0B for floppy devices.
- K xxxx (yyyy) - Checking (in German
Display the memory contents from xxxx to yyyy as ASCII characters. Changes are possible by overwriting the characters.
- L "filename" (xxxx) - Load
Load a file from the standard I/O device (see command I - I/O Device) at the standard address or xxxx.
- M xxxx (yyyy) - Memory Dump
Display the memory contents from xxxx to yyyy as hex values and ASCII characters. Changes are possible by overwriting the given hex values.
- O xxxx yyyy zz - Occupy
Fill the memory range xxxx to yyyy with the value zz.
- P xx - Printer
Select the device number for the printer. Valid values for xx are 04 and 05. To send the output of a command to the printer, the mnemonic for that command has to be written in upper case.
- R - Register
Display the contents of the CPU registers. Changes are possible by overwriting the values.
- S ("filename" xxxx yyyy) - Save
Save the memory contents from xxxx to yyyy to a file. If the file has been loaded using the command L then the parameters for save are optional.
- TW (xxxx) - Trace Walk
Execute the code at xxxx (or current PC) in single-step mode. After every executed command, the contents of the registers is displayed and the system is halted until a key is pressed. Subroutines can be executed in real time by pressing 'J'.
- TB xxxx yy - Trace Break
A break-point is set at address xxxx. When the code is later executed with Trace Quick (see below) the execution will be switched to single-step mode when the break-point is reached for the (yy+1)th time.
- TQ (xxxx) - Trace Quick
Execute the code at xxxx (or current PC if omitted) in real time. When a break-point is encountered the execution is switched to single-step mode (see TW - Trace Walk).
- TS xxxx (yyyy) - Trace Stop
Executes the code at xxxx in real time. Execution stops as soon the program reaches yyyy (works only in RAM!).
- V xxxx yyyy zzzz aaaa bbbb - moVe addresses
All references to absolute addresses in the code between from aaaa and bbbb which are pointing into the range xxxx to yyyy are adjusted to the range starting at zzzz.
- W xxxx yyyy zzzz - Write
Copy the memory contents between xxxx and yyyy to zzzz. No address or other transformations are performed. Works correctly even if source and destination range overlap.
- = xxxx yyyy - Check Equality
The memory ranges starting at xxxx and yyyy are compared for equality. The address of the first different byte is displayed.
- X - Exit SMON
Also changes back to the normal C64 colors. Entering SMON again is possible with the proper SYS command (e.g.
SYS 49152 for a version at $C000 ).
- # num - Convert Decimal
The decimal number num is converted to hexadecimal notation. If num is a 8 bit number, than the binary form is also displayed.
- $ xxxx - Convert Hexadecimal
The hexadecimal number xxxx is converted to decimal notation. If xxxx is a 8 bit number, than the binary form is also displayed.
- % xxxxxxxx - Convert Binary
The (8 Bit!) binary number xxxxxxxx is converted to decimal and hexadecimal notation.
- ? xxxx + yyyy - Hexadecimal Addition or Subtraction
Two 16 bit hexadecimal numbers are added or subtracted.
Disk Monitor Mode
- Z - Start the disk monitor (equivalent command H) - screen border changes to color yellow.
SMON features a built in disk monitor for floppy disk #8. To avoid confusion in terms of command names, the disk monitor must be explicitly started and terminated. While SMON is in disk monitor mode, only the following commands are available.
Note: It is not possible to examine a device other than a floppy disk (i.e. not a folder of a Mac hard disk or a tape) mounted on drive #8.
- R (tt ss) - Read Sector
Read track tt sector ss into memory. If tt and ss are missing the next logical (not physical!) sector is read.
- W (tt ss) - Write Sector
Write track tt sector ss to disk. If tt and ss are missing the parameters from the last Read Sector command are used.
- M - Memory Dump
Display the disk sector in memory on the screen. The shift keys can be used to interrupt/continue the display process.
- @ - Floppy Error Status
Displays the current floppy error message. If no error occurred, than no message is printed, i.e. the message 00, OK,00,00 is suppressed.
- X - Exit the disk monitor, back to SMON's normal mode - screen border color changes to blue again.
- SMON download at cbmhardware.de
- 64'er Sonderheft 35, S. 132 ff. 64'er special issue No 35
- German Documentation of SMON at infinite-loop.at