Prev: 2D28 Up: Map Next: 2D3B
2D2B: THE 'STACK-BC' SUBROUTINE
Used by the routines at S_RND, DEC_TO_FP, usr and len.
The routine at STACK_A continues here.
This subroutine gives the floating-point form for the absolute binary value currently held in the BC register pair.
The form used in this and hence in the two previous subroutines as well is the one reserved in the Spectrum for small integers n, where -65535<=n<=65535. The first and fifth bytes are zero; the third and fourth bytes are the less significant and more significant bytes of the 16 bit integer n in two's complement form (if n is negative, these two bytes hold 65536+n); and the second byte is a sign byte, +00 for '+' and +FF for '-'.
Input
BC Value to stack
STACK_BC 2D2B LD IY,$5C3A Re-initialise IY to ERR-NR.
2D2F XOR A Clear the A register.
2D30 LD E,A And the E register, to indicate '+'.
2D31 LD D,C Copy the less significant byte to D.
2D32 LD C,B And the more significant byte to C.
2D33 LD B,A Clear the B register.
2D34 CALL STK_STORE Now stack the number.
2D37 RST $28 Use the calculator to make HL point to STKEND-5.
2D38 DEFB $38 end_calc
2D39 AND A Clear the carry flag.
2D3A RET Finished.
Prev: 2D28 Up: Map Next: 2D3B