Routine: Pc
Function: Program C: Scan through the measurements
Called by: Main
Calls: Intfp, Keyb, print
Entry: None
Exit: None
Preserved: None
PC LD HL,0
; Initialise the result pointer and the result number.
LD (LOGN),HL
LD HL,LOG
LD (LOGCUR),HL
XOR A
LD (LOGFLG),A
; Logflg holds the display format: if 0, the measurement number is displayed, if 1, the measured viscosity is displayed.
PCA LD A,(LOGFLG)
OR A
JR NZ,PCB
LD HL,(LOGN)
; Convert measurement number to floating point format, and display.
LD IX,NUM1
CALL INTFP
LD HL,NUM1
CALL PRINT
JR PCC
PCB LD HL,(LOGCUR)
; Print measured viscosity.
CALL PRINT
PCC CALL KEYB
CP 19
; Return from Program C if Clr key is pressed.
RET Z
CP 10
JR NZ,PCD
; If 'A' pressed, enter display format 0.
XOR A
LD (LOGFLG),A
JR PCA
PCD CP 11
JR NZ,PCE
; If 'B' pressed, enter display format 1.
LD (LOGFLG),A
JR PCA
PCE CP 20
; If '+' pressed, then increment the result pointer to the next result, and increment the result number.
JR NZ,PCF
LD HL,(LOGCUR)
INC HL
INC HL
INC HL
INC HL
INC HL
LD (LOGCUR),HL
LD HL,(LOGN)
INC HL
LD (LOGN),HL
LD DE,(LOGNMX)
; Check that the result number is not more than the number of results there are, and restart Pc if it is.
LD A,L
CP E
JR NZ,PCA
LD A,H
CP D
JR NZ,PCA
JR PC
PCF CP 18
; If '-' key pressed, then decrement the result pointer to the next result, and decrement the result number.
JR NZ,PCC
LD HL,(LOGCUR)
DEC HL
DEC HL
DEC HL
DEC HL
DEC HL
LD (LOGCUR),HL
LD HL,(LOGN)
DEC HL
LD (LOGN),HL
LD A,255
CP H
; Check that the result number is not now negative, and restart Pc if it is.
JR NZ,PCA
JP Z,PC