home *** CD-ROM | disk | FTP | other *** search
/ The Datafile PD-CD 3 / PDCD_3.iso / utilities / utilsd / extendbas / Document next >
Text File  |  1994-11-03  |  6KB  |  198 lines

  1.  
  2. Extended BASIC Assembler
  3. ------------------------
  4. version 1.00, 3 November 1994
  5. written by Adrian Lees
  6.  
  7.  
  8. The module ExtBASICasm provides a patch for version 1.05 and 1.06 of BASIC V,
  9. as supplied with RISC OS 3.11 and 3.50 respectively, to allow the direct use
  10. of the extra instructions provided by the ARM3 and ARM610 processors.
  11. Additionally the missing floating-point and general coprocessor instructions
  12. have been added, and the register name LR may now be used in preference
  13. to R14.
  14.  
  15. To make the necessary changes to the BASIC module it must be located in RAM.
  16. The ExtBASICasm module will therefore attempt to RMFaster the BASIC module
  17. which will require a small amount of memory in the RMA, in addition to that
  18. required by the ExtBASICasm module itself. More importantly, BASIC must not
  19. be active, ie. running, at the time because then the module cannot be removed
  20. to allow it to be moved. Loading ExtBASICasm should therefore be performed
  21. at the command line. It is safe to do this from the ShellCLI, ie. whilst the
  22. desktop is active, even with BASIC programs running because BASIC holds all
  23. its information within the application workspace.
  24.  
  25. The instructions added by the module are as follows:
  26.  
  27.  
  28. ARM3 and ARM610 instructions
  29. ----------------------------
  30.  
  31.     SWP{cond}{B}    Rd,Rm,[Rn]
  32.  
  33.  
  34. ARM610 instructions
  35. -------------------
  36.  
  37.     MCR{cond}    CP#,<expression1>,Rd,Cn,Cm{,<expression2>}
  38.     MRC{cond}    CP#,<expression1>,Rd,Cn,Cm{,<expression2>}
  39.     MRS{cond}    Rd,<psr>
  40.     MSR{cond}    <psr>,Rm
  41.     MSR{cond}    <psrf>,Rm
  42.     MSR{cond}    <psrf>,<#expression>
  43.  
  44. Floating-point instructions
  45. ---------------------------
  46.  
  47. Floating point coprocessor data transfer
  48.  
  49.     LDF{cond}prec    Fd,[Rn]{,#offset}
  50.     LDF{cond}prec    Fd,[Rn,#offset]{!}
  51.     LDF{cond}prec    Fd,<label | expression>
  52.  
  53.     STF{cond}prec    Fd,[Rn]{,#offset}
  54.     STF{cond}prec    Fd,[Rn,#offset]{!}
  55.     STF{cond}prec    Fd,<label | expression>
  56.  
  57. Floating point coprocessor register transfer
  58.  
  59.     FLT{cond}prec{round}    Fn,Rd
  60.     FIX{cond}{round}     Rd,Fn
  61.     WFS{cond}        Rd
  62.     RFS{cond}        Rd
  63.     WFC{cond}        Rd
  64.     RFC{cond}        Rd
  65.  
  66. Floating point coprocessor data operations
  67.  
  68.     ADF{cond}prec{round}    Fd,Fn,<Fm | #value>
  69.     MUF{cond}prec{round}    Fd,Fn,<Fm | #value>
  70.     SUF{cond}prec{round}    Fd,Fn,<Fm | #value>
  71.     RSF{cond}prec{round}    Fd,Fn,<Fm | #value>
  72.     DVF{cond}prec{round}    Fd,Fn,<Fm | #value>
  73.     RDF{cond}prec{round}    Fd,Fn,<Fm | #value>
  74.     POW{cond}prec{round}    Fd,Fn,<Fm | #value>
  75.     RPW{cond}prec{round}    Fd,Fn,<Fm | #value>
  76.     RMF{cond}prec{round}    Fd,Fn,<Fm | #value>
  77.     FML{cond}prec{round}    Fd,Fn,<Fm | #value>
  78.     FDV{cond}prec{round}    Fd,Fn,<Fm | #value>
  79.     FRD{cond}prec{round}    Fd,Fn,<Fm | #value>
  80.     POL{cond}prec{round}    Fd,Fn,<Fm | #value>
  81.  
  82.     MVF{cond}prec{round}    Fd,<Fm | #value>
  83.     MNF{cond}prec{round}    Fd,<Fm | #value>
  84.     ABS{cond}prec{round}    Fd,<Fm | #value>
  85.     RND{cond}prec{round}    Fd,<Fm | #value>
  86.     SQT{cond}prec{round}    Fd,<Fm | #value>
  87.     LOG{cond}prec{round}    Fd,<Fm | #value>
  88.     LGN{cond}prec{round}    Fd,<Fm | #value>
  89.     EXP{cond}prec{round}    Fd,<Fm | #value>
  90.     SIN{cond}prec{round}    Fd,<Fm | #value>
  91.     COS{cond}prec{round}    Fd,<Fm | #value>
  92.     TAN{cond}prec{round}    Fd,<Fm | #value>
  93.     ASN{cond}prec{round}    Fd,<Fm | #value>
  94.     ACN{cond}prec{round}    Fd,<Fm | #value>
  95.     ATN{cond}prec{round}    Fd,<Fm | #value>
  96.     URD{cond}prec{round}    Fd,<Fm | #value>
  97.     NRM{cond}prec{round}    Fd,<Fm | #value>
  98.  
  99. Floating point coprocessor status transfer
  100.  
  101.     CMF{cond}prec{round}    Fm,Fn
  102.     CNF{cond}prec{round}    Fm,Fn
  103.     CMFE{cond}prec{round}    Fm,Fn
  104.     CNFE{cond}prec{round}    Fm,Fn
  105.  
  106.  
  107. General co-processor instructions
  108. ---------------------------------
  109.  
  110. Coprocessor data operations
  111.  
  112.     CDO{cond}    CP#,copro_opcode,Cd,Cn,Cm{,expression}
  113.     CDP{cond}    CP#,copro_opcode,Cd,Cn,Cm{,expression}
  114.  
  115.     (the values of copro_opcode and the optional expression
  116.      must lie within the range 0..15)
  117.  
  118. Coprocessor data transfer
  119.  
  120.     LDC{cond}{L}{T}    CP#,Cd,[Rn]{,#offset}
  121.     LDC{cond}{L}{T}    CP#,Cd,[Rn,#offset]{!}
  122.     LDC{cond}{L}{T}    CP#,Cd,<label | expression>
  123.  
  124.     STC{cond}{L}{T}    CP#,Cd,[Rn]{,#offset}
  125.     STC{cond}{L}{T}    CP#,Cd,[Rn,#offset]{!}
  126.     STC{cond}{L}{T}    CP#,Cd,<label | expression>
  127.  
  128.  
  129. Assembler directives
  130. --------------------
  131.  
  132. To support the assembly of floating-point coprocessor instructions the
  133. following directives are provided:
  134.  
  135.     EQUFS <expression>
  136.     EQUFD <expression>
  137.     EQUFP <expression>
  138.     EQUFE <expression>
  139.  
  140. These directives accept an expression that evaluates to either an integer
  141. or a real number. The result is then converted into the required precision
  142. and stored in the object code at P%.(or O% if indirect assembly is being used)
  143.  
  144. The amount of memory allocated by each directive is shown below:
  145.  
  146.             bytes
  147.  
  148.     EQUFS        8
  149.     EQUFD        16
  150.     EQUFE        24
  151.     EQUFP        24        ;not yet implemented
  152.  
  153. Notes
  154. -----
  155.  
  156. * Registers are specified in the following form:
  157.  
  158.     ARM registers:            R0..R15
  159.     Floating-point registers:    F0..F7
  160.     General co-processor registers:    C0..C15
  161.  
  162. * Coprocessor numbers (CP#) may be specified using either of the following
  163.   forms:
  164.  
  165.     P0..P15
  166.     CP0..CP15
  167.  
  168. * Wherever a register or coprocessor number is specified an expression
  169.   may be substituted in the usual manner allowed by BASIC V.
  170.   This module employs the routines used within BASIC to evaluate all
  171.   expressions (eg. register numbers, offsets and labels) and hence its
  172.   interpretation of expressions is guaranteed to be the same as BASIC.
  173.  
  174. * There is a subtle inconsistency between the ARM2/3 and ARM610 datasheets
  175.   regarding the ARM's interpretation of the W-bit in the post-indexed LDC/STC
  176.   instructions.
  177.   The behaviour of each processor is described below:
  178.  
  179.   ARM2 and ARM3
  180.  
  181.       Setting the W bit for post-indexed expressions forces the -TRANS
  182.       pin low for the transfer cycle, indicating to the memory system
  183.       that no address translation should be performed for this access.
  184.     Write-back occurs independently of the setting of the W bit
  185.  
  186.     Note that in user mode the W bit is ignored.
  187.  
  188.   ARM610
  189.  
  190.       The W bit must be set to ensure that write-back occurs.
  191.  
  192.   This module will assemble all post-indexed LDC/STC instructions without
  193.   setting the W bit unless the T suffix is appended to the opcode. ie. the
  194.   behaviour of the assembler matches the ARM2 rather than the ARM610.
  195.   When assembling code for the ARM610 all post-indexed instructions should
  196.   include the T suffix to ensure that the W bit is set.
  197.  
  198.