TEDMON

From C64-Wiki
Jump to navigationJump to search
TEDMON on a C128.

BASIC version BASIC 3.5 has an integrate machine code monitor called TEDMON, launched by the BASIC commands MONITOR or SYS 1024 or during Reset/power-on while pressing RUN/STOP .
TEDMON is embedded in the home computer systems C16/116, C128/D/DCR and Plus/4.

The monitor is also called using the BREAK vector if the CPU encounters the BRK opcode. This kind of entry will be shown in the register display preceded with line stating BREAK. This can be used on the one hand as an entry from BASIC via SYS command (to any address containing zero) or on the other hand for debugging purposes. The monitor does not provide any special commands for breakpoints or step-by-step code walk-through. This can be done manually by temporarily patching a BRK opcode to the appropriate code section.


Register Display[edit | edit source]

On entry of the monitor the following message is shown:

BASIC 3.5 (C16)
    PC SR AC XR YR SP
; 0004 30 00 00 00 F6
BASIC 7.0 (C128)
    PC  SR AC XR YR SP
; FB000 00 00 00 00 F8

The first line states the CPU registers and the second one shows their current contents which is also used if the execution continues with command "G".

The abbreviations in the register line have following meaning:

All values, numbers and addresses are shown and processed in hexadecimal notation.

Commands[edit | edit source]

TEDMON on the Plus/4.
TEDMON on the C128 (80 char mode).

The following commands can used:

  • A - Assemble a mnemonics line into machine code.
    • A <address> <command> [<operand>]
    • Numbers for operands need a preceding $ sign, on a C128 this may be omitted or a value with an appropriate numberbase could be given.
    • Exit with empty input (RETURN  only)
  • C - Compare two memory areas and display the difference.
    • C <start address> <end address> <start address for comparison>
  • D - Disassemble a machine code line into mnemonics.
    • D [<start address > [<end address>]]
  • F - Fill up a memory area with the given byte.
    • F <start address> <end address> <Byte>
  • G - Go to the memory address, also start a machine code program at the input memory address with the register contents shown by command R.
    • G <address>
  • H - Hunt a memory area - Search through a memory area for a certain value and show all memory locations found.
    • H <start address> <end address> (data are multiple hexadecimal numbers separated with empty spaces and strings separated with the apostrophe prefix ')
  • J - Only C128: Jump to subroutine - start a machine code program at the memory address. Similar to G, however when the processor hits an RTS, control returns to the monitor.
    • J <address>
  • L - Load a file from disk or datasette into the memory.
  • M - Memory is shown in hexadecimal numbers and values.
    • M [<start address> [<end address>]] (without an address the first 12 lines are shown)
  • R - Registers is shown again.
  • S - Save the input memory area into a file on disk or datasette.
    • S "<file iname>",<device number>,<start address>,<end address+1>
  • T - Transfer) or copy a memory area into another.
    • T <start address> <end address> <destination address>
  • V - Verify a saved file on disk or datasette with the memory area.
    • V "<file name>",<device number ($1-$F)>,<start address at C128>
  • X - eXit TEDMON into BASIC direct mode.
  • > - Modify up to eight bytes at a memory address (after M command).
    • > <address> <byte1> <byte2> ... <byte8>
  • . - Same as the A command.
  • ; - Change the register contents (after R command).
  • @ - Only C128: Displays the disk drive status or for using floppy commands.
    • @[device number ($8-$F)][,[ floppy command ]]
      Standard device number is 8.

TEDMON has no input prompt! Only a blinking cursor on the screen's leftmost column shows that the machine code monitor is ready for input.
If a wrong input is given (unknown command) a question mark (?) appears.

Number Base[edit | edit source]

The C128 version of TEDMON several numerical systems (number bases) can be selected by using the according prefix. Normally numbers are always in hexadecimal notation. Following prefixes exist:

Addresses[edit | edit source]

Usually four-digit addresses are used to cover the whole 64 KByte address range of the CPU.

On a C128 with up to 16 banks (see also BASIC 7.0 command BANK) of 64 KByte in size addresses could consist of hexadecimal 5 digits. The leading nibble designates the currently selected bank:

Bank Access to
0 RAM 0
1 RAM 1
2 RAM 2
3 RAM 3
4 INT ROM, RAM 0, I/O
5 INT ROM, RAM 1, I/O
6 INT ROM, RAM 2, I/O
7 INT ROM, RAM 3, I/O
8 EXT ROM, RAM 0, I/O
9 EXT ROM, RAM 1, I/O
A EXT ROM, RAM 2, I/O
B EXT ROM, RAM 3, I/O
C KERNAL + INT (lo), RAM 0, I/O
D KERNAL + EXT (lo), RAM 0, I/O
E KERNAL + BASIC, RAM 0, CHARROM
F KERNAL + BASIC, RAM 0, I/O