BBC Micro Disassembler  
     

This script attempts to disassemble a file of BBC micro machine code. It uses one support file which specifies the valid op-codes. These are specified as the op-code mnemonic followed by a list of possible codes according to addressing mode (the position on the line corresponding to the position of the addressing mode in the modes array in the script).

You will need to edit the script to specify the location where you put the op-code list.

The options accepted by the script are:

-f file
Specify the file of BBC machine code to disassemble.
-s file
Specify a "skip" file (see below).
-o address
Specify the address to start disassembly from. The default is the first address of the file (or the service routine if this is a ROM).
-a address
Specify the address of the first byte in the file. The default is 0x0000 (or 0x8000 if this is a ROM).
-r
The file is a ROM and the header will be decoded and printed and disassembly will commence at the service routine unless otherwise specified.
-l
Disassemble from the language routine if this is a ROM.

Disassembly will continue until the end of the file. All 65C02 op-codes are supported including undocumented ones.

Obviously, this method will not disassemble code with data in the middle correctly, so you can use a "skip" file to help the disassembler. You then need to work through cycles of disassembly, perusing the output, regenerating the skip file, etc until everything you need is decoded.

Skip File

A "skip" file helps the disassembler by restricting which sections of the file to look at. Lines in the "skip" file can be one of the following with all addresses in hex:
l:<address>:<label>
Specify a label to use for an address to make the purpose of sections of the code more obvious. The script knows about the standard OS calls and will use appropriate labels for those. Labels will be used for JMP, JSR and branch instructions.
i:<addr range>
The address range must be either a single address or a hyphenated pair. All bytes in the range will be ignored and a placeholder will be output to show where the missing bytes are and their address range.
d:<addr range>
The bytes are data bytes. If they are printable, then the character will be displayed, otherwise the hex code is displayed.
D:<addr range>
Like "d" above, but the bytes are raw data and printable characters are printed as their hex code.
All other lines in the file are ignored.

The script will produce a list on STDERR of undocumented op-codes encountered and also jump/branch destinations which the disassembler did not see (and, hence, are possible locations to search next for code).

See the sample ROM pages for examples of "skip" files and their use.


  BBC Micro Disassembler