![]() |
Return to index |
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.
java uk101.utils.PrintCode [options] bytesfile [address]
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
$
or0x
characters.
-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
java uk101.utils.PrintBytes [options] bytesfile [address]
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
$
or0x
characters.
-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 ."...%.]
java uk101.utils.PrintDump [options] dumpfile
dumpfile
- The name of a simulator memory dump file.
-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.
java uk101.utils.PrintTrace [options] tracefile
tracefile
- The name of a simulator instruction trace file.
-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.
java uk101.utils.TapeRead [options] inputtape [outputfile]
inputtape
- The name of a binary UK101 decoded cassette tape file or the name of a Kansas City Standard encoded audio WAV file.
outputfile
- The name of an output file. Defaults to standard out.
-binary
- Input tape is to be processed as a binary file. This is not normally required as the system will automatically detect the type of input.
-baudRate baud_rate
- The baud rate of an audio file. Supported baud rates are 300, 600 or 1200; this defaults to the standard 300 baud.
This program will take a decoded binary cassette tape file or a Kansas City Standard encoded audio WAV file and print or save it in a standard ASCII character format for ease of viewing or editing on the PC.
See tape formats for details on the differences between the binary, audio and ASCII forms of program tapes.
java uk101.utils.TapeWrite [options] inputfile outputtape
inputfile
- The name of an ASCII or binary file representation of a decoded cassette tape.
outputtape
- The name of a binary or Kansas City Standard audio WAV output file.
-audio
- Write an audio WAV file as output. The default is to write a binary file.
-sampleRate sample_rate
- The audio sample rate if writing a WAV file. Values can be between 8000 and 96000, including the CD standard 44100. The default is high quality 48000Hz.
-sampleSize sample_size
- The audio sample size if writing a WAV file. Values can be 8 or 16. The default is high quality 16-bit samples
-baudRate baud_rate
- The baud rate if writing a WAV file. Supported baud rates are 300, 600 or 1200; this defaults to the standard 300 baud.
-leadIn lead_in
- The number of seconds of lead-in tone if writing a WAV file. Default value is 5 seconds.
-leadOut lead_out
- The number of seconds of lead-out tone if writing a WAV file. Default value is the same as the lead-in.
-inputRate input_baud_rate
- The baud rate of the inputfile if it is audio encoded and if it differs from the output baud rate.
-sineWave
- Generate audio files using pure sine waves rather than the system hardware wave shape.
This program will take an ASCII, binary or audio representation of a decoded cassette tape and write it in the original binary format or in Kansas City Standard audio WAV format.
See tape formats for details on the differences between the binary, audio and ASCII forms of program tapes.
Note: this program can take an audio format tape as input and can rewrite the tape in a different audio baud rate or quality level if required.
java uk101.utils.TapePlay [options] inputfile
inputfile
- The name of an ASCII, binary or audio tape file.
-binary
- Input tape is to be processed as a binary file. This is not normally required as the system will automatically detect the type of input.
-sampleRate sample_rate
- The audio sample rate for playback. Values can be between 8000 and 96000, including the CD standard 44100. The default is high quality 48000Hz.
-sampleSize sample_size
- The audio sample size for playback. Values can be 8 or 16. The default is high quality 16-bit samples
-baudRate baud_rate
- The baud rate for playback. Supported baud rates are 300, 600 or 1200; this defaults to the standard 300 baud.
-leadIn lead_in
- The number of seconds of lead-in tone for playback. Default value is 5 seconds.
-leadOut lead_out
- The number of seconds of lead-out tone for playback. Default value is the same as the lead-in.
-inputRate input_baud_rate
- The baud rate of the inputfile if it is audio encoded and if it differs from the output baud rate.
-sineWave
- Generate sound using pure sine waves rather than the system hardware wave shape.
This program will take an ASCII, binary or audio tape file and play it in Kansas City Standard audio format to the system sound device. This might be useful if you wanted to connect the PC's audio output to a real cassette player or real UK101 machine.
Note: this program can be used to play audio format files but it is not a general media player - it works by decoding the input tape and recoding it for output. Different output audio baud rate or quality settings can be used for playback if required.
Tim Baldwin May 2015 tjb101@tinymail.co.uk |
Return to index
© Tim Baldwin 2010,2015 |