Prev: 11560 Up: Map Next: 11579
11563: 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, 0 for '+' and 255 for '-'.
Input
BC Value to stack
STACK_BC 11563 LD IY,23610 Re-initialise IY to ERR-NR.
11567 XOR A Clear the A register.
11568 LD E,A And the E register, to indicate '+'.
11569 LD D,C Copy the less significant byte to D.
11570 LD C,B And the more significant byte to C.
11571 LD B,A Clear the B register.
11572 CALL STK_STORE Now stack the number.
11575 RST 40 Use the calculator to make HL point to STKEND-5.
11576 DEFB 56 end_calc
11577 AND A Clear the carry flag.
11578 RET Finished.
Prev: 11560 Up: Map Next: 11579