qdosmsq:vectors:decfp

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

qdosmsq:vectors:decfp [2009/02/13 18:12]
george.gwilt created
qdosmsq:vectors:decfp [2009/02/14 11:58] (current)
george.gwilt Example added and some rewording
Line 1: Line 1:
 +
 ====== CN_DTOF.../​CV_DECFP... - Vectors $100 to $10E  ====== ====== CN_DTOF.../​CV_DECFP... - Vectors $100 to $10E  ======
  
 These vectors convert ASCII to floating point or integers. ​ These vectors convert ASCII to floating point or integers. ​
 +==== List of Vectors ====
 +^QDOS^SMSQ^Vector^Action^
 +|CN_DTOF|CV_DECFP|$100|Converts Decimal to Floating Point|
 +|CN_DTOI|CV_DECIW|$102|Converts Decimal to Integer|
 +|CN_BTOIB|CV_BINIB|$104|Converts Binary to Integer (byte)|
 +|CN_BTOIW|CV_BINIW|$106|Converts Binary to Integer (word)|
 +|CN_BTOIL|CV_BINIL|$108|Converts Binary to Integer (long)|
 +|CN_HTOIB|CV_HEXIB|$10A|Converts Hexadecimal to Integer (byte)|
 +|CN_HTOIW|CV_HEXIW|$10C|Converts Hexadecimal to Integer (word)|
 +|CN_HTOIL|CV_HEXIL|$10E|Converts Hexadecimal to Integer (long)|
 +
 +=== Parameters ===
  
 ^Call Parameters^^Return Parameters^^ ^Call Parameters^^Return Parameters^^
Line 14: Line 27:
 |A3.L|Unused |A3.L|Corrupted.| |A3.L|Unused |A3.L|Corrupted.|
  
-==== List of Vectors ==== +
-^QDOS^SMSQ^Vector^Action^ +
-|CN_DTOF|CV_DECFP|$100|Converts Decimal to Floating Point| +
-|CN_DTOI|CV_DECIW|$102|Converts Decimal to Integer| +
-|CN_BTOIB|CV_BINIB|$104|Converts Binary to Integer (byte)| +
-|CN_BTOIW|CV_BINIW|$106|Converts Binary to Integer (word)| +
-|CN_BTOIL|CV_BINIL|$108|Converts Binary to Integer (long)| +
-|CN_HTOIB|CV_HEXIB|$10A|Converts Hexadecimal to Integer (byte)| +
-|CN_HTOIW|CV_HEXIW|$10C|Converts Hexadecimal to Integer (word)| +
-|CN_HTOIL|CV_HEXIL|$10E|Converts Hexadecimal to Integer (long)|+
 ===== Errors ===== ===== Errors =====
 |ERR_XP|Error in expression.| |ERR_XP|Error in expression.|
Line 29: Line 33:
 ===== Notes ===== ===== Notes =====
   * All registers not shown above are not used on entry and are preserved on exit.   * All registers not shown above are not used on entry and are preserved on exit.
-  * If D7 is zero, the last character converted is that just before the first invalid one. Otherwise ​the last character converted is that just before the character to which D7 points. +  * 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 buffer containing ​the ASCII characters. +  * 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. Thus, if D7 is non zero A0 will become equal to D7.+  * 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.   * 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.   * 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 stack are used. For the others there should be at least four bytes available.+  * 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.   * 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.   * Only the first two of these vectors can be used with QDOS versions 1.03 or earlier.
  
 ===== Example ===== ===== Example =====
-The example below shows (//not written yet//).+The example below shows how to convert an ASCII decimal number to a word integer.
  
 <​code>​ <​code>​
 +; 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.
  
 </​code>​ </​code>​
  
  
  • qdosmsq/vectors/decfp.txt
  • Last modified: 2009/02/14 11:58
  • by george.gwilt