Prev: 13491 Up: Map Next: 13545
13500: THE 'USR STRING' FUNCTION (offset 25)
The address of this routine is found in the table of addresses. It is called indirectly via fp_calc_2.
This subroutine handles the function USR X$, where X$ is a string. The subroutine returns in BC the address of the bit pattern for the user-defined graphic corresponding to X$. It reports error A if X$ is not a single letter between 'a' and 'u' or a user-defined graphic.
usr 13500 CALL STK_FETCH Fetch the parameters of the string X$.
13503 DEC BC Decrease the length by 1 to test it.
13504 LD A,B If the length was not 1, then jump to give error report A.
13505 OR C
13508 LD A,(DE) Fetch the single code of the string.
13509 CALL ALPHA Does it denote a letter?
13512 JR C,USR_RANGE If so, jump to gets its address.
13514 SUB 144 Reduce range for actual user-defined graphics to 0-20.
13516 JR C,REPORT_A Give report A if out of range.
13518 CP 21 Test the range again.
13520 JR NC,REPORT_A Give report A if out of range.
13522 INC A Make range of user-defined graphics 1 to 21, as for 'a' to 'u'.
USR_RANGE 13523 DEC A Now make the range 0 to 20 in each case.
13524 ADD A,A Multiply by 8 to get an offset for the address.
13525 ADD A,A
13526 ADD A,A
13527 CP 168 Test the range of the offset.
13529 JR NC,REPORT_A Give report A if out of range.
13531 LD BC,(23675) Fetch the address of the first user-defined graphic (UDG) in BC.
13535 ADD A,C Add C to the offset.
13536 LD C,A Store the result back in C.
13537 JR NC,USR_STACK Jump if there is no carry.
13539 INC B Increment B to complete the address.
USR_STACK 13540 JP STACK_BC Jump to stack the address.
Report A - Invalid argument.
REPORT_A 13543 RST 8 Call the error handling routine.
13544 DEFB 9
Prev: 13491 Up: Map Next: 13545