|77h||UT$SPLT||find a token|
|Input||X register - Address of buffer to split
UTW_S0 - Length of buffer.
A register - Field separator character.
B register - Field number to be split out.
|Output||If field was found then
X register - Address of field.
|Description|| Finds the address and length of
a field in a buffer where the fields are separated by the character specified.
No separator character is expected at the end of the last field. The first
field has field number 0.
If the field does not exist within the buffer, then 0 is returned in the X register, and UTW_S0 holds the input field number minus the number of fields found in the buffer. That is, if the sixth field is required and the buffer contains only two fields, 4 will be returned in UTW_S0.
Code to find address and length of the sixth field in a 500-byte
buffer, with the separator character ':' between fields.
LDX #BUFFER LDD #500 ; length of BUFFER STD UTW_S0 LDAA #3Ah ; separator is a colon LDAB #5 ; 6th field has field number 5 OS UT$SPLT BCS NOT_FOUND ; C-flag set if not found FOUND: STD FIELD_LENGTH STX FIELD_ADDRESS
|Errors||- none -|