| Routines

35C9: THE 'CHR$' FUNCTION (offset +2F)

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 | 35C9 | CALL FP_TO_A | The 'last value' is compressed into the A register.
| 35CC | JR C,REPORT_B_4 | Give the error report if X is greater than 255, or X is a negative number.
| 35CE | JR NZ,REPORT_B_4
| 35D0 | PUSH AF | Save the compressed value of X.
| 35D1 | LD BC,$0001 | Make one space available in the work space.
| 35D4 | RST $30
| 35D5 | POP AF | Fetch the value.
| 35D6 | LD (DE),A | Copy the value to the work space.
| 35D7 | CALL STK_STO | Pass the parameters of the new string to the calculator stack.
| 35DA | EX DE,HL | Reset the pointers.
| 35DB | RET | Finished.
Report B - Integer out of range.
REPORT_B_4 | 35DC | RST $08 | Call the error handling routine.
| 35DD | DEFB $0A