Commodore C64 Emulation


Back to course web page

Software

To run the following on your machine, you need the following: Install VICE on your machine. This differs a bit between Windows, Mac, and Linux. You should be able to start a program called "c64" (or similar).

SMON is provided in form of a virtual floppy disk. You have to load this floppy disk via the menu "File / Attach disk image / Unit #8". After that, you can load "S-MON" by typing:

and start it with This loads the program directly into memory starting at memory address (hex) C000.

Using SMON

SMON is an assembler and disassembler for the Commodore C64. It allows you to directly access and inspect the memory, and write your own 6502 assembly code programs.

The monitor uses the hexadecimal number system for all memory addresses and values.

A: Assemble

Syntax: A START
Example: A 4000
Start writing an assembly code program at memory position 4000.

After pressing ENTER, the selected address is displayed on the screen with a blinking cursor. You can enter the commands the way the disassbler shows them, e.g., "LDY #00" or "LDA 400E, Y". Pressing ENTER concludes the writing of a program line.

In case of a faulty entry, the cursor jumps back to the beginning of the line. You have to enter the command again.

If you have to specify a jump or branch forward, you can use a "marker" to label the target destination, and define the marker at a later memory location. Valid markers are M01 to M30, where the number is hexadecimal.

Example:
BCC M01
NOP
M01 LDY #01

"F" ends the program entry.

If you just want to enter a data byte, specify this with a dot, e.g., ".FF".

D: Disassemble

Syntax: D START, END
Example: D 4000, 4020
Show the contents from memory address 4000 to 4020 in assembly code.

You do not have to specify an end address. SPACE shows the next command, RETURN continuously produces additional lines until another key is pressed. ESC ends the disassembler.

G: Go

Syntax: G
Example: G 4006
Start a program at address 4006

The machine code program runs until it reaches a BRK command.

M: Memory Dump

Syntax: M START, END
Example: M 4000, 4020
Shows the hex bytes from memory address 4000 to 4020.

Interaction is the same as for disassemble.

R: Register Dump

Syntax: R

Shows the current value of the most important registers: program counter, status register, accumulator, X register, Y register, stack pointer, and the flags.

X: Exit

More documentation in German