Prev: 13790 Up: Map Next: 13893
13855: THE 'STR$' FUNCTION (offset 46)
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 STR$ X and returns a 'last value' which is a set of parameters that define a string containing what would appear on the screen if X were displayed by a PRINT command.
str 13855 LD BC,1 One space is made in the work space and its address is copied to K-CUR, the address of the cursor.
13858 RST 48
13859 LD (23643),HL
13862 PUSH HL This address is saved on the stack too.
13863 LD HL,(23633) The current channel address (CURCHL) is saved on the machine stack.
13866 PUSH HL
13867 LD A,255 Channel 'R' is opened, allowing the string to be 'printed' out into the work space.
13869 CALL CHAN_OPEN
13872 CALL PRINT_FP The 'last value', X, is now printed out in the work space and the work space is expanded with each character.
13875 POP HL Restore CURCHL to HL and restore the flags that are appropriate to it.
13876 CALL CHAN_FLAG
13879 POP DE Restore the start address of the string.
13880 LD HL,(23643) Now the cursor address is one past the end of the string and hence the difference is the length.
13883 AND A
13884 SBC HL,DE
13886 LD B,H Transfer the length to BC.
13887 LD C,L
13888 CALL STK_STO Pass the parameters of the new string to the calculator stack.
13891 EX DE,HL Reset the pointers.
13892 RET Finished.
Note: see PRINT_FP for an explanation of the 'PRINT "A"+STR$ 0.1' error.
Prev: 13790 Up: Map Next: 13893