Prev: 13484 Up: Map Next: 13500
13491: THE 'USR' FUNCTION (offset 45)
The address of this routine is found in the table of addresses. It is called indirectly via fp_calc_2.
This subroutine ('USR number' as distinct from 'USR string') handles the function USR X, where X is a number. The value of X is obtained in BC, a return address is stacked and the machine code is executed from location X.
Input
Output
usr_no 13491 CALL FIND_INT2 Evaluate the 'last value', rounded to the nearest integer; test that it is in range and return it in BC.
13494 LD HL,11563 Make the return address be that of the subroutine STACK_BC.
13497 PUSH HL
13498 PUSH BC Make an indirect jump to the required location.
13499 RET
Note: it is interesting that the IY register pair is re-initialised when the return to STACK_BC has been made, but the important HL' that holds the next literal pointer is not restored should it have been disturbed. For a successful return to BASIC, HL' must on exit from the machine code contain the address of the 'end-calc' instruction at 10072.
Prev: 13484 Up: Map Next: 13500