| Routines

3669: THE 'CODE' FUNCTION (offset +1C)

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 CODE A$ and returns the Spectrum code of the first character in A$, or zero if A$ is null.
code | 3669 | CALL STK_FETCH | The parameters of the string are fetched.
| 366C | LD A,B | The length is tested and the A register holding zero is carried forward if A$ is a null string.
| 366D | OR C
| 366E | JR Z,STK_CODE
| 3670 | LD A,(DE) | The code of the first character is put into A otherwise.
STK_CODE | 3671 | JP STACK_A | The subroutine exits via STACK_A which gives the correct 'last value'.