| Routines

3645: THE 'READ-IN' SUBROUTINE (offset +1A)

The address of this routine is found in the table of addresses. It is called indirectly via fp_calc_2. This subroutine is called via the calculator offset (+5A) through the first line of S_INKEY. It appears to provide for the reading in of data through different streams from those available on the standard Spectrum. Like S_INKEY the subroutine returns a string.
read_in | 3645 | CALL FIND_INT1 | The numerical parameter is compressed into the A register.
| 3648 | CP $10 | Is it smaller than 16?
| 364A | JP NC,REPORT_B_2 | If not, report the error.
| 364D | LD HL,($5C51) | The current channel address (CURCHL) is saved on the machine stack.
| 3650 | PUSH HL
| 3651 | CALL CHAN_OPEN | The channel specified by the parameter is opened.
| 3654 | CALL INPUT_AD | The signal is now accepted, like a 'key-value'.
| 3657 | LD BC,$0000 | The default length of the resulting string is zero.
| 365A | JR NC,R_I_STORE | Jump if there was no signal.
| 365C | INC C | Set the length to 1 now.
| 365D | RST $30 | Make a space in the work space.
| 365E | LD (DE),A | Put the string into it.
R_I_STORE | 365F | CALL STK_STO | Pass the parameters of the string to the calculator stack.
| 3662 | POP HL | Restore CURCHL and the appropriate flags.
| 3663 | CALL CHAN_FLAG
| 3666 | JP STK_PNTRS | Exit, setting the pointers.