O^ǼǑ#99/4 D I S - A S S E M B L E R  $(C) Andy Cooper 1983,1984,1985 %  $121 Clearview Drive $Downingtown Pa 19335 $(215)269 0804 $ $CIS 71016,1743 $DELPHI ANDY4820 $  The disassembler consists of two code  files. The main or host file is  DISASMBLR.CODE and the auxillary or  library file is DISASMSUP.CODE. At run  TIME disasmsup.code must be linked with  disasmblr.code. For the P-System to find  disasmsup.code an entry in USERLIB.TEXT  on the root volume must exist.   This entry should be:  %:disasmsup.code   where can be a drive (eg #5)  or a volume name (eg sysdisk).   After creating or updating userlib.text  with the editor the disassembler can be  eXecuted from the main status line.    O U T P U T  -----------   The output can be directed to the screen  or to the printer. If the printer option  is chosen an additional selection is  offered.   N(ormal mode produces a full listing  with headings and page skips.   C(ompressed mode is similar to normal  however when dis-assembling 9900 code  the additional words of multi-word  instructions are not printed. This  reduces the listing about 25%.   In S(kip mode printing is similar to  normal however headings and page skips  are not performed. This is useful if  many small code segments are being  decoded (eg following program flow) as  humongous amounts of paper can be saved.    D A T A S O U R C E  ---------------------   The next menu allows you to select the  source of the data to be processed.   R(om will print or dis-assemble data  from console Rom, console Ram, expansion  Ram or DSR Rom.   G(rom will print or decode (dis-gpl?)  data from the console GROM's or cart-  ridge GROM's.   V(dp will print data from VDP Ram. Note  that no option is offered to treat VDP  data as code.   F(ile will take input data from a disk  file. NOTE: the dis-assembler treats the  file as a 'memory image' rather than an  assembler object file. This allows you  to generate data from various sources  (eg P-Code grom) and process it with the  dis-assembler. If the file option is  chosen the prompt is reissued to find  out how the data is to be handled. IE  is it 9900 code (Rom) etc.    A D D R E S S S E L E C T I O N  ---------------------------------   Address limits to print or decode are  specified in hex as a start address and  an end address.   If the file option was chosen the  address represents where the code WOULD  reside if it were in memory. This  enables the dis-assembler to generate  jump and branch addresses correctly. See  also the description of OFFSET later.   If the ROM/RAM option was chosen and the  address range overlaps DSR rom (4000h -  5FFFh) an additional prompt is issued  for the DSR CRU address. You may pick  one of the predefined addresses (Disk,  RS232, P-Code) or OTHER which enables  you to specify a non standard address.    F I L E S E L E C T I O N  ---------------------------   If the file option was chosen the  dis-assembler prompts for the file to  use. If the file is not found the  prompt is reissued. After the file has  been opened a prompt for offset appears.  This allows you to enter in decimal the  offset in bytes (0 relative) that the  data to be decoded is in the file.   This is useful if the data to be decoded  does not start at the beginning of the  file or you wish to decode a fragment  of code starting in the middle of the  file. In combination with the start  address this enables the dis-assembler  to generate meaningful jump and branch  addresses.    T I P S O N U S E  ---------------------   When dis-assembling 9900 code there is  usually embedded data and parameters.  This will cause the program to produce  some funny code at times. If the program  does get 'out of step' it will re-synch  fairly quickly.  Try starting at console rom address  24h. This is the start of the power up  routine. The workspace address is at  address 0000h and the code address is  at 0002h.   Decoding GPL instructions is a little  harder than 9900 code as they are byte  oriented. If the dis-assembler (dis-gpl)  gets out of step it is difficult to get  re-synchronized. For this reason you  will need to pay attention when decoding  GPL instructions.  Try starting at address 52h. This is the  GPL power clear routine. This can be  calculated from the 9900 instruction at  address 0030h (li R0,20h) which is the  first GPL instruction to be executed.  This points to a GPL branch to address  0052h.   The file option is useful for decoding  data that is not readily accesible to  the dis-assembler. For example some  initialization code for the P-System  is moved from P-Code GROM to ram address  2000h and branched to. It is not prac-  tical to build the capability ti handle  specific cases like that into the  program. Instead a simple routine can be  written to dump the code from GROM to a  file and process it that way.  EG. if the code to be dis-assembled is  dumped to a file and is executed at  address 2000h you would specify a start  address of 2000h and an OFFSET of 0.  If you wished to start at address 2024h  you would specify a start address of  2024h and an offset of 36 (decimal).  This will ensure correct addresses are  generated. Note that the OFFSET is a  decimal value of BYTES! This is in case  the file contains GPL code.