home *** CD-ROM | disk | FTP | other *** search
/ ftp.uni-stuttgart.de/pub/systems/acorn/ / Acorn.tar / Acorn / acornet / dev / basic / extbas.spk / Document next >
Text File  |  1995-08-05  |  7KB  |  217 lines

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