home *** CD-ROM | disk | FTP | other *** search
/ The Datafile PD-CD 5 / DATAFILE_PDCD5.iso / utilities / e / extbasic / DisasmDoc next >
Encoding:
Text File  |  1997-04-12  |  7.0 KB  |  218 lines

  1. Extended Disassembler
  2. ---------------------
  3. version 0.29, 12 April 1997
  4. by Darren Salt <arcsalt@spuddy.mew.co.uk>
  5.  
  6.  
  7. The module Disassembler provides a patch for all versions of the Debugger
  8. module from RISC OS 3.10 onwards. However, at the time of writing it hasn't
  9. (AFAIK) been tested with ARM8 and StrongARM.
  10.  
  11. It is aware of all ARMs up to ARM8 and StrongARM SA-110; it knows of all
  12. instructions up to ARM7, and the sign-extend and half-word load/store
  13. extensions. It also has a few extras thrown in (see below). It can also
  14. auto-detect which cache type is in use (ie. whether you have an ARM2 or
  15. ARM250 [uncached of course!], ARM3, ARM6 or later, or StrongARM).
  16.  
  17. To make the necessary changes to the Debugger module it must be located in
  18. RAM. The Disassembler module will therefore attempt to RMFaster the Debugger
  19. module which will require a small amount of memory in the RMA, in addition to
  20. that required by the Disassembler module itself.
  21.  
  22. Loading Disassembler should be performed at the command line. It is safe to
  23. do this from the ShellCLI, ie. whilst the desktop is active.
  24.  
  25. * If any breakpoints were set, these will be lost if the Debugger module was
  26.   running from ROM.
  27.  
  28. It is possible to initialise the flags by appending them to the load command.
  29. For example:
  30.   *RMLoad System:Modules.Disassem -FDwithR13 Y -QuoteSWIs Y
  31. (If a flag is not specified, it defaults to OFF.)
  32.  
  33.  
  34. The module supports one command and two SWIs. It also tries to patch
  35. *ShowRegs so that it uses the APCS-R register names if the APCS flag is set.
  36.  
  37.  
  38. *DisassemblerFlags
  39.  -----------------
  40.  Allows you to set various MemoryI and Debugger_Disassemble features.
  41.  Available switches:
  42.     -FDwithR13 <f>    use FD with R13, eg. STMDB R13 -> STMFD R13
  43.     -APCS <f>    use APCS-R register set
  44.     -LFMstack <f>    use stack notation with LFM & SFM where possible
  45.     -LFS <f>    use LFS and SFS in preference to LFM & SFM
  46.     -QuoteSWIs <f>    put quotes around SWI names
  47.     -UseDCD <f>    use DCD instead of 'Undefined instruction'
  48.     -UseVDU <f>    use VDU x instead of SWI OS_WriteI+x
  49.     -ANDEQasDCD <f>    use DCD instead of ANDEQ, MOV Rn,Rn (same register)
  50.             etc.
  51.     -UseADRL <f>    use ADRL/ADRX instead of ADR then ADD/SUB on same reg
  52.     -UseADRW <f>    use ADRW instead of ADD/SUB Rn,R12,#m and LDRW, STRW,
  53.             LDRBW, STRBW instead of xxxx Rn,[R12,#m]
  54.     -LongMul <f>    append L to UMUL, UMLA, SMUL, SMLA (thus using the
  55.             'official' forms)
  56.     -UseLDRL <f>    use LDRL instead of ADD/SUB Rn,Rm,#o + LDR Rn,[Rn,#p]
  57.             and ADD/SUB Rm,Ra,#o + LDR Rn,[Ra,#p]! and STR
  58.             instead of equivalent STRs.
  59.             (The LDRWL form is enabled by this *and* UseADRW)
  60.     -UseNOP <f>    use NOP instead of MOV R0,R0
  61.  where <f> is "0" or "N" (off), or "1" or "Y" (on).
  62.  
  63.  Use *DisassemblerFlags on its own to display the current state.
  64.  
  65.  These switches are three-way: "off", "on", and "unchanged". To leave it
  66. unchanged, just don't specify it :-)
  67.  
  68.  
  69. SWI Debugger_Disassemble
  70.     --------------------
  71.  Replaces the 'standard' version. Use it in exactly the same way.
  72.  
  73.  
  74. SWI Debugger_63
  75.     -----------
  76.  (Note no proper name!)
  77.  Used to alter the Debugger_Disassemble flags (listed above).
  78.  Input  : R0 = BIC mask, R1 = EOR mask
  79.  Process: new_flags = (old_flags AND NOT R0) EOR R1
  80.  Output : R0 = old_flags, R1 = new_flags
  81.  
  82.  Bits in R0 and R1 are:
  83.  0 = FDwithR13    2 = LFMstack    4 = QuoteSWIs    6 = ADNEQasDCD    8 = UseADRW
  84.  1 = APCS    3 = LFS        5 = UseDCD    7 = UseADRL    9 = UseLDRL
  85.  10 = UseNOP    11..31 = reserved, leave unchanged
  86.  
  87.  
  88.  
  89. Disassembly extensions and changes
  90. ----------------------------------
  91.  
  92.  MOV R0,R0    Optionally disassembled as NOP
  93.  
  94.  MOV PC,PC    Always disassembled as MOV PC,PC
  95.         Sometimes used instead of a branch instruction:
  96.             LDR    R0,data
  97.             MOV    PC,PC
  98.         .data    DCD    &123456        ; this is ignored
  99.             LDR    R1,[R0]
  100.  
  101.  SWP        Now listed as 'ARM250 and later'
  102.  
  103.  STM        Warning if base register second or later in register list and
  104.         writeback enabled: 'Base not first in list'
  105.  
  106.  ADRL        ADR followed by ADD/SUB with same condition on same register.
  107.         For example,
  108.             00010000    ADRLS    R0,&00010100
  109.             00010004    ADDLS    R0,R0,#&A000
  110.         becomes
  111.             00010000    ADRLS    R0,&00010100
  112.             00010004    ADRLSL    R0,&0001A100
  113.  
  114.  ADRX        ADR followed by two ADD/SUBs with same condition on same
  115.         register.
  116.  
  117.  ADRW        R12 relative: ADD/SUB Rn,R12,#m
  118.  
  119.  LDRW, LDRBW,    R12 relative: LDR/LDRB/STRB/STRB Rn,[R12,#m]
  120.  STRW, STRBW
  121.  
  122.  LDRL, LDRBL    Without writeback:
  123.             Normal:
  124.             ADD/SUB        Rn,Rm,#o
  125.             LDR/LDRB    Rn,[Rn,#p]
  126.             ->    ADD/SUB        Rn,Rm,#o
  127.             LDRL/LDRBL    Rn,[Rm,#o+p]
  128.             PC relative:
  129.             ADR        Rn,a
  130.             LDR/LDRB    Rn,[Rn,#p]
  131.             ->    ADR        Rn,a
  132.             LDRL/LDRBL    Rn,a+p
  133.         With writeback:
  134.             ADD/SUB        Rm,Rm,#o
  135.             LDR/LDRB    Rn,[Rm,#p]!
  136.             ->    ADD/SUB        Rm,Rm,#o
  137.             LDRL/LDRBL    Rn,[Rm,#o+p]!
  138.         Store address in third register:
  139.             Normal:
  140.             ADD/SUB        Ra,Rm,#o
  141.             LDR/LDRB    Rn,[Ra,#p]!
  142.             ->    ADD/SUB        Ra,Rm,#o
  143.             LDRL/LDRBL    Rn,{Ra},[Rm,#o+p]
  144.             PC relative:
  145.             ADR        Ra,a
  146.             LDR/LDRB    Rn,[Ra,#p]
  147.             ->    ADR        Ra,a
  148.             LDRL/LDRBL    Rn,{Ra},a+p
  149.  
  150.  STRL, STRBL    Without writeback:
  151.             Normal:
  152.             ADD/SUB        Rm,Rm,#o
  153.             STR/STRB    Rn,[Rm,#p]
  154.             ->    ADD/SUB        Rn,Rm,#o
  155.             STRL/STRBL    Rn,[Rm,#o+p]
  156.             (followed by a cancelling SUB/ADD)
  157.             PC relative:
  158.             Is not practical
  159.         With writeback:
  160.             ADD/SUB        Rm,Rm,#o
  161.             STR/STRB    Rn,[Rm,#p]!
  162.             ->    ADD/SUB        Rm,Rm,#o
  163.             STRL/STRBL    Rn,[Rm,#o+p]!
  164.         Store address in third register:
  165.             similar to LDRL/LDRBL
  166.  
  167.  LDRWL,        R12 relative:
  168.  LDRBWL,        ADD/SUB        Rn,R12,#o
  169.  STRWL,            LDR/LDRB    Rn,[R12,#p]
  170.  STRBWL        ->    ADD/SUB        Rn,R12,#o
  171.             LDRWL/LDRBWL    Rn,o+p
  172.         & similar for 3rd register variants (see LDRL)
  173.  
  174.  MCR, MRC    Constant (following first comma) now displayed correctly
  175.  
  176.  MRS, MSR    Added for ARM6 and later
  177.  
  178.  UMUL, SMUL,    Added for ARM7 and later
  179.  UMLA, SMLA    (Long 'official' forms supported)
  180.  
  181.  LDFxW, STFxW    R12 relative LDF/STF ('x' = precision code)
  182.  
  183.  LFM, SFM    Extended format - for example,
  184.             LFM    F1,3,[R13],#&024    ; =36
  185.         may be shown 'as is' or as any of
  186.             LFMIA    F1,3,[R13]!
  187.             LFMFD    F1,3,[R13]!
  188.             LFSIA    R13!,{F1-F3}
  189.             LFSFD    R13!,{F1-F3}
  190.  
  191.  FLT        Registers shown correct way round - Fx,Ry instead of Ry,Fx
  192.  
  193.  LDC, STC    L and T flags shown in order TL to avoid confusion with the
  194.         LT condition. The T flag is not supported in current versions
  195.         of FPEmulator; it is always used as the writeback bit, and
  196.         must therefore be set for the post-indexed forms.
  197.         (This also affects LDF, STF, LFM and SFM.)
  198.  
  199.  VDU, VDUX    Equivalent to SWI OS_WriteI and XOS_WriteI respectively
  200.  
  201.  LDR, STR    H, SH, SB forms added for ARM7M and later
  202.         W (R12-relative) forms supported, eg. LDRSBW R0,&40
  203.  
  204. Instructions which rely on PC plus implied offset, because of the possibly
  205. different values of this offset for different ARM implementations, are
  206. flagged as "*** Offset not guaranteed".
  207. (comp.sys.arm <47kr75$hpc@doc.armltd.co.uk>, David Seal, "Re: Storing PC")
  208.  
  209. LDRs and STRs which are PC-relative always appear in the standard form. For
  210. an instruction pair in which the first is of the form "[Rm],#d" and the
  211. second is an ADD or SUB modifying (and storing in) Rm, a comment "Rm+=x" will
  212. be shown.
  213.  
  214. Comments of the form '="x"' now contain the character code: '="x" (120)".
  215.  
  216. As with all good software, there may be undocumented features... let me know
  217. and I'll try to fix them :-)
  218.