UK101
Return to index

Additional Function

Since this is a simulation of an UK101, not a real computer, it is possible to provide some additional useful function, that can help show the working of the computer and help with programming and debugging.

The following extra function is provided:


Debug Functions

The simulator is able to produce a memory dump and an instruction trace.

Memory Dump

The memory dump is a snapshot image containing the complete system RAM.

Memory dumps can be produced using the special control code instructions (from within a running program), by pressing the Dump button on the machine control display window.

Memory dump files are named something like uk101‑yyyyMMdd‑HHmmss‑SSS.ram and are in an internal and compressed format. The files can be formatted using the dump file formatter utility.

Instruction Trace

The instruction trace contains a log of the instructions executed by the CPU together with the CPU registers and status values.

Instruction trace can be enabled and disabled using the special control code instructions (from within a running program), by selecting the Trace setting on the machine control display window.

Instruction trace files are named something like uk101‑yyyyMMdd‑HHmmss‑SSS.trace and are in an internal and compressed format. The files can be formatted using the instruction trace formatter utility.

Note: instructions traces can be large, especially if you end up tracing a tight spin-loop!


Additional Opcodes

The original 6502 processor defined and documented 151 opcodes out of the possible 256. Of the 105 undocumented opcodes some did perform well known and occasionally useful function, but some would cause the processor to lock up. I have made use of some of these unused opcodes to provide some additional processor function inside the simulator. I have only used opcodes from the range that would cause the processor to lock up as these should not appear in any useful program.

Simulator Control Codes

The following additional instruction opcodes can be used:

02Halt This will cause the CPU processing thread to wait in an operating system friendly manner. The CPU can be restarted by a Reset or by an interrupt (either an NMI or an IRQ). The UK101 does not use interrupts but they can be generated by using the debug options on the machine control panel.
22 nnDebug Performs a debug function based on the value of the operand byte nn.
FFDump Produce a memory dump.
01Trace on Enable instruction trace.
02Trace off Disable instruction trace.
Being able to enable and disable instruction tracing programmatically is very useful to help limit the size of instruction traces.

Tim Baldwin
December 2010
tjb101@tinymail.co.uk
Return to index

© Tim Baldwin 2010