The LazyBoy Library Manual - StrToByte

Part of the Strings group.

%imacro StrToByte 2-3
Prefers: AL, ES:DI
Prefers: AL, DI

Convert an ASCIIZ string to a 8-bit unsigned integer. The ASCIIZ can be a string representing a positive integer, hexadecimal or binary number.

A hexadecimal and binary numbers are caseless. A hex number starts with either 0x or simply x.

A binary number contains only 0 and 1 followed by a single b character.

If the value is negative, contains invalid characters or requires more than a byte, the Carry flag will be set to indicate the string could not be converted.

%2 is a pointer. If no segment is provided for %2, then ES is assumed. Unless %2 is a code label, then CS will be assumed.

If %3 is SIGNED or SINT, then the output will be a signed 8-bit integer and a ASCIIZ string that represents a negative number will be permitted. However the negative symbol is forbidden for strings using hexadecimal or binary representations. For those, the high bit will indicate a negative value. For example, 0x7f will be 127 and 0x80 will be -128.

Examples:

    StrToByte  al, di         ; convert string at es:di to an unsigned integer.
    StrToByte  al, ASTR       ; convert string at cs:ASTR to an unsigned integer.
    StrToByte  al, bx, sint   ; convert string at es:bx to an signed integer.