MIAMEX 9: Output hex or octal number

xcall MIAMEX, MX_OCVT, number, size, flags {,string}

Symbol

Value

Description

OT_ZER

&h0001

Disable leading zero blanking

OT_TRM

&h0002

Output to terminal

OT_MEM

&h0004

Output to memory

OT_LSP

&h0010

Output leading space

OT_TSP

&h0020

Output trailing space

OT_OCT

&h0040

Force output in octal

OT_HEX

&h0080

Force output in hex

Definition file: ashell.def

Hex-Decimal Values

 

This operation is the functional equivalent of the AMOS OCVT monitor call, and is used to output the number in number formatted in either octal or hexadecimal. The default radix used for output (if neither OT_OCT nor OT_HEX is specified) is that set and monitored with MX_GETHEX and MX_SETHEX. The size parameter determines the number of digits in the output result. A zero specifies a floating format in which the number of digits used is just enough to fully contain the result. A non-zero size specifies a fixed number of digits for the result with leading zeros being replaced by blanks. In either case at least one non-blank character will always be output.

The flags parameter is used to determine exactly how the numeric value is to be formatted. It is bitmapped, and each bit may be set by adding together the symbolic values defined in the include file ashell.def.

The OT_ZER bit disables leading zero blanking. In other words, when a non-zero number is to be printed, leading blanks are converted into spaces. The OT_TRM bit should always be specified, and is included for compatibility reasons. The OT_LSP and OT_TSP bits output an additional leading space and trailing space respectively.

The OT_MEM bit indicates that the output is to be stored in memory (and not output directly to the terminal). If this bit is specified, then the fifth parameter (String) must be present, which is a string or unformatted variable into which the formatted numerical output is returned.

See the wrapper functions Fn'Dec2Hex$(decval,flags,width) and Fn'Hex2Dec(hex$) in the SOSLIB:[907,10].

History

2016 June, A-Shell 6.3.1516:  MX_OCVT now supports 48 bit values, up from 32. This is equivalent to 12 hex characters or 16 octal characters. Note that the standard Fn'Dec2Hex$() in SOSLIB[907,10] function has been updated accordingly.