Home » Archimedes archive » Micro User » MU 1992-05.adf » PD » Fractal/!Fractal/Help/!FP_Doc/ReadMe

Fractal/!Fractal/Help/!FP_Doc/ReadMe

This website contains an archive of files for the Acorn Electron, BBC Micro, Acorn Archimedes, Commodore 16 and Commodore 64 computers, which Dominic Ford has rescued from his private collection of floppy disks and cassettes.

Some of these files were originally commercial releases in the 1980s and 1990s, but they are now widely available online. I assume that copyright over them is no longer being asserted. If you own the copyright and would like files to be removed, please contact me.

Tape/disk: Home » Archimedes archive » Micro User » MU 1992-05.adf » PD
Filename: Fractal/!Fractal/Help/!FP_Doc/ReadMe
Read OK:
File size: 1997 bytes
Load address: 0000
Exec address: 0000
File contents
FPLib v1.20 - Floating Point Assembler From Basic
~~~~~~~~~~~

This file explains how to use the floating point assembler provided. For
full information on the floating point instruction set see the Acorn PRM.

FPLib allows floating point instructions and constants to be assembled using
the BASIC V assembler. Most of the options and syntax is supported, as shown
below. Programs assembled with floating point instructions must ensure that
the floating point emulator is loaded before use.

Requirements
------------
The following annotated example shows the requirements.

LIBRARY"FPLib"                      Access FPLib
DIM code% 1024                      Use any name
PROCfpinit                          MUST be called prior to assembly
FOR asm=4 TO 7 STEP 3               asm MUST be control variable
P%=0:O%=code%                       Offset assembly is supported if required
[OPT asm
FNfp("LDFD F0,double")              Define a float instruction
FNfp("ADFEQD F0,F1,F2")             F0=F1+F2 if previous compare =
.var FNfp("DFS 4.723e23")           Define a float contstant
]:NEXT

Operands of instructions may refer to BASIC variables or program locations
as well as hard coded numbers.

Float constant operands can only refer to a number, not a BASIC variable or
expression. To use a variable use this form:
   FNfp("DFE "+STR$(number))   where number is a previously defined variable

A reasonable level of syntax checking is performed, but FPLib is not very
tolerant of mistakes.

Syntax And Instruction Set
--------------------------
Floating point numbers are supported in 4 formats:
single S (4 bytes) with 9 digits of precision, exponent +/- 54 
double D (8 bytes) with 17 digits of precision, exponent +/- 340
extended E (12 bytes) with full internal precision, exponent +/- 999
packed P (12 bytes) with 17 digits of precision

In most instructions the precision must be specified. P is only used for
storing and loading.

There are 8 floating point registers which are called F0 to F7 by FPLib.

In the following <cond> is an optional condition (the standard ARM
instruction conditions), and prec is the precision letter from above.

Load/Store:
LDF<cond>prec Fd,addr           Load a float from address
STF<cond>prec Fd,addr           Store a float to address

