| Routines

13929: THE 'CODE' FUNCTION (offset 28)

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 | 13929 | CALL STK_FETCH | The parameters of the string are fetched.
| 13932 | LD A,B | The length is tested and the A register holding zero is carried forward if A$ is a null string.
| 13933 | OR C
| 13934 | JR Z,STK_CODE
| 13936 | LD A,(DE) | The code of the first character is put into A otherwise.
STK_CODE | 13937 | JP STACK_A | The subroutine exits via STACK_A which gives the correct 'last value'.