Routine: Intfp
Function: Converts a two byte positive integer to floating point format.
Called by: Pc, Range.
Calls: None
Entry: HL holds the integer, IX points to the Floating point variable.
Exit: FP stored at IX
Preserved: None
INTFP XOR A
OR H
OR L
JR NZ,INTFP1
; If the number to be converted is zero, enter the floating point zero, defined as 0,0,0,0,128, and return.
LD B,128
JR INTFP3
INTFP1 LD B,16
; Rotate the integer, decreasing the exponent, until the leftmost bit is a 1.
INTFP2 BIT 7,H
JR NZ,INTFP3
ADD HL,HL
DEC B
JR INTFP2
INTFP3 RES 7,H
LD (IX+4),B
LD (IX+3),H
LD (IX+2),L
XOR A
LD (IX+1),A
LD (IX+0),A
; Store the floating point number at the specified location.
RET