[an error occurred while processing this directive]

HP OpenVMS Systems

ask the wizard
Content starts here

Example of floating-point Macro32 calls?

» close window

The Question is:

 
hey Wiz: would you happen to have source code in vax macro assembly that
 converts input ascii string of a floating point to .f_floating format.
 


The Answer is :

There are numerous RTL routines for converting between text and various
floating point formats, all useable from any language. Here is one example
coded in MACRO32:
 
	.TITLE Text2F_FLOAT
	.PSECT data,RD,WRT,NOEXE
f_val:  .FLOAT
exten:  .BYTE	; extension bits return
string: .ASCID /123.456/
	.PSECT code,RD,NOWRT,EXE
	.ENTRY Start,^M<>
	PUSHAB	exten	; optional extension bits argument
	PUSHL   #0	; flags all clear (default)
	PUSHL   #0	; ignore scale factor
	PUSHL	#0	; digits in fraction (unnecessary)
	PUSHAF  f_val	; return F_FLOAT value
	PUSHAB  string	; input text string
	CALLS  #6, G^OTS$CVT_T_F
	RET
	.END Start
 
or, minimally:
 
	.TITLE Text2F_FLOAT
	.PSECT data,RD,WRT,NOEXE
f_val:  .FLOAT
string: .ASCID /123.456/
	.PSECT code,RD,NOWRT,EXE
	.ENTRY Start,^M<>
	PUSHAF  f_val	; return F_FLOAT value
	PUSHAB  string	; input text string
	CALLS  #2, G^OTS$CVT_T_F
	RET
	.END Start
 
See:
 
OpenVMS RTL General Purpose (OTS$) Manual
Order Number: AA--PV6HD--TK
 

answer written or last revised on ( 11-MAY-2003 )

» close window