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

Link to this comparison view

Both sides previous revision Previous revision
qdosmsq:vectors:fpdec [2014/05/09 15:14]
george.gwilt Expand on the output from CN_FTOD/CV_FPDEC
qdosmsq:vectors:fpdec [2014/06/08 14:54] (current)
george.gwilt D1 to D1.L in the second note
Line 1: Line 1:
 +====== CN_FTOD.../CV_FPDEC... - Vectors $F0 to $FE ======
 +These vectors convert a value to which (A1,A6.L) points to ASCII characters in a buffer to which (A0,A6.L) points.
 +=== List of Vectors ===
 +|CN_FTOD|CV_FPDEC|$F0|Convert Floating Point to Decimal|
 +|CN_ITOD|CV_IWDEC|$F2|Convert word to Decimal|
 +|CN_ITOBB|CV_IBBIN|$F4|Convert byte to Binary|
 +|CN_ITOBW|CV_IWBIN|$F6|Convert word to Binary|
 +|CN_ITOBL|CV_ILBIN|$F8|Convert long to Binary|
 +|CN_ITOHB|CV_IBHEX|$FA|Convert byte to Hexadecimal|
 +|CN_ITOHW|CV_IWHEX|$FC|Convert word to Hexadecimal|
 +|CN_ITOHL|CV_ILHEX|$FE|Convert long to Hexadecimal|
 +=== Parameters ===
 +^Call Parameters^^Return Parameters^^
 +|D0.L|Unused |D0.L|Corrupted.|
 +|D1.L|Unused |D1.L|Corrupted or length of answer|
 +|D2.L|Unused |D2.L|Corrupted.|
 +|D3.L|Unused |D3.L|Corrupted.|
 +|A0.L|Pointer to buffer |A0.L|Updated.|
 +|A1.L|Pointer to value |A1.L|Updated.|
 +|A2.L|Unused |A2.L|Corrupted.|
 +|A3.L|Unused |A3.L|Corrupted.|
 +===== Errors =====
 +No errors are returned by this vector call.
 +===== Notes =====
 +  * All registers not shown above are not used on entry and are preserved on exit.
 +  * On return D1.L contains the length of the answer for CN_FTOD/CV_FPDEC and CN_ITOD/CV_IWDEC but is otherwise corrupted.
 +  * On entry (A0,A6.L) points to a buffer to contain the ASCII answer. On return A0 is increased by the number of characters in the answer.
 +  * On entry (A1,A6.L) points to the value to be converted. On return A1 is increased by 1, 2, 4 or 6 depending on the length of the value (byte, word, long word or floating point).
 +  * The translation to ASCII performed by CN_FTOD/CV_FPDEC may not be obvious. Integers in floating point form become simply the ASCII integers. Thus 25 and -200 will be these two or four byte strings. However, more general floating point numbers may be shown in floating point format or, if possible, simply as decimal numbers. To illustrate this are three examples.
 +    * $0100146208E1 becomes 5.785646E-541 - length 13
 +    * $0800146208E1 becomes .1592418      - length 8
 +    * $0820146208E1 becomes 6.839382E8    - length 10
 +  * If too little space is allocated for the answers produced by CN_FTOD/CV_FPDEC this may cause a crash. If you expect all floating point numbers translated by CN_FTOD/CV_FPDEC to be positive integers less than 100 a two byte answer space should suffice. However, an error in the floating point form may cause the production of up to 13 bytes. One should beware of this.
 +===== Example =====
 +The example below shows how to convert a long word to hexadecimal.
 +; A6 points to data space.
 +; num(A6) points to the long word to be converted.
 +; buf(A6) points to a buffer to contain the answer.
 +num     equ     #26             ; Allows a stack of 30 bytes
 +buf     equ     #30             ; The buffer follows the value
 +Conv    lea     num,a1          ; Point to long word relative to A6.
 +        lea     buf,a0          ; Point to buffer relative to A6.
 +        movea.w CN_ITOHL,a2     ; Address of vector.
 + jsr (a2) ; Make the call
 +; Now the value is at buf(A6).
 +; A0 is buf + 8.
 +; A1 is num + 4.
  • qdosmsq/vectors/fpdec.txt
  • Last modified: 2014/06/08 14:54
  • by george.gwilt