Reviewed and revised April 2024
xcall MIAMEX, MX_OCVT, number, size, flags {,strbuf}
MX_OCVT (MIAMEX 9) outputs a number in either hex or octal format.
Parameters
number (Unsigned Int) [in]
Number to display.
size (Unsigned Int) [in]
Width (number of digits) for the formatted display. If zero, the width will be set automatically to just enough to fit, plus a space. Otherwise the display is padded (with leading zeros to the specified width).
flags (Bitmap, 8 bits) [in]
Zero or more options from the following table.
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 |
strbuf (String) [out]
String variable to receive the formatted number if OT_MEM flag set. Otherwise this parameter can be omitted.
Comments
If neither OT_OCT nor OT_HEX set, it will use the current default radix. See MX_GETHEX, MX_SETHEX.
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.