| Routines

11249: THE 'STK-FETCH' SUBROUTINE

Used by the routines at PROGNAME, SAVE_ETC, OPEN_2, VAR_A_1, PR_ITEM_1, SLICING, LET, usr, compare, strs_add, val, code and len. This important subroutine collects the 'last value' from the calculator stack. The five bytes can be either a floating-point number, in 'short' or 'long' form, or a set of parameters that define a string.
Output
A | First byte
B | Fifth byte
C | Fourth byte
D | Third byte
E | Second byte
STK_FETCH | 11249 | LD HL,(23653) | Get STKEND.
| 11252 | DEC HL | Back one.
| 11253 | LD B,(HL) | The fifth value.
| 11254 | DEC HL | Back one.
| 11255 | LD C,(HL) | The fourth value.
| 11256 | DEC HL | Back one.
| 11257 | LD D,(HL) | The third value.
| 11258 | DEC HL | Back one.
| 11259 | LD E,(HL) | The second value.
| 11260 | DEC HL | Back one.
| 11261 | LD A,(HL) | The first value.
| 11262 | LD (23653),HL | Reset STKEND to its new position.
| 11265 | RET | Finished.