addr is  [Rn]<,#offset>  or  [Rn,#offset]<!>  ie. as per LDR/STR
addr may also be a program location in which case FPLib will calculate the
address as +/- from R15. Offsets must be within +/- 1020 bytes.
eg. LDFD F0,double       Load a double
    STFE F2,[R1,#0]      Store at R1 location
    LDFS F4,[R2],#8      load double from R2, then bump R2 past double

Binary Ops:
binop<cond>prec Fd,Fn,Fm|#value

where binop can be:
ADF  Add                  Fd=Fn+Fm
MUF  Multiply             Fd=Fn*Fm
SUF  Subtract             Fd=Fn-Fm
RSF  Reverse Subtract     Fd=Fm-Fn
DVF  Divide               Fd=Fn/Fm
RDF  Reverse Divide       Fd=Fm/Fn
POW  Power                Fd=Fn to the power of Fm
RPW  Reverse Power        Fd=Fm to the power of Fn
RMF  Remainder            Fd=remainder of Fn/Fm
FML  Fast multiply        Fd=Fn*Fm
FDV  Fast divide          Fd=Fn/Fm
FRD  Fast reverse divide  Fd=Fm/Fn
POL  Polar Angle          Fd=polar angle of(Fn,Fm)

The fast instructions compute to single precision only.

value can be 0.5, 0, 1, 2, 3, 4, 5 or 10.
eg. ADF F7,F4,F5
    ADF F3,F2,#2

Unary Ops:
unyop<cond>prec Fd,Fm|#value

where unyop can be:
MVF  Move                 Fd=Fm
MNF  Move negated         Fd=-Fm
ABS  Absolute             Fd=ABS(Fm)
RND  Round to integral    Fd=integer value of Fm
SQT  Square root          Fd=square root of Fm
LOG  Logarithm base 10    Fd=log10 of Fm
LGN  Logarithm base e     Fd=loge of Fm
EXP  Exponent             Fd=e to the power of Fm
SIN  Sine                 Fd=sine of Fm
COS  Cosine               Fd=cosine of Fm
TAN  Tangent              Fd=tangent of Fm
ASN  Arc sine             Fd=arcsine of Fm
ACS  Arc cosine           Fd=arccosine of Fm
ATN  Arc tangent          Fd=arctangent of Fm

eg. MVF F0,#0      Zeroise float register

Register Transfer:
FLT<cond>prec Fn,Rd       Integer to floating point
FIX<cond>prec Rd,Fm       Floating point to integer
WFS<cond>     Rd          write floating point status
RFS<cond>     Rd          read floating point status
WFC<cond>     Rd          write floating point control
RFC<cond>     Rd          read floating point control

Refer to the PRM for the floating point status bit settings.
Nb. *MEMORYI incorrectly dis-assembles the FLT Fn operand.

Status Transfer:
CMF<cond>prec Fn,Fm|#value   compare Fn with Fm
CNF<cond>prec Fn,Fm|#value   compare Fn with -Fm
CME<cond>prec Fn,Fm|#value   compare with exception
CNE<cond>prec Fn,Fm|#value   compare negated with exception

Use the standard branches after compares. Acorn recommends the use of
CMF/CNF with BEQ/BNE, and CME/CNE for others (BGE/BGT/BLT/BLE).
Nb. The PRM incorrectly displays the operands as Fm,Fn.

Constants
---------
DFS number   Define a single precision constant - 4 bytes
DFD number   Define a double precision constant - 8 bytes
DFE number   Define an extended precision constant - 12 bytes
DFP number   Define a constant in packed format - 12 bytes

Conversion Routines
-------------------
Two conversion routines are provided which can be assembled into your
program.

PROCstrtofp(addr%) Assembles a string to float routine at location addr%
PROCfptostr(addr%) Assembles a float to string routine at location addr%

300 bytes are required to assemble each routine at the address provided.

string_to_float: call this routine to convert an ASCII number to a float.
The number can have leading spaces, and may be in standard (1234.5678) or
scientific format (1.23e24). No check is made for invalid numbers (ie. too
big). On entry to the routine registers must be:
  R0: address of control-terminated numeric string
  R1: address of target converted number (4,8 or 12 bytes)
  R2: float type: 0=Single, 1=Double, 2=Extended, 3=Packed
Conversion is terminated as soon as an invalid character is detected, and
the result so far is returned.

float_to_string: call this routine to convert a float into ASCII format. The
number is converted into scientific format with 16 decimal places (ie 17
digits precision), with +/- signs as required. Registers on entry should be:
  R0: address of float number
  R1: address of converted string - 26 bytes are required
  R2: float type: 0=Single, 1=Double, 2=Extended, 3=Packed

-----------------------------------------------------------------------------
Mike Curnow,
22/07/91
00000000  46 50 4c 69 62 20 76 31  2e 32 30 20 2d 20 46 6c  |FPLib v1.20 - Fl|
00000010  6f 61 74 69 6e 67 20 50  6f 69 6e 74 20 41 73 73  |oating Point Ass|
00000020  65 6d 62 6c 65 72 20 46  72 6f 6d 20 42 61 73 69  |embler From Basi|
00000030  63 0a 7e 7e 7e 7e 7e 7e  7e 7e 7e 7e 7e 0a 0a 54  |c.~~~~~~~~~~~..T|
00000040  68 69 73 20 66 69 6c 65  20 65 78 70 6c 61 69 6e  |his file explain|
00000050  73 20 68 6f 77 20 74 6f  20 75 73 65 20 74 68 65  |s how to use the|
00000060  20 66 6c 6f 61 74 69 6e  67 20 70 6f 69 6e 74 20  | floating point |
00000070  61 73 73 65 6d 62 6c 65  72 20 70 72 6f 76 69 64  |assembler provid|
00000080  65 64 2e 20 46 6f 72 0a  66 75 6c 6c 20 69 6e 66  |ed. For.full inf|
00000090  6f 72 6d 61 74 69 6f 6e  20 6f 6e 20 74 68 65 20  |ormation on the |
000000a0  66 6c 6f 61 74 69 6e 67  20 70 6f 69 6e 74 20 69  |floating point i|
000000b0  6e 73 74 72 75 63 74 69  6f 6e 20 73 65 74 20 73  |nstruction set s|
000000c0  65 65 20 74 68 65 20 41  63 6f 72 6e 20 50 52 4d  |ee the Acorn PRM|
000000d0  2e 0a 0a 46 50 4c 69 62  20 61 6c 6c 6f 77 73 20  |...FPLib allows |
000000e0  66 6c 6f 61 74 69 6e 67  20 70 6f 69 6e 74 20 69  |floating point i|
000000f0  6e 73 74 72 75 63 74 69  6f 6e 73 20 61 6e 64 20  |nstructions and |
00000100  63 6f 6e 73 74 61 6e 74  73 20 74 6f 20 62 65 20  |constants to be |
00000110  61 73 73 65 6d 62 6c 65  64 20 75 73 69 6e 67 0a  |assembled using.|
00000120  74 68 65 20 42 41 53 49  43 20 56 20 61 73 73 65  |the BASIC V asse|
00000130  6d 62 6c 65 72 2e 20 4d  6f 73 74 20 6f 66 20 74  |mbler. Most of t|
00000140  68 65 20 6f 70 74 69 6f  6e 73 20 61 6e 64 20 73  |he options and s|
00000150  79 6e 74 61 78 20 69 73  20 73 75 70 70 6f 72 74  |yntax is support|
00000160  65 64 2c 20 61 73 20 73  68 6f 77 6e 0a 62 65 6c  |ed, as shown.bel|
00000170  6f 77 2e 20 50 72 6f 67  72 61 6d 73 20 61 73 73  |ow. Programs ass|
00000180  65 6d 62 6c 65 64 20 77  69 74 68 20 66 6c 6f 61  |embled with floa|
00000190  74 69 6e 67 20 70 6f 69  6e 74 20 69 6e 73 74 72  |ting point instr|
000001a0  75 63 74 69 6f 6e 73 20  6d 75 73 74 20 65 6e 73  |uctions must ens|
000001b0  75 72 65 20 74 68 61 74  0a 74 68 65 20 66 6c 6f  |ure that.the flo|
000001c0  61 74 69 6e 67 20 70 6f  69 6e 74 20 65 6d 75 6c  |ating point emul|
000001d0  61 74 6f 72 20 69 73 20  6c 6f 61 64 65 64 20 62  |ator is loaded b|
000001e0  65 66 6f 72 65 20 75 73  65 2e 0a 0a 52 65 71 75  |efore use...Requ|
000001f0  69 72 65 6d 65 6e 74 73  0a 2d 2d 2d 2d 2d 2d 2d  |irements.-------|
00000200  2d 2d 2d 2d 2d 0a 54 68  65 20 66 6f 6c 6c 6f 77  |-----.The follow|
00000210  69 6e 67 20 61 6e 6e 6f  74 61 74 65 64 20 65 78  |ing annotated ex|
00000220  61 6d 70 6c 65 20 73 68  6f 77 73 20 74 68 65 20  |ample shows the |
00000230  72 65 71 75 69 72 65 6d  65 6e 74 73 2e 0a 0a 4c  |requirements...L|
00000240  49 42 52 41 52 59 22 46  50 4c 69 62 22 20 20 20  |IBRARY"FPLib"   |
00000250  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00000260  20 20 20 41 63 63 65 73  73 20 46 50 4c 69 62 0a  |   Access FPLib.|
00000270  44 49 4d 20 63 6f 64 65  25 20 31 30 32 34 20 20  |DIM code% 1024  |
00000280  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00000290  20 20 20 20 55 73 65 20  61 6e 79 20 6e 61 6d 65  |    Use any name|
000002a0  0a 50 52 4f 43 66 70 69  6e 69 74 20 20 20 20 20  |.PROCfpinit     |
000002b0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
000002c0  20 20 20 20 20 4d 55 53  54 20 62 65 20 63 61 6c  |     MUST be cal|
000002d0  6c 65 64 20 70 72 69 6f  72 20 74 6f 20 61 73 73  |led prior to ass|
000002e0  65 6d 62 6c 79 0a 46 4f  52 20 61 73 6d 3d 34 20  |embly.FOR asm=4 |
000002f0  54 4f 20 37 20 53 54 45  50 20 33 20 20 20 20 20  |TO 7 STEP 3     |
00000300  20 20 20 20 20 20 20 20  20 20 61 73 6d 20 4d 55  |          asm MU|
00000310  53 54 20 62 65 20 63 6f  6e 74 72 6f 6c 20 76 61  |ST be control va|
00000320  72 69 61 62 6c 65 0a 50  25 3d 30 3a 4f 25 3d 63  |riable.P%=0:O%=c|
00000330  6f 64 65 25 20 20 20 20  20 20 20 20 20 20 20 20  |ode%            |
00000340  20 20 20 20 20 20 20 20  20 20 20 4f 66 66 73 65  |           Offse|
00000350  74 20 61 73 73 65 6d 62  6c 79 20 69 73 20 73 75  |t assembly is su|
00000360  70 70 6f 72 74 65 64 20  69 66 20 72 65 71 75 69  |pported if requi|
00000370  72 65 64 0a 5b 4f 50 54  20 61 73 6d 0a 46 4e 66  |red.[OPT asm.FNf|
00000380  70 28 22 4c 44 46 44 20  46 30 2c 64 6f 75 62 6c  |p("LDFD F0,doubl|
00000390  65 22 29 20 20 20 20 20  20 20 20 20 20 20 20 20  |e")             |
000003a0  20 44 65 66 69 6e 65 20  61 20 66 6c 6f 61 74 20  | Define a float |
000003b0  69 6e 73 74 72 75 63 74  69 6f 6e 0a 46 4e 66 70  |instruction.FNfp|
000003c0  28 22 41 44 46 45 51 44  20 46 30 2c 46 31 2c 46  |("ADFEQD F0,F1,F|
000003d0  32 22 29 20 20 20 20 20  20 20 20 20 20 20 20 20  |2")             |
000003e0  46 30 3d 46 31 2b 46 32  20 69 66 20 70 72 65 76  |F0=F1+F2 if prev|
000003f0  69 6f 75 73 20 63 6f 6d  70 61 72 65 20 3d 0a 2e  |ious compare =..|
00000400  76 61 72 20 46 4e 66 70  28 22 44 46 53 20 34 2e  |var FNfp("DFS 4.|
00000410  37 32 33 65 32 33 22 29  20 20 20 20 20 20 20 20  |723e23")        |
00000420  20 20 20 44 65 66 69 6e  65 20 61 20 66 6c 6f 61  |   Define a floa|
00000430  74 20 63 6f 6e 74 73 74  61 6e 74 0a 5d 3a 4e 45  |t contstant.]:NE|
00000440  58 54 0a 0a 4f 70 65 72  61 6e 64 73 20 6f 66 20  |XT..Operands of |
00000450  69 6e 73 74 72 75 63 74  69 6f 6e 73 20 6d 61 79  |instructions may|
00000460  20 72 65 66 65 72 20 74  6f 20 42 41 53 49 43 20  | refer to BASIC |
00000470  76 61 72 69 61 62 6c 65  73 20 6f 72 20 70 72 6f  |variables or pro|
00000480  67 72 61 6d 20 6c 6f 63  61 74 69 6f 6e 73 0a 61  |gram locations.a|
00000490  73 20 77 65 6c 6c 20 61  73 20 68 61 72 64 20 63  |s well as hard c|
000004a0  6f 64 65 64 20 6e 75 6d  62 65 72 73 2e 0a 0a 46  |oded numbers...F|
000004b0  6c 6f 61 74 20 63 6f 6e  73 74 61 6e 74 20 6f 70  |loat constant op|
000004c0  65 72 61 6e 64 73 20 63  61 6e 20 6f 6e 6c 79 20  |erands can only |
000004d0  72 65 66 65 72 20 74 6f  20 61 20 6e 75 6d 62 65  |refer to a numbe|
000004e0  72 2c 20 6e 6f 74 20 61  20 42 41 53 49 43 20 76  |r, not a BASIC v|
000004f0  61 72 69 61 62 6c 65 20  6f 72 0a 65 78 70 72 65  |ariable or.expre|
00000500  73 73 69 6f 6e 2e 20 54  6f 20 75 73 65 20 61 20  |ssion. To use a |
00000510  76 61 72 69 61 62 6c 65  20 75 73 65 20 74 68 69  |variable use thi|
00000520  73 20 66 6f 72 6d 3a 0a  20 20 20 46 4e 66 70 28  |s form:.   FNfp(|
00000530  22 44 46 45 20 22 2b 53  54 52 24 28 6e 75 6d 62  |"DFE "+STR$(numb|
00000540  65 72 29 29 20 20 20 77  68 65 72 65 20 6e 75 6d  |er))   where num|
00000550  62 65 72 20 69 73 20 61  20 70 72 65 76 69 6f 75  |ber is a previou|
00000560  73 6c 79 20 64 65 66 69  6e 65 64 20 76 61 72 69  |sly defined vari|
00000570  61 62 6c 65 0a 0a 41 20  72 65 61 73 6f 6e 61 62  |able..A reasonab|
00000580  6c 65 20 6c 65 76 65 6c  20 6f 66 20 73 79 6e 74  |le level of synt|
00000590  61 78 20 63 68 65 63 6b  69 6e 67 20 69 73 20 70  |ax checking is p|
000005a0  65 72 66 6f 72 6d 65 64  2c 20 62 75 74 20 46 50  |erformed, but FP|
000005b0  4c 69 62 20 69 73 20 6e  6f 74 20 76 65 72 79 0a  |Lib is not very.|
000005c0  74 6f 6c 65 72 61 6e 74  20 6f 66 20 6d 69 73 74  |tolerant of mist|
000005d0  61 6b 65 73 2e 0a 0a 53  79 6e 74 61 78 20 41 6e  |akes...Syntax An|
000005e0  64 20 49 6e 73 74 72 75  63 74 69 6f 6e 20 53 65  |d Instruction Se|
000005f0  74 0a 2d 2d 2d 2d 2d 2d  2d 2d 2d 2d 2d 2d 2d 2d  |t.--------------|
00000600  2d 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 2d 0a 46 6c 6f  |------------.Flo|
00000610  61 74 69 6e 67 20 70 6f  69 6e 74 20 6e 75 6d 62  |ating point numb|
00000620  65 72 73 20 61 72 65 20  73 75 70 70 6f 72 74 65  |ers are supporte|
00000630  64 20 69 6e 20 34 20 66  6f 72 6d 61 74 73 3a 0a  |d in 4 formats:.|
00000640  73 69 6e 67 6c 65 20 53  20 28 34 20 62 79 74 65  |single S (4 byte|
00000650  73 29 20 77 69 74 68 20  39 20 64 69 67 69 74 73  |s) with 9 digits|
00000660  20 6f 66 20 70 72 65 63  69 73 69 6f 6e 2c 20 65  | of precision, e|
00000670  78 70 6f 6e 65 6e 74 20  2b 2f 2d 20 35 34 20 0a  |xponent +/- 54 .|
00000680  64 6f 75 62 6c 65 20 44  20 28 38 20 62 79 74 65  |double D (8 byte|
00000690  73 29 20 77 69 74 68 20  31 37 20 64 69 67 69 74  |s) with 17 digit|
000006a0  73 20 6f 66 20 70 72 65  63 69 73 69 6f 6e 2c 20  |s of precision, |
000006b0  65 78 70 6f 6e 65 6e 74  20 2b 2f 2d 20 33 34 30  |exponent +/- 340|
000006c0  0a 65 78 74 65 6e 64 65  64 20 45 20 28 31 32 20  |.extended E (12 |
000006d0  62 79 74 65 73 29 20 77  69 74 68 20 66 75 6c 6c  |bytes) with full|
000006e0  20 69 6e 74 65 72 6e 61  6c 20 70 72 65 63 69 73  | internal precis|
000006f0  69 6f 6e 2c 20 65 78 70  6f 6e 65 6e 74 20 2b 2f  |ion, exponent +/|
00000700  2d 20 39 39 39 0a 70 61  63 6b 65 64 20 50 20 28  |- 999.packed P (|
00000710  31 32 20 62 79 74 65 73  29 20 77 69 74 68 20 31  |12 bytes) with 1|
00000720  37 20 64 69 67 69 74 73  20 6f 66 20 70 72 65 63  |7 digits of prec|
00000730  69 73 69 6f 6e 0a 0a 49  6e 20 6d 6f 73 74 20 69  |ision..In most i|
00000740  6e 73 74 72 75 63 74 69  6f 6e 73 20 74 68 65 20  |nstructions the |
00000750  70 72 65 63 69 73 69 6f  6e 20 6d 75 73 74 20 62  |precision must b|
00000760  65 20 73 70 65 63 69 66  69 65 64 2e 20 50 20 69  |e specified. P i|
00000770  73 20 6f 6e 6c 79 20 75  73 65 64 20 66 6f 72 0a  |s only used for.|
00000780  73 74 6f 72 69 6e 67 20  61 6e 64 20 6c 6f 61 64  |storing and load|
00000790  69 6e 67 2e 0a 0a 54 68  65 72 65 20 61 72 65 20  |ing...There are |
000007a0  38 20 66 6c 6f 61 74 69  6e 67 20 70 6f 69 6e 74  |8 floating point|
000007b0  20 72 65 67 69 73 74 65  72 73 20 77 68 69 63 68  | registers which|
000007c0  20 61 72 65 20 63 61 6c  6c 65 64 20 46 30 20 74  | are called F0 t|
000007d0  6f 20 46 37 20 62 79 20  46 50 4c 69 62 2e 0a 0a  |o F7 by FPLib...|
000007e0  49 6e 20 74 68 65 20 66  6f 6c 6c 6f 77 69 6e 67  |In the following|
000007f0  20 3c 63 6f 6e 64 3e 20  69 73 20 61 6e 20 6f 70  | <cond> is an op|
00000800  74 69 6f 6e 61 6c 20 63  6f 6e 64 69 74 69 6f 6e  |tional condition|
00000810  20 28 74 68 65 20 73 74  61 6e 64 61 72 64 20 41  | (the standard A|
00000820  52 4d 0a 69 6e 73 74 72  75 63 74 69 6f 6e 20 63  |RM.instruction c|
00000830  6f 6e 64 69 74 69 6f 6e  73 29 2c 20 61 6e 64 20  |onditions), and |
00000840  70 72 65 63 20 69 73 20  74 68 65 20 70 72 65 63  |prec is the prec|
00000850  69 73 69 6f 6e 20 6c 65  74 74 65 72 20 66 72 6f  |ision letter fro|
00000860  6d 20 61 62 6f 76 65 2e  0a 0a 4c 6f 61 64 2f 53  |m above...Load/S|
00000870  74 6f 72 65 3a 0a 4c 44  46 3c 63 6f 6e 64 3e 70  |tore:.LDF<cond>p|
00000880  72 65 63 20 46 64 2c 61  64 64 72 20 20 20 20 20  |rec Fd,addr     |
00000890  20 20 20 20 20 20 4c 6f  61 64 20 61 20 66 6c 6f  |      Load a flo|
000008a0  61 74 20 66 72 6f 6d 20  61 64 64 72 65 73 73 0a  |at from address.|
000008b0  53 54 46 3c 63 6f 6e 64  3e 70 72 65 63 20 46 64  |STF<cond>prec Fd|
000008c0  2c 61 64 64 72 20 20 20  20 20 20 20 20 20 20 20  |,addr           |
000008d0  53 74 6f 72 65 20 61 20  66 6c 6f 61 74 20 74 6f  |Store a float to|
000008e0  20 61 64 64 72 65 73 73  0a 0a 61 64 64 72 20 69  | address..addr i|
000008f0  73 20 20 5b 52 6e 5d 3c  2c 23 6f 66 66 73 65 74  |s  [Rn]<,#offset|
00000900  3e 20 20 6f 72 20 20 5b  52 6e 2c 23 6f 66 66 73  |>  or  [Rn,#offs|
00000910  65 74 5d 3c 21 3e 20 20  69 65 2e 20 61 73 20 70  |et]<!>  ie. as p|
00000920  65 72 20 4c 44 52 2f 53  54 52 0a 61 64 64 72 20  |er LDR/STR.addr |
00000930  6d 61 79 20 61 6c 73 6f  20 62 65 20 61 20 70 72  |may also be a pr|
00000940  6f 67 72 61 6d 20 6c 6f  63 61 74 69 6f 6e 20 69  |ogram location i|
00000950  6e 20 77 68 69 63 68 20  63 61 73 65 20 46 50 4c  |n which case FPL|
00000960  69 62 20 77 69 6c 6c 20  63 61 6c 63 75 6c 61 74  |ib will calculat|
00000970  65 20 74 68 65 0a 61 64  64 72 65 73 73 20 61 73  |e the.address as|
00000980  20 2b 2f 2d 20 66 72 6f  6d 20 52 31 35 2e 20 4f  | +/- from R15. O|
00000990  66 66 73 65 74 73 20 6d  75 73 74 20 62 65 20 77  |ffsets must be w|
000009a0  69 74 68 69 6e 20 2b 2f  2d 20 31 30 32 30 20 62  |ithin +/- 1020 b|
000009b0  79 74 65 73 2e 0a 65 67  2e 20 4c 44 46 44 20 46  |ytes..eg. LDFD F|
000009c0  30 2c 64 6f 75 62 6c 65  20 20 20 20 20 20 20 4c  |0,double       L|
000009d0  6f 61 64 20 61 20 64 6f  75 62 6c 65 0a 20 20 20  |oad a double.   |
000009e0  20 53 54 46 45 20 46 32  2c 5b 52 31 2c 23 30 5d  | STFE F2,[R1,#0]|
000009f0  20 20 20 20 20 20 53 74  6f 72 65 20 61 74 20 52  |      Store at R|
00000a00  31 20 6c 6f 63 61 74 69  6f 6e 0a 20 20 20 20 4c  |1 location.    L|
00000a10  44 46 53 20 46 34 2c 5b  52 32 5d 2c 23 38 20 20  |DFS F4,[R2],#8  |
00000a20  20 20 20 20 6c 6f 61 64  20 64 6f 75 62 6c 65 20  |    load double |
00000a30  66 72 6f 6d 20 52 32 2c  20 74 68 65 6e 20 62 75  |from R2, then bu|
00000a40  6d 70 20 52 32 20 70 61  73 74 20 64 6f 75 62 6c  |mp R2 past doubl|
00000a50  65 0a 0a 42 69 6e 61 72  79 20 4f 70 73 3a 0a 62  |e..Binary Ops:.b|
00000a60  69 6e 6f 70 3c 63 6f 6e  64 3e 70 72 65 63 20 46  |inop<cond>prec F|
00000a70  64 2c 46 6e 2c 46 6d 7c  23 76 61 6c 75 65 0a 0a  |d,Fn,Fm|#value..|
00000a80  77 68 65 72 65 20 62 69  6e 6f 70 20 63 61 6e 20  |where binop can |
00000a90  62 65 3a 0a 41 44 46 20  20 41 64 64 20 20 20 20  |be:.ADF  Add    |
00000aa0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 46 64  |              Fd|
00000ab0  3d 46 6e 2b 46 6d 0a 4d  55 46 20 20 4d 75 6c 74  |=Fn+Fm.MUF  Mult|
00000ac0  69 70 6c 79 20 20 20 20  20 20 20 20 20 20 20 20  |iply            |
00000ad0  20 46 64 3d 46 6e 2a 46  6d 0a 53 55 46 20 20 53  | Fd=Fn*Fm.SUF  S|
00000ae0  75 62 74 72 61 63 74 20  20 20 20 20 20 20 20 20  |ubtract         |
00000af0  20 20 20 20 46 64 3d 46  6e 2d 46 6d 0a 52 53 46  |    Fd=Fn-Fm.RSF|
00000b00  20 20 52 65 76 65 72 73  65 20 53 75 62 74 72 61  |  Reverse Subtra|
00000b10  63 74 20 20 20 20 20 46  64 3d 46 6d 2d 46 6e 0a  |ct     Fd=Fm-Fn.|
00000b20  44 56 46 20 20 44 69 76  69 64 65 20 20 20 20 20  |DVF  Divide     |
00000b30  20 20 20 20 20 20 20 20  20 20 46 64 3d 46 6e 2f  |          Fd=Fn/|
00000b40  46 6d 0a 52 44 46 20 20  52 65 76 65 72 73 65 20  |Fm.RDF  Reverse |
00000b50  44 69 76 69 64 65 20 20  20 20 20 20 20 46 64 3d  |Divide       Fd=|
00000b60  46 6d 2f 46 6e 0a 50 4f  57 20 20 50 6f 77 65 72  |Fm/Fn.POW  Power|
00000b70  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00000b80  46 64 3d 46 6e 20 74 6f  20 74 68 65 20 70 6f 77  |Fd=Fn to the pow|
00000b90  65 72 20 6f 66 20 46 6d  0a 52 50 57 20 20 52 65  |er of Fm.RPW  Re|
00000ba0  76 65 72 73 65 20 50 6f  77 65 72 20 20 20 20 20  |verse Power     |
00000bb0  20 20 20 46 64 3d 46 6d  20 74 6f 20 74 68 65 20  |   Fd=Fm to the |
00000bc0  70 6f 77 65 72 20 6f 66  20 46 6e 0a 52 4d 46 20  |power of Fn.RMF |
00000bd0  20 52 65 6d 61 69 6e 64  65 72 20 20 20 20 20 20  | Remainder      |
00000be0  20 20 20 20 20 20 46 64  3d 72 65 6d 61 69 6e 64  |      Fd=remaind|
00000bf0  65 72 20 6f 66 20 46 6e  2f 46 6d 0a 46 4d 4c 20  |er of Fn/Fm.FML |
00000c00  20 46 61 73 74 20 6d 75  6c 74 69 70 6c 79 20 20  | Fast multiply  |
00000c10  20 20 20 20 20 20 46 64  3d 46 6e 2a 46 6d 0a 46  |      Fd=Fn*Fm.F|
00000c20  44 56 20 20 46 61 73 74  20 64 69 76 69 64 65 20  |DV  Fast divide |
00000c30  20 20 20 20 20 20 20 20  20 46 64 3d 46 6e 2f 46  |         Fd=Fn/F|
00000c40  6d 0a 46 52 44 20 20 46  61 73 74 20 72 65 76 65  |m.FRD  Fast reve|
00000c50  72 73 65 20 64 69 76 69  64 65 20 20 46 64 3d 46  |rse divide  Fd=F|
00000c60  6d 2f 46 6e 0a 50 4f 4c  20 20 50 6f 6c 61 72 20  |m/Fn.POL  Polar |
00000c70  41 6e 67 6c 65 20 20 20  20 20 20 20 20 20 20 46  |Angle          F|
00000c80  64 3d 70 6f 6c 61 72 20  61 6e 67 6c 65 20 6f 66  |d=polar angle of|
00000c90  28 46 6e 2c 46 6d 29 0a  0a 54 68 65 20 66 61 73  |(Fn,Fm)..The fas|
00000ca0  74 20 69 6e 73 74 72 75  63 74 69 6f 6e 73 20 63  |t instructions c|
00000cb0  6f 6d 70 75 74 65 20 74  6f 20 73 69 6e 67 6c 65  |ompute to single|
00000cc0  20 70 72 65 63 69 73 69  6f 6e 20 6f 6e 6c 79 2e  | precision only.|
00000cd0  0a 0a 76 61 6c 75 65 20  63 61 6e 20 62 65 20 30  |..value can be 0|
00000ce0  2e 35 2c 20 30 2c 20 31  2c 20 32 2c 20 33 2c 20  |.5, 0, 1, 2, 3, |
00000cf0  34 2c 20 35 20 6f 72 20  31 30 2e 0a 65 67 2e 20  |4, 5 or 10..eg. |
00000d00  41 44 46 20 46 37 2c 46  34 2c 46 35 0a 20 20 20  |ADF F7,F4,F5.   |
00000d10  20 41 44 46 20 46 33 2c  46 32 2c 23 32 0a 0a 55  | ADF F3,F2,#2..U|
00000d20  6e 61 72 79 20 4f 70 73  3a 0a 75 6e 79 6f 70 3c  |nary Ops:.unyop<|
00000d30  63 6f 6e 64 3e 70 72 65  63 20 46 64 2c 46 6d 7c  |cond>prec Fd,Fm||
00000d40  23 76 61 6c 75 65 0a 0a  77 68 65 72 65 20 75 6e  |#value..where un|
00000d50  79 6f 70 20 63 61 6e 20  62 65 3a 0a 4d 56 46 20  |yop can be:.MVF |
00000d60  20 4d 6f 76 65 20 20 20  20 20 20 20 20 20 20 20  | Move           |
00000d70  20 20 20 20 20 20 46 64  3d 46 6d 0a 4d 4e 46 20  |      Fd=Fm.MNF |
00000d80  20 4d 6f 76 65 20 6e 65  67 61 74 65 64 20 20 20  | Move negated   |
00000d90  20 20 20 20 20 20 46 64  3d 2d 46 6d 0a 41 42 53  |      Fd=-Fm.ABS|
00000da0  20 20 41 62 73 6f 6c 75  74 65 20 20 20 20 20 20  |  Absolute      |
00000db0  20 20 20 20 20 20 20 46  64 3d 41 42 53 28 46 6d  |       Fd=ABS(Fm|
00000dc0  29 0a 52 4e 44 20 20 52  6f 75 6e 64 20 74 6f 20  |).RND  Round to |
00000dd0  69 6e 74 65 67 72 61 6c  20 20 20 20 46 64 3d 69  |integral    Fd=i|
00000de0  6e 74 65 67 65 72 20 76  61 6c 75 65 20 6f 66 20  |nteger value of |
00000df0  46 6d 0a 53 51 54 20 20  53 71 75 61 72 65 20 72  |Fm.SQT  Square r|
00000e00  6f 6f 74 20 20 20 20 20  20 20 20 20 20 46 64 3d  |oot          Fd=|
00000e10  73 71 75 61 72 65 20 72  6f 6f 74 20 6f 66 20 46  |square root of F|
00000e20  6d 0a 4c 4f 47 20 20 4c  6f 67 61 72 69 74 68 6d  |m.LOG  Logarithm|
00000e30  20 62 61 73 65 20 31 30  20 20 20 20 46 64 3d 6c  | base 10    Fd=l|
00000e40  6f 67 31 30 20 6f 66 20  46 6d 0a 4c 47 4e 20 20  |og10 of Fm.LGN  |
00000e50  4c 6f 67 61 72 69 74 68  6d 20 62 61 73 65 20 65  |Logarithm base e|
00000e60  20 20 20 20 20 46 64 3d  6c 6f 67 65 20 6f 66 20  |     Fd=loge of |
00000e70  46 6d 0a 45 58 50 20 20  45 78 70 6f 6e 65 6e 74  |Fm.EXP  Exponent|
00000e80  20 20 20 20 20 20 20 20  20 20 20 20 20 46 64 3d  |             Fd=|
00000e90  65 20 74 6f 20 74 68 65  20 70 6f 77 65 72 20 6f  |e to the power o|
00000ea0  66 20 46 6d 0a 53 49 4e  20 20 53 69 6e 65 20 20  |f Fm.SIN  Sine  |
00000eb0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 46  |               F|
00000ec0  64 3d 73 69 6e 65 20 6f  66 20 46 6d 0a 43 4f 53  |d=sine of Fm.COS|
00000ed0  20 20 43 6f 73 69 6e 65  20 20 20 20 20 20 20 20  |  Cosine        |
00000ee0  20 20 20 20 20 20 20 46  64 3d 63 6f 73 69 6e 65  |       Fd=cosine|
00000ef0  20 6f 66 20 46 6d 0a 54  41 4e 20 20 54 61 6e 67  | of Fm.TAN  Tang|
00000f00  65 6e 74 20 20 20 20 20  20 20 20 20 20 20 20 20  |ent             |
00000f10  20 46 64 3d 74 61 6e 67  65 6e 74 20 6f 66 20 46  | Fd=tangent of F|
00000f20  6d 0a 41 53 4e 20 20 41  72 63 20 73 69 6e 65 20  |m.ASN  Arc sine |
00000f30  20 20 20 20 20 20 20 20  20 20 20 20 46 64 3d 61  |            Fd=a|
00000f40  72 63 73 69 6e 65 20 6f  66 20 46 6d 0a 41 43 53  |rcsine of Fm.ACS|
00000f50  20 20 41 72 63 20 63 6f  73 69 6e 65 20 20 20 20  |  Arc cosine    |
00000f60  20 20 20 20 20 20 20 46  64 3d 61 72 63 63 6f 73  |       Fd=arccos|
00000f70  69 6e 65 20 6f 66 20 46  6d 0a 41 54 4e 20 20 41  |ine of Fm.ATN  A|
00000f80  72 63 20 74 61 6e 67 65  6e 74 20 20 20 20 20 20  |rc tangent      |
00000f90  20 20 20 20 46 64 3d 61  72 63 74 61 6e 67 65 6e  |    Fd=arctangen|
00000fa0  74 20 6f 66 20 46 6d 0a  0a 65 67 2e 20 4d 56 46  |t of Fm..eg. MVF|
00000fb0  20 46 30 2c 23 30 20 20  20 20 20 20 5a 65 72 6f  | F0,#0      Zero|
00000fc0  69 73 65 20 66 6c 6f 61  74 20 72 65 67 69 73 74  |ise float regist|
00000fd0  65 72 0a 0a 52 65 67 69  73 74 65 72 20 54 72 61  |er..Register Tra|
00000fe0  6e 73 66 65 72 3a 0a 46  4c 54 3c 63 6f 6e 64 3e  |nsfer:.FLT<cond>|
00000ff0  70 72 65 63 20 46 6e 2c  52 64 20 20 20 20 20 20  |prec Fn,Rd      |
00001000  20 49 6e 74 65 67 65 72  20 74 6f 20 66 6c 6f 61  | Integer to floa|
00001010  74 69 6e 67 20 70 6f 69  6e 74 0a 46 49 58 3c 63  |ting point.FIX<c|
00001020  6f 6e 64 3e 70 72 65 63  20 52 64 2c 46 6d 20 20  |ond>prec Rd,Fm  |
00001030  20 20 20 20 20 46 6c 6f  61 74 69 6e 67 20 70 6f  |     Floating po|
00001040  69 6e 74 20 74 6f 20 69  6e 74 65 67 65 72 0a 57  |int to integer.W|
00001050  46 53 3c 63 6f 6e 64 3e  20 20 20 20 20 52 64 20  |FS<cond>     Rd |
00001060  20 20 20 20 20 20 20 20  20 77 72 69 74 65 20 66  |         write f|
00001070  6c 6f 61 74 69 6e 67 20  70 6f 69 6e 74 20 73 74  |loating point st|
00001080  61 74 75 73 0a 52 46 53  3c 63 6f 6e 64 3e 20 20  |atus.RFS<cond>  |
00001090  20 20 20 52 64 20 20 20  20 20 20 20 20 20 20 72  |   Rd          r|
000010a0  65 61 64 20 66 6c 6f 61  74 69 6e 67 20 70 6f 69  |ead floating poi|
000010b0  6e 74 20 73 74 61 74 75  73 0a 57 46 43 3c 63 6f  |nt status.WFC<co|
000010c0  6e 64 3e 20 20 20 20 20  52 64 20 20 20 20 20 20  |nd>     Rd      |
000010d0  20 20 20 20 77 72 69 74  65 20 66 6c 6f 61 74 69  |    write floati|
000010e0  6e 67 20 70 6f 69 6e 74  20 63 6f 6e 74 72 6f 6c  |ng point control|
000010f0  0a 52 46 43 3c 63 6f 6e  64 3e 20 20 20 20 20 52  |.RFC<cond>     R|
00001100  64 20 20 20 20 20 20 20  20 20 20 72 65 61 64 20  |d          read |
00001110  66 6c 6f 61 74 69 6e 67  20 70 6f 69 6e 74 20 63  |floating point c|
00001120  6f 6e 74 72 6f 6c 0a 0a  52 65 66 65 72 20 74 6f  |ontrol..Refer to|
00001130  20 74 68 65 20 50 52 4d  20 66 6f 72 20 74 68 65  | the PRM for the|
00001140  20 66 6c 6f 61 74 69 6e  67 20 70 6f 69 6e 74 20  | floating point |
00001150  73 74 61 74 75 73 20 62  69 74 20 73 65 74 74 69  |status bit setti|
00001160  6e 67 73 2e 0a 4e 62 2e  20 2a 4d 45 4d 4f 52 59  |ngs..Nb. *MEMORY|
00001170  49 20 69 6e 63 6f 72 72  65 63 74 6c 79 20 64 69  |I incorrectly di|
00001180  73 2d 61 73 73 65 6d 62  6c 65 73 20 74 68 65 20  |s-assembles the |
00001190  46 4c 54 20 46 6e 20 6f  70 65 72 61 6e 64 2e 0a  |FLT Fn operand..|
000011a0  0a 53 74 61 74 75 73 20  54 72 61 6e 73 66 65 72  |.Status Transfer|
000011b0  3a 0a 43 4d 46 3c 63 6f  6e 64 3e 70 72 65 63 20  |:.CMF<cond>prec |
000011c0  46 6e 2c 46 6d 7c 23 76  61 6c 75 65 20 20 20 63  |Fn,Fm|#value   c|
000011d0  6f 6d 70 61 72 65 20 46  6e 20 77 69 74 68 20 46  |ompare Fn with F|
000011e0  6d 0a 43 4e 46 3c 63 6f  6e 64 3e 70 72 65 63 20  |m.CNF<cond>prec |
000011f0  46 6e 2c 46 6d 7c 23 76  61 6c 75 65 20 20 20 63  |Fn,Fm|#value   c|
00001200  6f 6d 70 61 72 65 20 46  6e 20 77 69 74 68 20 2d  |ompare Fn with -|
00001210  46 6d 0a 43 4d 45 3c 63  6f 6e 64 3e 70 72 65 63  |Fm.CME<cond>prec|
00001220  20 46 6e 2c 46 6d 7c 23  76 61 6c 75 65 20 20 20  | Fn,Fm|#value   |
00001230  63 6f 6d 70 61 72 65 20  77 69 74 68 20 65 78 63  |compare with exc|
00001240  65 70 74 69 6f 6e 0a 43  4e 45 3c 63 6f 6e 64 3e  |eption.CNE<cond>|
00001250  70 72 65 63 20 46 6e 2c  46 6d 7c 23 76 61 6c 75  |prec Fn,Fm|#valu|
00001260  65 20 20 20 63 6f 6d 70  61 72 65 20 6e 65 67 61  |e   compare nega|
00001270  74 65 64 20 77 69 74 68  20 65 78 63 65 70 74 69  |ted with excepti|
00001280  6f 6e 0a 0a 55 73 65 20  74 68 65 20 73 74 61 6e  |on..Use the stan|
00001290  64 61 72 64 20 62 72 61  6e 63 68 65 73 20 61 66  |dard branches af|
000012a0  74 65 72 20 63 6f 6d 70  61 72 65 73 2e 20 41 63  |ter compares. Ac|
000012b0  6f 72 6e 20 72 65 63 6f  6d 6d 65 6e 64 73 20 74  |orn recommends t|
000012c0  68 65 20 75 73 65 20 6f  66 0a 43 4d 46 2f 43 4e  |he use of.CMF/CN|
000012d0  46 20 77 69 74 68 20 42  45 51 2f 42 4e 45 2c 20  |F with BEQ/BNE, |
000012e0  61 6e 64 20 43 4d 45 2f  43 4e 45 20 66 6f 72 20  |and CME/CNE for |
000012f0  6f 74 68 65 72 73 20 28  42 47 45 2f 42 47 54 2f  |others (BGE/BGT/|
00001300  42 4c 54 2f 42 4c 45 29  2e 0a 4e 62 2e 20 54 68  |BLT/BLE)..Nb. Th|
00001310  65 20 50 52 4d 20 69 6e  63 6f 72 72 65 63 74 6c  |e PRM incorrectl|
00001320  79 20 64 69 73 70 6c 61  79 73 20 74 68 65 20 6f  |y displays the o|
00001330  70 65 72 61 6e 64 73 20  61 73 20 46 6d 2c 46 6e  |perands as Fm,Fn|
00001340  2e 0a 0a 43 6f 6e 73 74  61 6e 74 73 0a 2d 2d 2d  |...Constants.---|
00001350  2d 2d 2d 2d 2d 2d 0a 44  46 53 20 6e 75 6d 62 65  |------.DFS numbe|
00001360  72 20 20 20 44 65 66 69  6e 65 20 61 20 73 69 6e  |r   Define a sin|
00001370  67 6c 65 20 70 72 65 63  69 73 69 6f 6e 20 63 6f  |gle precision co|
00001380  6e 73 74 61 6e 74 20 2d  20 34 20 62 79 74 65 73  |nstant - 4 bytes|
00001390  0a 44 46 44 20 6e 75 6d  62 65 72 20 20 20 44 65  |.DFD number   De|
000013a0  66 69 6e 65 20 61 20 64  6f 75 62 6c 65 20 70 72  |fine a double pr|
000013b0  65 63 69 73 69 6f 6e 20  63 6f 6e 73 74 61 6e 74  |ecision constant|
000013c0  20 2d 20 38 20 62 79 74  65 73 0a 44 46 45 20 6e  | - 8 bytes.DFE n|
000013d0  75 6d 62 65 72 20 20 20  44 65 66 69 6e 65 20 61  |umber   Define a|
000013e0  6e 20 65 78 74 65 6e 64  65 64 20 70 72 65 63 69  |n extended preci|
000013f0  73 69 6f 6e 20 63 6f 6e  73 74 61 6e 74 20 2d 20  |sion constant - |
00001400  31 32 20 62 79 74 65 73  0a 44 46 50 20 6e 75 6d  |12 bytes.DFP num|
00001410  62 65 72 20 20 20 44 65  66 69 6e 65 20 61 20 63  |ber   Define a c|
00001420  6f 6e 73 74 61 6e 74 20  69 6e 20 70 61 63 6b 65  |onstant in packe|
00001430  64 20 66 6f 72 6d 61 74  20 2d 20 31 32 20 62 79  |d format - 12 by|
00001440  74 65 73 0a 0a 43 6f 6e  76 65 72 73 69 6f 6e 20  |tes..Conversion |
00001450  52 6f 75 74 69 6e 65 73  0a 2d 2d 2d 2d 2d 2d 2d  |Routines.-------|
00001460  2d 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 2d 0a 54 77 6f  |------------.Two|
00001470  20 63 6f 6e 76 65 72 73  69 6f 6e 20 72 6f 75 74  | conversion rout|
00001480  69 6e 65 73 20 61 72 65  20 70 72 6f 76 69 64 65  |ines are provide|
00001490  64 20 77 68 69 63 68 20  63 61 6e 20 62 65 20 61  |d which can be a|
000014a0  73 73 65 6d 62 6c 65 64  20 69 6e 74 6f 20 79 6f  |ssembled into yo|
000014b0  75 72 0a 70 72 6f 67 72  61 6d 2e 0a 0a 50 52 4f  |ur.program...PRO|
000014c0  43 73 74 72 74 6f 66 70  28 61 64 64 72 25 29 20  |Cstrtofp(addr%) |
000014d0  41 73 73 65 6d 62 6c 65  73 20 61 20 73 74 72 69  |Assembles a stri|
000014e0  6e 67 20 74 6f 20 66 6c  6f 61 74 20 72 6f 75 74  |ng to float rout|
000014f0  69 6e 65 20 61 74 20 6c  6f 63 61 74 69 6f 6e 20  |ine at location |
00001500  61 64 64 72 25 0a 50 52  4f 43 66 70 74 6f 73 74  |addr%.PROCfptost|
00001510  72 28 61 64 64 72 25 29  20 41 73 73 65 6d 62 6c  |r(addr%) Assembl|
00001520  65 73 20 61 20 66 6c 6f  61 74 20 74 6f 20 73 74  |es a float to st|
00001530  72 69 6e 67 20 72 6f 75  74 69 6e 65 20 61 74 20  |ring routine at |
00001540  6c 6f 63 61 74 69 6f 6e  20 61 64 64 72 25 0a 0a  |location addr%..|
00001550  33 30 30 20 62 79 74 65  73 20 61 72 65 20 72 65  |300 bytes are re|
00001560  71 75 69 72 65 64 20 74  6f 20 61 73 73 65 6d 62  |quired to assemb|
00001570  6c 65 20 65 61 63 68 20  72 6f 75 74 69 6e 65 20  |le each routine |
00001580  61 74 20 74 68 65 20 61  64 64 72 65 73 73 20 70  |at the address p|
00001590  72 6f 76 69 64 65 64 2e  0a 0a 73 74 72 69 6e 67  |rovided...string|
000015a0  5f 74 6f 5f 66 6c 6f 61  74 3a 20 63 61 6c 6c 20  |_to_float: call |
000015b0  74 68 69 73 20 72 6f 75  74 69 6e 65 20 74 6f 20  |this routine to |
000015c0  63 6f 6e 76 65 72 74 20  61 6e 20 41 53 43 49 49  |convert an ASCII|
000015d0  20 6e 75 6d 62 65 72 20  74 6f 20 61 20 66 6c 6f  | number to a flo|
000015e0  61 74 2e 0a 54 68 65 20  6e 75 6d 62 65 72 20 63  |at..The number c|
000015f0  61 6e 20 68 61 76 65 20  6c 65 61 64 69 6e 67 20  |an have leading |
00001600  73 70 61 63 65 73 2c 20  61 6e 64 20 6d 61 79 20  |spaces, and may |
00001610  62 65 20 69 6e 20 73 74  61 6e 64 61 72 64 20 28  |be in standard (|
00001620  31 32 33 34 2e 35 36 37  38 29 20 6f 72 0a 73 63  |1234.5678) or.sc|
00001630  69 65 6e 74 69 66 69 63  20 66 6f 72 6d 61 74 20  |ientific format |
00001640  28 31 2e 32 33 65 32 34  29 2e 20 4e 6f 20 63 68  |(1.23e24). No ch|
00001650  65 63 6b 20 69 73 20 6d  61 64 65 20 66 6f 72 20  |eck is made for |
00001660  69 6e 76 61 6c 69 64 20  6e 75 6d 62 65 72 73 20  |invalid numbers |
00001670  28 69 65 2e 20 74 6f 6f  0a 62 69 67 29 2e 20 4f  |(ie. too.big). O|
00001680  6e 20 65 6e 74 72 79 20  74 6f 20 74 68 65 20 72  |n entry to the r|
00001690  6f 75 74 69 6e 65 20 72  65 67 69 73 74 65 72 73  |outine registers|
000016a0  20 6d 75 73 74 20 62 65  3a 0a 20 20 52 30 3a 20  | must be:.  R0: |
000016b0  61 64 64 72 65 73 73 20  6f 66 20 63 6f 6e 74 72  |address of contr|
000016c0  6f 6c 2d 74 65 72 6d 69  6e 61 74 65 64 20 6e 75  |ol-terminated nu|
000016d0  6d 65 72 69 63 20 73 74  72 69 6e 67 0a 20 20 52  |meric string.  R|
000016e0  31 3a 20 61 64 64 72 65  73 73 20 6f 66 20 74 61  |1: address of ta|
000016f0  72 67 65 74 20 63 6f 6e  76 65 72 74 65 64 20 6e  |rget converted n|
00001700  75 6d 62 65 72 20 28 34  2c 38 20 6f 72 20 31 32  |umber (4,8 or 12|
00001710  20 62 79 74 65 73 29 0a  20 20 52 32 3a 20 66 6c  | bytes).  R2: fl|
00001720  6f 61 74 20 74 79 70 65  3a 20 30 3d 53 69 6e 67  |oat type: 0=Sing|
00001730  6c 65 2c 20 31 3d 44 6f  75 62 6c 65 2c 20 32 3d  |le, 1=Double, 2=|
00001740  45 78 74 65 6e 64 65 64  2c 20 33 3d 50 61 63 6b  |Extended, 3=Pack|
00001750  65 64 0a 43 6f 6e 76 65  72 73 69 6f 6e 20 69 73  |ed.Conversion is|
00001760  20 74 65 72 6d 69 6e 61  74 65 64 20 61 73 20 73  | terminated as s|
00001770  6f 6f 6e 20 61 73 20 61  6e 20 69 6e 76 61 6c 69  |oon as an invali|
00001780  64 20 63 68 61 72 61 63  74 65 72 20 69 73 20 64  |d character is d|
00001790  65 74 65 63 74 65 64 2c  20 61 6e 64 0a 74 68 65  |etected, and.the|
000017a0  20 72 65 73 75 6c 74 20  73 6f 20 66 61 72 20 69  | result so far i|
000017b0  73 20 72 65 74 75 72 6e  65 64 2e 0a 0a 66 6c 6f  |s returned...flo|
000017c0  61 74 5f 74 6f 5f 73 74  72 69 6e 67 3a 20 63 61  |at_to_string: ca|
000017d0  6c 6c 20 74 68 69 73 20  72 6f 75 74 69 6e 65 20  |ll this routine |
000017e0  74 6f 20 63 6f 6e 76 65  72 74 20 61 20 66 6c 6f  |to convert a flo|
000017f0  61 74 20 69 6e 74 6f 20  41 53 43 49 49 20 66 6f  |at into ASCII fo|
00001800  72 6d 61 74 2e 20 54 68  65 0a 6e 75 6d 62 65 72  |rmat. The.number|
00001810  20 69 73 20 63 6f 6e 76  65 72 74 65 64 20 69 6e  | is converted in|
00001820  74 6f 20 73 63 69 65 6e  74 69 66 69 63 20 66 6f  |to scientific fo|
00001830  72 6d 61 74 20 77 69 74  68 20 31 36 20 64 65 63  |rmat with 16 dec|
00001840  69 6d 61 6c 20 70 6c 61  63 65 73 20 28 69 65 20  |imal places (ie |
00001850  31 37 0a 64 69 67 69 74  73 20 70 72 65 63 69 73  |17.digits precis|
00001860  69 6f 6e 29 2c 20 77 69  74 68 20 2b 2f 2d 20 73  |ion), with +/- s|
00001870  69 67 6e 73 20 61 73 20  72 65 71 75 69 72 65 64  |igns as required|
00001880  2e 20 52 65 67 69 73 74  65 72 73 20 6f 6e 20 65  |. Registers on e|
00001890  6e 74 72 79 20 73 68 6f  75 6c 64 20 62 65 3a 0a  |ntry should be:.|
000018a0  20 20 52 30 3a 20 61 64  64 72 65 73 73 20 6f 66  |  R0: address of|
000018b0  20 66 6c 6f 61 74 20 6e  75 6d 62 65 72 0a 20 20  | float number.  |
000018c0  52 31 3a 20 61 64 64 72  65 73 73 20 6f 66 20 63  |R1: address of c|
000018d0  6f 6e 76 65 72 74 65 64  20 73 74 72 69 6e 67 20  |onverted string |
000018e0  2d 20 32 36 20 62 79 74  65 73 20 61 72 65 20 72  |- 26 bytes are r|
000018f0  65 71 75 69 72 65 64 0a  20 20 52 32 3a 20 66 6c  |equired.  R2: fl|
00001900  6f 61 74 20 74 79 70 65  3a 20 30 3d 53 69 6e 67  |oat type: 0=Sing|
00001910  6c 65 2c 20 31 3d 44 6f  75 62 6c 65 2c 20 32 3d  |le, 1=Double, 2=|
00001920  45 78 74 65 6e 64 65 64  2c 20 33 3d 50 61 63 6b  |Extended, 3=Pack|
00001930  65 64 0a 0a 2d 2d 2d 2d  2d 2d 2d 2d 2d 2d 2d 2d  |ed..------------|
00001940  2d 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 2d 2d 2d 2d 2d  |----------------|
*
00001980  2d 0a 4d 69 6b 65 20 43  75 72 6e 6f 77 2c 0a 32  |-.Mike Curnow,.2|
00001990  32 2f 30 37 2f 39 31                              |2/07/91|
00001997