qdosmsq:vectors:decfp

CN_DTOF.../CV_DECFP... - Vectors $100 to $10E

These vectors convert ASCII to floating point or integers.

QDOSSMSQVectorAction
CN_DTOFCV_DECFP$100Converts Decimal to Floating Point
CN_DTOICV_DECIW$102Converts Decimal to Integer
CN_BTOIBCV_BINIB$104Converts Binary to Integer (byte)
CN_BTOIWCV_BINIW$106Converts Binary to Integer (word)
CN_BTOILCV_BINIL$108Converts Binary to Integer (long)
CN_HTOIBCV_HEXIB$10AConverts Hexadecimal to Integer (byte)
CN_HTOIWCV_HEXIW$10CConverts Hexadecimal to Integer (word)
CN_HTOILCV_HEXIL$10EConverts Hexadecimal to Integer (long)

Parameters

Call ParametersReturn Parameters
D0.LUnused D0.LError code.
D1.LUnused D1.LCorrupted.
D2.LUnused D2.LCorrupted.
D3.LUnused D3.LCorrupted.
D7.L0 or pointer to buffer endD7.LPreserved.
A0.LPointer to buffer A0.LUpdated.
A1.LPointer to stack A1.LUpdated.
A2.LUnused A2.LCorrupted.
A3.LUnused A3.LCorrupted.
ERR_XPError in expression.
  • All registers not shown above are not used on entry and are preserved on exit.
  • The last character converted is that just before the first invalid one unless D7 is non zero and points to an earlier character in which case the last character converted is that just before the character to which D7 points.
  • At entry (A0,A6.L) points to the start of the ASCII characters.
  • After successful conversion (A0,A6.L) points to the character just after the last one converted.
  • At entry (A1,A6.L) points to the end of the buffer in which the result will be placed.
  • After successful conversion A1 will have been decremented by 1 for byte results, 2 for word results 4 for long results and 6 for floating point results. Hence (A1,A6.L) points to the result.
  • For the decimal conversions up to about 30 bytes of buffer space are used. For the others there should be at least four bytes available.
  • If there is an error neither A0 nor A1 is changed.
  • Only the first two of these vectors can be used with QDOS versions 1.03 or earlier.

The example below shows how to convert an ASCII decimal number to a word integer.

; It is assumed that A6 points to the data space and that the first
; 30 bytes are set as working space and for the answer with the 
; following bytes holding the number for conversion.

buf       equ     #30

convert   lea     buf,a0         ; Pointer to ASCII number
          lea     buf,a1         ; Pointer to the end of the buffer
          move.l  a0,d7          ; Set a maximum . .
          addq.l  #5,d7          ; . . of 5 characters
          movea.w CN_DTOI,a2     ; Vector address
          jsr     (a2)           ; Convert

; Now A1 = buf - 2 and (A1,A6.L) points to the converted number.
  • qdosmsq/vectors/decfp.txt
  • Last modified: 2009/02/14 11:58
  • by george.gwilt