Machine Code Monitor

From C64-Wiki
(Redirected from machine language monitor)
Jump to navigationJump to search
Disambiguation The title of this article is ambiguous. Monitor (Disambiguation).
A screenshot of the TEDMON machine code monitor of the C128[1]

A machine code monitor (aka machine language monitor or computer code monitor, short monitor) is a software program that allows a user to observe the status of a computer from a low-level language perspective. In addition to monitoring, users are able to manipulate memory locations using machine code commands, as well as load/save data from/to a secondary storage device. Some Commodore computers (C128, C16, C116, Plus/4) have built-in machine code monitors, while others (VIC-20, C64) require additional programs.

History[edit | edit source]

Early computers could only use line-printers to display the status of a computer. Later, when the computer monitor became a viable option for dynamically displaying the status of a computer, software was used to allow the user to monitor this status. Machine code monitors therefore became very popular from the start of the home computer era of the 1970s. Some of these machine code monitors were available as firmware, some as third-party hardware and some as software. The first machine code monitors had no symbolic assembly language capability, and all translation between machine code and assembly language was achieved by the programmer. Even once multi-feature assemblers became more readily available, a machine code monitor remained indispensable for debugging programs. The general decline of assembly language software written from scratch has made the use of a machine code monitor somewhat of a lost art. Nevertheless, the use of machine code monitors persists; especially in the area of hobby-built computers.

Technique[edit | edit source]

Long data strings of numbers and letters could be difficult to visualise as a program and inevitably some debugging would be required. A common technique when writing machine code programs was to set a halt in the machine code program. Generally this was using the break instruction 00 (which was later represented as BRK in three-letter mnemonic assembly language). When the CPU encountered this breakpoint, the program would be interrupted and control would be transferred to the machine code monitor. Typically this would trigger a register dump and then the monitor would await programmer input. Activities at this point might include examining memory contents, changing code and/or perhaps altering the processor registers prior to restarting the program.

Features[edit | edit source]

General Features[edit | edit source]

  • View and change CPU status (such as registers and flags).
  • Program run at a desired address.
  • View and modify memory areas, typically in different formats (such as hex dump, PETSCII, and Sprite data)
  • Save/Load into a memory area to/from a secondary storage device.
  • Value/pattern/string fill.
  • Value/pattern/string search.

Advanced Features[edit | edit source]

  • Disassemble/assemble.
  • Set breakpoints.
  • Tracing/Single Stepping.
  • Search using address ranges.
  • Number conversions.
  • Calculation of arithmetic and logical expressions.
  • Moving memory areas.
  • Moving machine code with adjustment of the absolute references.
  • Insert/delete machine code instructions in existing program with adjustment of the absolute references.
  • Input/output functions for printers/mass storage/floppy disk drive.
  • Repair BASIC vectors or BASIC programs.
  • Sprite functions.

Limitations[edit | edit source]

Graphics Modes[edit | edit source]

Monitors need to run in text mode and not in a GUI. Although this does not matter for an emulated environment, on original hardware the memory use is so restrictive that the most basic display mode of the CPU is required.

Debugging[edit | edit source]

This can be problematic when programs use custom timing routines. Notably, the debugging of grid line interrupt programming or fast loader routines is almost impossible due to timing confusion.

Commodore Specific Monitors[edit | edit source]

Name Type Size Command Source Remarks
Supermon64 Software re-load <4KB SYS 49152 (for version at $C000) Jim Butterfield, Compute! Magazine, January 1983, Issue 32, Page 162
Supermon+64 Software pre-load <3KB RUN (originally)
SYS 8 (later)
Jim Butterfield, Transactor, Volume 6, Issue 4, Disk 9 - Compatible with TEDMON
- Sits below $A000
RAT MON 64 Software re-load 4KB SYS 49152 (for version at $C000) CHIP Magazine, January 1984
SMON Software re-load 4KB SYS 49152 (for version at $C000) 64er Magazine, February 1985
MADS Monitor Software re-load 4KB SYS 32768 (for version at $8000)
SYS 49152 (for version at $C000)
Commodore, 1982 part of the Macro Assembler Development System
MLM64 Plus Software re-load 4KB SYS 49152 (for version at $C000) INPUT 64 Magazine, March 1985
MON-64 Software re-load 1KB SYS 49187 (for version at $C000) MC Magazine, October 1983 TIM clone
TEDMON ROM MONITOR Commodore BASIC 3.5, BASIC 7.0
TIM ROM re-load 1KB SYS xxxxx Commodore SYS call depends upon model
Final Cartridge 3 Plug-in module MON or F2  RISKA B.V. Home & Personal Computers
Action Replay Plug-in module MON or F8  Datel Electronics
Help Plug-in module re-load ]  and RETURN 
Help Plus Plug-in module re-load ]  and RETURN 
EMON Plug-in module re-load 4KB SYS 49152 (for version at $C000) Print Technik
SpeedDOS EPROM F2  Elektronik Service
SpeedDOS plus EPROM F2  Elektronik Service
VICE Emulator Alt  and M  or
Alt  and H 
GNU General Public License PC-based software

Links[edit | edit source]

References[edit | edit source]

  1. The built-in machine code monitor, accessed 28 October 2014.