Communication Between BASIC and Assembly Language 115 Special Requirements: The location where it is to store the information must be adequate to hold all that may be returned. For non-arrays, 3 words will suffice. For arrays, up to 30 words may be required aside a full 30 words . (as above). If you are writing a general routine, it may be wise to play it safe by setting • An argument must have been passed by the ICALL (in the case of parameters) or a corresponding BASIC COM declaration must exist (in the case of common declarations). Calling Procedure: 1. Load register A with the address of the storage area for the information to be returned. 2.
Load register B with the address of the parameter declaration corresponding to the desired argument. 3. Call the utility. Exit Conditions: There are no error exits from the utility. It always returns to the instruction following the JSM. Since there are no error exits, and there is no requirement that there be as many arguments as there are parameter declarations, an argument must actually have been passed by the ICALL in order for the utility to work correctly.
Following up on the example in the previous section, suppose the first thing that the Sort Get_info utility, it is possible to have the instructions look as follows - routine does is check to see if the first parameter passed is an array. Then, by using the '::::Cii..,iPCE :::OLij?C:E: SOURCE Ar~ay: HNY SOURCE Number: RE :::::Ui.JF:C:E :::::Oi.JRC:l::: C:F' =1.6 Is it = fi10 number~ fif~; .. ' '·::L >i t I. - I:: 1;;:~ ~ :~ :~; ::. .,;" Yes, indicate error 0 ':::;(}.JF.'CE ':::U.JF.:CE t·· ... : ~ 'i 1 1 1 ::J : i H • :::~. !" :' E' t H t-· c= ~"" ;::;