120 Communication Between BASIC and Assembly Language following the call. The substring is returned starting with the third word of the storage area. Exit Conditions: There are no error exits from the utility. It always returns to the instruction (Note: Since the second word contains the length of the substring, you have a string data structure starting with the second word!) For example - 1 ::::.'i: C i··,::;X·.:01.C!:. ,:::r ('j qi···!(:;1 .. ··e 'j ei···,(::i1:. h :;. 'r :--··::i/·: :::. f e i···· 1. i;;:i c h::l i·····ac t e r"' :::. I '::Di...ieCr:::: I ':::Ci...ii?CE: ISOURCE Pa~~ameter: 0TP LDB :::::P.:::U····.:;H{;!:::·t .:;,,!'" . .r:::;\·'l C;,::, '.' !.y: .. ,j:.
e~:;· first word, and 10 in the second, the first 10 bytes of the string would be transferred. Of course, In this example, Value is the storage area. Since 2 has already been generated and stored in the the original string must contain at least 10 characters - or the bytes which are returned may be nonsense. Why was the value 2 stored as the byte number? Because bytes in a string are numbered starting with 0, and bytes 0 and 1 contain the length of the string (see "Data Structures" in Chapter 3). UTILITY: Get_ elem _bytes General Procedure: This is a combination of the "Get_element" and "Get_bytes" utilities.
This utility retrieves a substring of an element of a string array passed as an argument. The utility is given the starting byte and the number of bytes to be retrieved. Special Requirements: The storage area set aside for the substring must be large enough to hold all of it. This includes not only the string itself, but also two extra words. Remember, a word holds two characters. The array information must be retrieved with the "Get_info" utility before calling this utility. The offset of the element in the array must be correct in the array information (word 16 returned by "Get_info").
It should be remembered that the offset of the element is dependent upon the number of dimensions in the array and the length of each. A calcula- tion may be necessary to arrive at the offset when accessing multiple-dimension arrays. The offset is in terms of number of elements.