Routine: Vischk
Function: Check that the viscosity is within the user defined range
Called by: Pb2, Pb3.
Calls: Error, Sub
Entry: Viscty holds th viscosity value to be checked, Vismin and Vismax hold the preset values
Exit: Z Flag set if viscosity is within the range
Preserved: None
VISCHK LD BC,VISCTY
LD DE,VISMIN
LD HL,NUM1
CALL SUB
; Subtract Vismin from the viscosity, and signal error 8 if the result is negative.
PUSH HL
POP IX
BIT 7,(IX+3)
JR Z,VISCH1
LD A,8
CALL ERROR
INC A
; Inc A to reset the Z flag, signifying that an error occurred.
RET
VISCH1 LD BC,VISMAX
LD DE,VISCTY
LD HL,NUM1
CALL SUB
; Subtract Vismax from the viscosity, and signal error 9 if the result is negative.
BIT 7,(IX+3)
RET Z
LD A,9
CALL ERROR
INC A
; Inc A to reset the Z flag, signifying that an error occurred.
RET