GN_Gdn, Convert an ASCII string to a binary integer number
Register parameters
RST 20H, DEFW $1009
IN:
HL = local source pointer
HL = 0, read from stream IX handle
HL = 1, read from filter IX handle
HL = 2, not allowed
> 255, read string at (HL)
DE = destination pointer.
DE = 0, 1 not allowed
DE = 2, return integer in BC (converted to 16bit
range)
> 255, store integer at (DE). (DE) = least
significant byte, (DE+3)= most significant byte.
B = maximum number of characters to be read
IX = source handle (if HL = 0,1)
OUT, if call successful:
Fc = 0
Fz = 1, conversion recognised a number
A = character which stopped conversion
HL, if HL(in) < 2, indexes conversion terminator
HL, if HL(in) > 255, then points to conversion terminator.
BC = result, if DE(in) = 2
OUT, if call failed:
Fc = 1
A = error code:
RC_OVF ($0B), overflow, result invalid
RC_EOF ($09), reading an empty stream or filter
Registers changed after return:
...DE../IXIY same
AFB..HL/.... different
Notes
Parsing will stop at the first non-decimal digit. If the source text was numeric by not supplied with a terminator, the routine will set Fz = 1 and exit with A=0 and Fc = 0.
Bugs
This call will fail if the source or destination pointers are in segment 2.
Related calls
GN_D16, 16bit unsigned division
GN_M16, 16bit unsigned multiplication
GN_D24, 24bit unsigned division
GN_M24, 24bit unsigned multiplication
GN_Pdn, write number as decimal ASCII string
, multiple selections available,