XBUG is a firmware package containing cassette file handling routines, plus a
line-by-line assembler (translator) and disassembler. The monitor TANBUG is
directly linked to this package so that these facuities can be accessed directly
via monitor commands. XBUG is supplied as a single 2 kilobyte 2716 EPROM.
Installation is simple - merely plug the XBUG EPROM into socket G2 on TANEX,
then cut LK1 on TANEX, and XBUG becomes part of the system monitor. The
cassette handler and disassembler can be run from the hexadecimal keypad,
however a full ASCII keyboard is required to run the line-by-Iine assembler.
Two tape speeds are available, a 300 baud CUTS format, and an (approximate) 2400 baud format. The redundant information in the CUTS format is used to reduce the occurrence of tape errors should tape dropouts occur, and this format therefore gives more data protection. In general, use the CUTS rate if you are using low quality tape or cassette recorder, or of course if you are transferring data from another type of machine. Otherwise use the FAST rate.
The speed is selected by two TANBUG commands: F < CR > selects
SETTING UP THE CASSETTE RECORDER LEVELS
The following programs enable you to set up the recording levels for the two
tape formats (they may be different for each). Automatic level recorders should
also be checked to see that no errors are present.
100 A941 LDA #$41
106 2027FO $FO27
IOA 48 PH@ S C-(
k IOB 2066FO $Fk
110 6900 ADC #$O
112 4COA01 JMP $IOA -
b) Set CUTS speed: C<CR>.
c) Start the recorder in record mode.
d) Start the program by typing GlOO<CR>. Allow the recorder
Now repeat the procedure for fast speed.
To check the data:-
· Key-in the following verification program.
115 2000FO JSR $FOOO
1 18 AOOO LDY #$O
48 @A !6- C- fs
6 Clki As %&
11B 20CBFO-- JSR $FOCB
b) Rewind the tape to the start.
c) Start the tape running.
d) Type G115<CR> to start the program.
The "D" command is used to dump an area of memory to tape. Its format it:
D<start address>,<end address>,<filename>
The filename nay be up to 8 characters long. Characters within it may be A-Z, 0-9, . or
To dump a program onto tape proceed as follows:
The VDU will respond with the filename being dumped, with an added appendix
of A to distinguish this file as being an absolute file.
· instruction dumped locations 400 to 410 inclusive, and called
· file FILE1.
A question mark error will be generated if the command format is illegal, if
the filename contains an illegal character, or if it is more than 8 characters
To examine a tape:
a) Position the cassette on a piece of blank tape (i.e. a section with no
recorded signal) somewhere before the file to be examined.
The VDU responds with the filename.
M(n) - memory error - contents of tape do not agree with
(n) is the faulty location
P(n) - a parity error occurred when reading the data associated with location (n).
C (n) - a checksum error occurred at the end of the file - (n) indicates the file end address.
contents of memory.
examine FILE2, but position the tape at the blank leader.
Or, with one memory error:
Location 0410 is at fault.
The "E" command may be used to obtain a complete listing of the tape
contents, by rewinding the tape to the start and looking for a non-existent
filename. Note that in this case it is necesssary to exit back to TANBUG at the
tape end by using the RESET key since interrupts are disabled in the cassette
software. This procedure may also be necessary if the examine procedure gets
very badly out of step due to a large number of errors.
FETCHING A FILE INTO MEMORY
To fetch (load) a file into memory, the "F" command is used as follows
For example, typing F,FILE1<CR> looks for FILE2 -A and loads it into memory. Operating procedures and errors are exactly as detailed in the section on the examine command. Should an "M" error occur, a hardware fault is indicated because the program loads the input data to the memory location and checks it immediately afterwards.
Do not mix tape speeds on a single cassette, otherwise filename errors will occur. Though this does not affect the operation of the search, it is not Dossible to list a filename directory with a single pass.
If one program uses several different areas of memory (e.g. one area for subroutines and another for main code) it is necessary either to dump the whole area in one file, thus encompassing some redundant locations, or to dump in two files.
'when fetching, memory location (n) failed to be updated with the I value read in (hardware error).
P (n) a parity error occurred when reading the byte for location (n).
C (n) a checksum error occurred during the tape read,
READING CASSETTES DUMPED BY RAM-BASED CASSETTE SOFTWARE
XBUG software will not read files dumped by the RAM-based program described
in the TANEX manual. However, you may recover these and dump them in the new
absolute format by following the procedure below:
The translator program allows you to enter programs in 6502 mnemonic assembly
language. The translator verifies that the
To enter the translator, type "T", followed by the address at which
Type T400<CR> ; the di-splay will then be as follows:
T400 0400 DD
To enter code to be translated, type in the instruction followed by carriage return. If the instruction is legal, it is translated,
the machine code equivalent displayed, and the program counter updated. If
it is illegal a "?" is displayed, and the program
On the completed line, the display format is:
(Program counter) (Opcode) (Mnemonic) (ASCII equivalent of opcode)
This time, the entered instruction was a multiple byte instruction, so three
bytes of machine code were generated, three byt es of ASCII equivalents printed,
and the users program counter incremented by 3. Note that the translator does
not allow labels to be used - all addresses must be entered as absolute values.
A complete list of 6502 instructions and the modes in which they are legal
appears in the Mictotan 65 manual on pages 5-9 to
Immediate #$HH or #'A
Absolute $HHHH or 'A
(Indirect) ($HHHH) or ('A)
Examples of legal instructions:
LSR A ;shift acc left
Exampler, of illegal instructions:
LSR BB ;no $ before Hex opcode
Relative mode instructions (that is, branches) must always contain a
hexadecimal address as their argument. If the branch is within range, the
correct offset is calculated and entered in memory,
An error (?) is displayed if any of the following circumstances
Illegal instruct4.on/operand format.
Branch out of rance.
0410 AA $AA
0411 41 tA
An error print will occur if the format is illegal.
0412 DD ;THIS IS A COMMENT
Comments are not allowed on the same line as instruction/opcode entry.
The * = command allows you to set the program counter to any
0412 DD *=$500 0500 FF
The (up-arrow) single key command decrements the program counter by I each time it is depressed. If you have made a mistake and wish to correct it, you can easily step back to the required location.
The LF (line feed) single key command increments the program counter by 1 each time it is depressed. For example, suppose the following code has been entered:
0410 A9FF LDA #$FF
and you wish to change the LDA #$FF instruction to AND #$FE, hit the t key 4 times, XBUG will display:
0410 A9FF LDA #$FF
Now type in the new instruction and XBUG will display:
Now hit LF twice to increment the program counter back to 2 : 5
The following program runs through the ASCII character set, displaying each character on the screen, and resides at memory location 0400. First, enter the translator by typing T400<CR> Enter the following lines of code:
The complete program with its addresses and assembled code is now displayed
on the screen. Exit from the translator by typing ESC. Start the program by
typing G400<CR>. The ASCII character set will now gradually be built up on the
The instruction dis-assembler performs the converse function to that performed by the translator, that is it reads machine code locations stored in memory and displays them as mnemonic instructions and opcodes.
To enter the Instruction Dis-assembler, type:
I< ADDRESS>< CR>
For example, 1400<CR> dis-assembles the program given as an example in chapter 2. When the VDU screen is full, the disassembler gives you a ! prompt. You may respond to this with either < CR> , < LF > or < ESC > . Escape exits from XBUG and returns to TANBUG. Carriage return displays the next VDU page of data and pauses with a prompt at the end. Line feed displays the next VDU page of data and inhibits the pause at the end of the page, so the dis-assembler continues to operate until the BREAK or RESET key is depressed.
There are some circumstances where the dis-assembler encounters stored numbers not corresponding to a leoal opcode, for example in RAM which contains random data generated on power-up, where programs contain data tables, or where the dis-assembler has been instructed to begin from the operand part of an instruction rather than the opcode part. In this case a single byte is printed, followed by a ? to indicate an illegal opcode. Sometimes, data bytes may be translated as legal opcodes, thus disassembling the first few bytes of a program incorrectly. For example, the example program previously discussed dis-assembles satisfactorily if the command 1400 is used. However, if 1401 is used, the data at location 401 is treated as an opcode. Because this is in fact the opcode for ORA, the program dis-assembles as:
0401 OD4820 ORA $2048
Thus location 406 is reached before the dis-assembler gets in step