| Routines

13769: THE 'CHR$' FUNCTION (offset 47)

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 CHR$ X and creates a single character string in the work space.
chrs | 13769 | CALL FP_TO_A | The 'last value' is compressed into the A register.
| 13772 | JR C,REPORT_B_4 | Give the error report if X is greater than 255, or X is a negative number.
| 13774 | JR NZ,REPORT_B_4
| 13776 | PUSH AF | Save the compressed value of X.
| 13777 | LD BC,1 | Make one space available in the work space.
| 13780 | RST 48
| 13781 | POP AF | Fetch the value.
| 13782 | LD (DE),A | Copy the value to the work space.
| 13783 | CALL STK_STO | Pass the parameters of the new string to the calculator stack.
| 13786 | EX DE,HL | Reset the pointers.
| 13787 | RET | Finished.
Report B - Integer out of range.
REPORT_B_4 | 13788 | RST 8 | Call the error handling routine.
| 13789 | DEFB 10