| Routines

2BF1: 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 | 2BF1 | LD HL,($5C65) | Get STKEND.
| 2BF4 | DEC HL | Back one.
| 2BF5 | LD B,(HL) | The fifth value.
| 2BF6 | DEC HL | Back one.
| 2BF7 | LD C,(HL) | The fourth value.
| 2BF8 | DEC HL | Back one.
| 2BF9 | LD D,(HL) | The third value.
| 2BFA | DEC HL | Back one.
| 2BFB | LD E,(HL) | The second value.
| 2BFC | DEC HL | Back one.
| 2BFD | LD A,(HL) | The first value.
| 2BFE | LD ($5C65),HL | Reset STKEND to its new position.
| 2C01 | RET | Finished.