fp.txt

来自「汇编编程艺术」· 文本 代码 · 共 745 行 · 第 1/2 页

TXT
745
字号


Routine:  ltof
--------------

Category:             Floating point Routine

Registers on entry:   DX:AX contains a signed 32-bit integer value

Registers on return:  None

Flags affected:       None

Example of Usage:
			mov	dx, word ptr val32+2
			mov	ax, word ptr val32
			ltof

Description:	LTOF converts the 32-bit signed integer in DX:AX to a
		floating point value, storing the result in the floating
		point accumuator.

Include:	stdlib.a or fp.a


Routine:  ftoi
--------------

Category:             Floating point Routine

Registers on entry:   None

Registers on return:  AX contains 16-bit signed integer

Flags affected:       Carry is set if conversion error occurs.

Example of Usage:
			ftoi
			puti		;Print AX as integer value


Description:	FTOI converts the floating point accumulator value to a
		16-bit signed integer and returns the result in AX.  If
		the floating point number will not fit in AX, FTOI returns
		with the carry flag set.

Include:	stdlib.a or fp.a


Routine:  ftou
--------------

Category:             Floating point Routine

Registers on entry:   None

Registers on return:  AX contains 16-bit unsigned integer

Flags affected:       Carry is set if conversion error occurs.

Example of Usage:
			ftou
			putu		;Print AX as an unsigned value


Description:	FTOU converts the floating point accumulator value to a
		16-bit unsigned integer and returns the result in AX.  If
		the floating point number will not fit in AX, FTOU returns
		with the carry flag set.

Include:	stdlib.a or fp.a


Routine:  ftol
--------------

Category:             Floating point Routine

Registers on entry:   None

Registers on return:  DX:AX contains a 32-bit signed integer

Flags affected:       Carry is set if conversion error occurs.

Example of Usage:
			ftol
			putl		;Print DX:AX as integer value


Description:	FTOL converts the floating point accumulator value to a
		32-bit signed integer and returns the result in DX:AX.  If
		the floating point number will not fit in DX:AX, FTOL returns
		with the carry flag set.

Include:	stdlib.a or fp.a


Routine:  ftoul
---------------

Category:             Floating point Routine

Registers on entry:   None

Registers on return:  DX:AX contains a 32-bit unsigned integer

Flags affected:       Carry is set if conversion error occurs.

Example of Usage:
			ftoul
			putul		;Print DX:AX as an integer value


Description:	FTOUL converts the floating point accumulator value to a
		32-bit unsigned integer and returns the result in DX:AX.  If
		the floating point number will not fit in DX:AX, FTOUL returns
		with the carry flag set.

Include:	stdlib.a or fp.a


Routine:  fpadd
---------------

Category:             Floating point Routine

Registers on entry:   None

Registers on return:  None

Flags affected:       None

Example of Usage:
			fpadd

Description:	FPADD adds the floating point operand to the floating point
		accumulator leaving the result in the floating point
		accumulator.

Include:	stdlib.a or fp.a


Routine:  fpsub
---------------

Category:             Floating point Routine

Registers on entry:   None

Registers on return:  None

Flags affected:       None

Example of Usage:
			fpsub

Description:	FPSUB subtracts the floating point operand from the floating
		point accumulator leaving the result in the floating point
		accumulator.

Include:	stdlib.a or fp.a


Routine:  fpcmp
---------------

Category:             Floating point Routine

Registers on entry:   None

Registers on return:  AX contains result of comparison.

Flags affected:       As appropriate for a comparison.  You can use the
		      conditional branches to check the comparison after
		      calling this routine.  Be sure to use the *signed*
		      conditional jumps (e.g., JG, JGE, etc.).

Example of Usage:
			fpcmp
			jge	FPACCgeFPOP

Description:	FPCMP compares the floating point accumulator to the
		floating point operand and sets the flags according to the
		result of the comparison.  It also returns a value in AX
		as follows:

			AX	Result
			-1	FPACC < FPOP
			 0	FPACC = FPOP
			 1	FPACC > FPOP

Include:	stdlib.a or fp.a


Routine:  fpmul
--------------

Category:             Floating point Routine

Registers on entry:   None

Registers on return:  None

Flags affected:       None

Example of Usage:
			fpmul

