UK101

Utility Applications

The simulator contains a number of utility programs that can be used for various off-line tasks.

To run any of these utility programs you must ensure the simulator JAR file is on the Java CLASSPATH.


Code Disassembler

Command

java uk101.utils.PrintCode [options] bytesfile [address]

Parameters

bytesfile
A file containing the code to be disassembled.
address
The code starting address. Defaults to 0. This can be provided in hexadecimal by preceding the digits with a $ or 0x characters.

Options

-output outputfile
A file to save the output. Defaults to standard out.

This command will disassemble a block of 6502 instruction code such as a ROM image. The starting address of the first instruction will need to be provided as there is no way to determine this from the 6502 bytes alone. Code is displayed in standard 6502 assembler format, for example:

FF96:  48         PHA
FF97:  A9 01      LDA #$01
FF99:  D0 F6      BNE $FF91
FF9B:  AD 12 02   LDA $0212
FF9E:  D0 19      BNE $FFB9
FFA0:  A9 FE      LDA #$FE
FFA2:  8D 00 DF   STA $DF00
FFA5:  2C 00 DF   BIT $DF00
FFA8:  70 0F      BVS $FFB9
FFAA:  A9 FB      LDA #$FB
FFAC:  8D 00 DF   STA $DF00
FFAF:  2C 00 DF   BIT $DF00
FFB2:  70 05      BVS $FFB9
FFB4:  A9 03      LDA #$03
FFB6:  4C 36 A6   JMP $A636
FFB9:  60         RTS

Data Display

Command

java uk101.utils.PrintBytes [options] bytesfile [address]

Parameters

bytesfile
A file containing the data to be displayed.
address
The data starting address. Defaults to 0. This can be provided in hexadecimal by preceding the digits with a $ or 0x characters.

Options

-output outputfile
A file to save the output. Defaults to standard out.

This command will print a formatted hexadecimal dump of a block of data such as ROM image. The starting address of the first data byte will need to be provided as there is no way to determine this from the data bytes alone. Data is printed in hexadecimal and as ASCII characters, for example:

FF30:  06 20 4E FF 4C 11 BD C9 57 D0 06 20 4E FF 4C 00  [. N.L...W.. N.L.]
FF40:  00 C9 4D D0 06 20 4E FF 4C 00 FE 4C 00 FF A9 0C  [..M.. N.L..L....]
FF50:  4C 57 FA 8A 48 BA BD 03 01 C9 A3 F0 05 68 AA 4C  [LW..H........h.L]
FF60:  EB FF A2 05 4C 7F FE 55 F9 7E F9 FF 48 AD 05 02  [....L..U.~..H...]
FF70:  F0 22 68 20 B1 FC C9 0D D0 1B 48 8A 48 A2 0A A9  [."h ......H.H...]
FF80:  00 20 B1 FC CA D0 FA 68 AA 68 60 48 CE 03 02 A9  [. .....h.h`H....]
FF90:  00 8D 05 02 68 60 48 A9 01 D0 F6 AD 12 02 D0 19  [....h`H.........]
FFA0:  A9 FE 8D 00 DF 2C 00 DF 70 0F A9 FB 8D 00 DF 2C  [.....,..p......,]
FFB0:  00 DF 70 05 A9 03 4C 36 A6 60 2C 03 02 10 19 A9  [..p...L6.`,.....]
FFC0:  FD 8D 00 DF A9 10 2C 00 DF F0 0A AD 00 F0 4A 90  [......,.......J.]
FFD0:  EE AD 01 F0 60 EE 03 02 AD 0F 02 F0 03 4C 00 FD  [....`........L..]
FFE0:  A9 50 8D 10 02 4C EA FC FF FF FF 6C 18 02 6C 1A  [.P...L.....l..l.]
FFF0:  02 6C 1C 02 6C 1E 02 6C 20 02 22 02 00 FF 25 02  [.l..l..l ."...%.]

Dump File Formatter

Command

java uk101.utils.PrintDump [options] dumpfile

Parameters

dumpfile
The name of a simulator memory dump file.

Options

-output outputfile
A file to save the output. Defaults to standard out.
-hex
Format the dump as hex bytes. This is the default format.
-code
Format the dump as disassembled code.

This will format and print the output of a simulator memory dump file. The memory dump files usually have a name like uk101‑yyyyMMdd‑HHmmss‑SSS.ram. The memory dump can be formatted either as disassembled instructions or as hexadecimal data display.

Memory dump files can be produced by using the special simulator control instruction, or by pressing the Dump button on the Machine view window.


Trace File Formatter

Command

java uk101.utils.PrintTrace [options] tracefile

Parameters

tracefile
The name of a simulator instruction trace file.

Options

-output outputfile
A file to save the output. Defaults to standard out.

This will format and print the output of a simulator instruction trace file. The instruction trace files usually have a name like uk101‑yyyyMMdd‑HHmmss‑SSS.trace

The output of the trace formatter will be something like this:

F9B3:  CA         DEX           ; A=00    X=2F Y=1C S=F5  P=nv-bdiZc
F9B4:  D0 F8      BNE $F9AE     ; A=00    X=2E Y=1C S=F5  P=nv-bdizc
F9AE:  20 E7 F9   JSR $F9E7     ; A=00    X=2E Y=1C S=F5  P=nv-bdizc  EA=F9E7
F9E7:  A9 01      LDA #$01      ; A=00    X=2E Y=1C S=F3  P=nv-bdizc
F9E9:  8D 00 DF   STA $DF00     ; A=01    X=2E Y=1C S=F3  P=nv-bdizc  EA=DF00
F9EC:  AD 00 DF   LDA $DF00     ; A=01    X=2E Y=1C S=F3  P=nv-bdizc  EA=DF00
F9EF:  49 FF      EOR #$FF      ; A=FF    X=2E Y=1C S=F3  P=Nv-bdizc
F9F1:  60         RTS           ; A=00    X=2E Y=1C S=F3  P=nv-bdiZc

This shows the address of each traced instruction followed by the bytes of that instruction and its disassembled form.

Following the instruction is the state of the various CPU registers and flags as they were before execution of the instruction. If the instruction addresses memory the effective address of the instruction operand is also given - this is the address after any indirection and indexing has been performed.

Trace files can be produced by using the special simulator control instructions, or by selecting the Trace action on the CPU view window.


Binary Tape Reader

Command

java uk101.utils.TapeRead [options] inputtape [outputfile]

Parameters

inputtape
The name of a binary UK101 decoded cassette tape input file.
outputfile
The name of an output file. Defaults to standard out.

Options

-encoding encoding_name
The output file encoding. Defaults to the standard platform encoding. This option is rarely needed.

This program will take a decoded cassette tape file and print or save it in a standard ASCII character format for ease of viewing or editing on the PC.

See binary and ASCII tape formats for details on the differences between the "binary" and ASCII form of program tapes.


Binary Tape Writer

Command

java uk101.utils.TapeWrite [options] inputfile outputtape

Parameters

inputfile
The name of an ASCII file representation of a decoded cassette tape.
outputtape
The name of a binary output file.

Options

-encoding encoding_name
The input file encoding. Defaults to the standard platform encoding. This option is rarely needed.

This program will take an ASCII representation of a decoded cassette tape and write it in the original binary format, possibly for loading back inot a real UK101 machine.

See binary and ASCII tape formats for details on the differences between the "binary" and ASCII form of program tapes.


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

© Tim Baldwin 2010