Description:	FPMUL multiplies the floating point accumulator by the floating
		point operand and leaves the result in the floating point
		accumulator.

Include:	stdlib.a or fp.a


Routine:  fpdiv
---------------

Category:             Floating point Routine

Registers on entry:   None

Registers on return:  None

Flags affected:       None

Example of Usage:
			fpdiv

Description:	FPDIV divides the floating point accumulator by the floating
		point operand and leaves the result in the floating point
		accumulator.

Include:	stdlib.a or fp.a


Routine:  ftoa (2,m)
--------------------

Category:             Floating point Routine

Registers on entry:   ES:DI points at buffer to hold result (ftoa/ftoa2 only)
		      AL- Field width for floating point value.
		      AH- Number of positions to the right of the dec pt.

Registers on return:  ES:DI points at beginning of string (ftoa/ftoam only)
		      ES:DI points at zero terminating byte (ftoa2 only)

Flags affected:       Carry is set if malloc error (ftoam only)

Example of Usage:
			mov	di, seg buffer
			mov	es, di
			lea	di, buffer
			mov	ah, 2		;Two digits after "."
			mov	al, 10		;Use a total of ten positions
			ftoa



Description:	FTOA (2,M) converts the value in the floating point accumulator
		to a string of characters which represent that value.  These
		routines use a decimal representation.  The value in AH is
		the number of digits to put after the decimal point, AL
		contains the total field width (including room for the sign
		and decimal point).  The field width specification works
		just like Pascal or FORTRAN.  If the number will not fit in
		the specified field width, FTOA outputs a bunch of "#"
		characters.

		FTOA stores the converted string at the address specified by
		ES:DI upon entry.  There must be at least AL+1 bytes at this
		address.  It returns with ES:DI pointing at the start of this
		buffer.

		FTOA2 works just like FTOA except it does not preserve DI.
		It returns with DI pointing at the zero terminating byte.

		FTOAM allocates storage for the string on the heap and returns
		a pointer to the converted string in ES:DI.

		Note: this routine preserves the value in the floating point
		accumulator but it wipes out the value in the floating point
		operand.

Include:	stdlib.a or fp.a


Routine:  etoa (2,m)
--------------------

Category:             Floating point Routine

Registers on entry:   ES:DI points at buffer to hold result (etoa/etoa2 only)
		      AL- Field width for floating point value.

Registers on return:  ES:DI points at beginning of string (etoa/etoam only)
		      ES:DI points at zero terminating byte (etoa2 only)

Flags affected:       Carry is set if malloc error (etoam only)

Example of Usage:
			mov	al, 14		;Use a total of 14 positions
			etoam
			puts
			putcr
			free



Description:	ETOA (2,M) converts the value in the floating point accumulator
		to a string of characters which represent that value.  These
		routines use an exponential (scientific notation)
		representation.  AL contains the field width.  It contains
		the number of print position to use when outputting the
		number.  The field width specification works just like Pascal
		or FORTRAN.  If the number will not fit in the specified
		field width, ETOA outputs a bunch of "#" characters.

		ETOA stores the converted string at the address specified by
		ES:DI upon entry.  There must be at least AL+1 bytes at this
		address.  It returns with ES:DI pointing at the start of this
		buffer.

		ETOA2 works just like ETOA except it does not preserve DI.
		It returns with DI pointing at the zero terminating byte.

		ETOAM allocates storage for the string on the heap and returns
		a pointer to the converted string in ES:DI.

		Note: this routine preserves the value in the floating point
		accumulator but it wipes out the value in the floating point
		operand.

Include:	stdlib.a or fp.a


Routine:  atof
--------------

Category:             Floating point Routine

Registers on entry:   ES:DI points at a string containing the representation
		      of a floating point number in ASCII form.

Registers on return:  None

Flags affected:       None

Example of Usage:
			les	di, FPStr
			atof


Description:    ATOF converts the string pointed at by ES:DI into a floating
		point value and leaves this value in the floating point
		accumulator.  Legal floating point values are described
		by the following regular expression:


		{" "}* {+ | -} ( ([0-9]+ {"." [0-9]*}) | ("." [0-9]+)}
				{(e | E) {+ | -} [0-9] {[0-9]*}}

 "{}" denote optional items.
 "|"  denotes OR.
 "()" groups items together.



Include:	stdlib.a or fp.a


⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?