$TITLE('CONTRAVES ENCODER (DRV11-J)') PAGEWIDTH(80)
$NOSYMBOLS MACROFILE DEBUG
;
;******************************************************
;
	NAME	CONENC
	PUBLIC	INTRR,PGMEM,FPSST,LMPAR,LCPAR,LDXP
	PUBLIC	LP1PAR,YRPAR,XMPAR,LCADR,YRADR,XMADR
	PUBLIC	MTAB,BRTAB,DPART,PARSV,MENULP,CMPAR
	PUBLIC	CMADR,MENUR,XSWST,LDDAY,CTODCT,XPPAR
	PUBLIC	CRPAR,CRADR,DEFLC,IRIGFG,RETFG,XPADR
	EXTRN	TSTNVM,YEAR,LDLPM,CBYTE,FORCK,MENUFG
	EXTRN	LDCHR,RIFF,IRIGSR,RVSPT,LDSPA,ANNOR
	EXTRN	MENU,POSAN,LDCON,RDCLK,CLKST,CKINIT
	EXTRN	B2ACAS,BCDCLK,ASCCLK,EXIT,SETCK,XINIT
	EXTRN	LDASCK,DAY,DMYCV,PDAY,WTPAR,XMCHG,BOX
	EXTRN	MOVE,BCDASC,AB2BCD,AED2A,ABASC
	EXTRN	BXHAIR,XOUTDR,ABSPOS,LDASC
	STKLN	52
;	DATE	27-JAN-86
	CSEG
;
;	REVISIONS:
;	13-DEC-84 - CHANGED YEAR TO 85 AND NULL BYTE
;		    FOLLOWING BINARY AZ/EL TO ALL 1'S
;	27-JAN-86 - MODIFIED TO ACCEPT FOV DATA TO BE
;		    ENCODED FOLLOWING FIXED DATA
;
;******************************************************
;
;		EXECUTIVE EQUATES
;
;******************************************************
;
;MEMORY ADDRESSES
;
PGMEM	EQU	3E00H		;PAGE MEMORY
ENCOD	EQU	4A00H		;ENCODER
;
;I/O PORT ADDRESSES
;
DRVCMD	EQU	1		;DRV11-J COMMAND PORT
DRVMSB	EQU	2		;DRV11-J MSB PORT
DRVLSB	EQU	3		;DRV11-J LSB PORT
;
IPB	EQU	5		;IRIG PORT B
ISP	EQU	6		;IRIG STATUS PORT
ICM	EQU	7		;IRIG COMMAND PORT
;
FDADR	EQU	8		;FXD DATA ADDRESS PORT
FDCMD	EQU	9		;FXD DATA COMMAND PORT
FDIST	EQU	8		;FXD DATA STATUS PORT
FDINP	EQU	9		;FXD DATA INPUT
FDHSK	EQU	10		;FXD DATA H'SHAKE PORT
;
STATUS	EQU	47H		;VSP INTR STATUS PORT
FPSIO	EQU	48H		;FRONT PANEL SWITCHES
;
;******************************************************
;
;		SYSTEM INITIALIZATION
;
;******************************************************
;
START:
	DI			;DISABLE INTERRUPTS
	LXI	SP,STACK	;LOAD STACK POINTER
	CALL	TSTNVM		;MOVE PARAMETERS TO RAM
	LDA	LCPAR		;FETCH LINE COUNT
	LXI	H,PGMEM		;CLEAR PAGE
	CALL	ANNOR
	LXI	H,LCPAR		;LOAD LINE POS MEMORY
	CALL	LDLPM
	LHLD	PONWD		;POWER ON TEST WORD
	LXI	D,55AAH		;POWER ON CONSTANT
	MOV	A,H		;POWER ON INIT?
	CMP	D
	JNZ	INIT05		;YES-AHEAD
	MOV	A,L
	CMP	E
	JZ	INIT40		;NO-AHEAD
INIT05:
	XCHG			;ELSE-STORE CONSTANT
	SHLD	PONWD
	XRA	A		;RESET OTHER TEST BYTES
	STA	CBYTE
	MVI	C,5		;INIT CTR FOR OPT TEST
	CALL	RVSPT		;RESET TIMER
	JMP	INIT10		;AHEAD
	NOP
	NOP
;
;******************************************************
;
;		INTERRUPT PROCESSING
;
;******************************************************
;
INTR:
	PUSH	PSW		;SAVE REGISTERS
	PUSH	B
	PUSH	D
	PUSH	H
	LXI	H,INTRR		;RET ADDR TO STACK
	PUSH	H
;
;TEST FOR VSP INTERRUPT
;
	IN	STATUS		;FETCH VSP F/F STATUS
	RLC			;SET?
	JNC	INT20		;NO-AHEAD
	LXI	H,VSPFG		;SET FLAG
	MVI	M,0FFH
	CALL	RIFF		;RESET INTR F/F
	LXI	H,ENCOD		;POINT AT ENCODER
	MVI	M,0		;STORE NULL BYTE
	INX	H
	MVI	M,10110011B	;STORE SYNC BYTE
	CALL	RDFPS		;READ FP SWITCHES
	MVI	A,42H		;FORCE USER RDY HIGH
	OUT	DRVCMD
	IN	DRVCMD		;DRV11-J READY?
	ANI	2
	JNZ	INT03		;NO-AHEAD
	OUT	DRVMSB		;ELSE-SEND FD COUNT
	DCR	A		;SET COUNT=0FFH
	STA	INTCT
	LDA	FXDCT		;SEND FD COUNT
	OUT	DRVLSB
INT03:
	CALL	RDCLK		;READ CLOCK
	LXI	H,ENCOD+2	;POINT AT ENCODER
	LXI	D,BCDCLK	;POINT AT CLOCK
	MVI	C,3		;FIRST 3 BYTES
	LDA	RFOVFG		;RANGE OPTION?
	ANI	6
	JZ	INT05		;NO-AHEAD
	LDAX	D		;FETCH CLOCK STATUS
	ANI	0F0H		;MASK LSB'S
	MOV	B,A		;SAVE IN B
	LXI	D,RDATA		;POINT AT RANGE DATA
	LDAX	D		;FETCH 1ST BYTE
	ANI	0FH		;MASK
	ORA	B		;COMBINE CLOCK STATUS
	MOV	M,A		;STORE IN ENCODER
	INX	H
	INX	D
	DCR	C		;2 MORE BYTES
INT05:
	CALL	LDCHR		;LOAD ENCODER
	LXI	D,BCDCLK+3	;COMPLETE TIME LOAD
	MVI	C,4
	CALL	LDCHR
	LXI	H,FXDCT		;FIXED DATA COUNT
	MOV	E,M		;COUNT TO DE
	MVI	D,0
	INR	M		;INCREMENT COUNT
	LXI	H,FXDBF		;POINT AT BUFFER
	DAD	D		;ADD COUNT
	MOV	B,M		;FETCH FIXED DATA
	LXI	H,ENCOD+16	;POINT AT ENCODER
	MOV	M,E		;ENCODE COUNT
	INX	H
	MOV	M,B		;ENCODE FIXED DATA
	CALL	LDASCK		;CONV CLK TO ASCII
	LXI	H,PGMEM		;POINT AT PAGE
	CALL	LDDAY		;LOAD DAY
	CALL	CTODCT		;COMPUTE TOD COUNT
	CALL	LDCHR		;LOAD TIME
	LDA	IRIGFG		;IRIG IN SYSTEM?
	ORA	A
	JNZ	$+8		;NO-AHEAD
	LDA	ASCCLK		;ELSE-STORE STATUS
	MOV	M,A
	INX	H
	MVI	M,' '		;SPACE
	INX	H
	SHLD	PGPTR		;SAVE POINTER
	RET
;
;TEST FOR INTERFACE INTERRUPT
;
INT20:
	IN	DRVCMD		;READ STATUS
	RAR			;INTERRUPT?
	JNC	INT55		;NO-AHEAD
INT22:
	LXI	H,INTCT		;POINT AT COUNT
	MOV	A,M		;OUTPUT ACK?
	INR	A
	JNZ	INT25		;NO-AHEAD
	MOV	M,A		;ELSE-RESET COUNT
	STA	DATFG		;RESET FLAG
	MVI	A,11		;RESET INTERRUPT &
	OUT	DRVCMD		; SET USER RDY LOW
	MVI	C,5		;SET C=5 WORDS
	LDA	RFOVFG		;FETCH FLAG
	MOV	B,A
	ANI	6		;RANGE ENCODED?
	JZ	$+5		;NO-AHEAD
	INR	C		;ELSE C+2 WORDS
	INR	C
	MOV	A,B		;FOV ENCODED?
	ANI	9
	JZ	$+4		;NO-AHEAD
	INR	C		;ELSE-C+1 WORD
	LXI	H,STPCT		;STORE STOP COUNT
	MOV	M,C
	RET
INT25:
	CALL	RDDRV		;READ DRV11J DATA
	LXI	H,DATFG		;FETCH DATA FLAG
	PUSH	H
	MOV	A,M
	ORA	A		;FXD DATA ENCODED?
	CZ	ENCFD		;NO-ENCODE FIXED DATA
	POP	H		;AZ/EL ENCODED?
	MOV	A,M
	DCR	A
	JNZ	INT50		;YES-AHEAD
	LDA	INTCT		;FETCH COUNT
	CPI	5		;AZ & EL DATA READY?
	RC			;NO-RETURN
	INR	M		;INDICATE AZ/EL ENCODE
	LXI	H,AZDAT		;POINT AT AZIMUTH
	LXI	D,ENCOD+9	;POINT AT ENCODER
	LDA	DTFLG		;BINARY DATA?
	SUI	66
	JNZ	INT40		;NO-AHEAD
	XCHG			;ELSE-SWAP POINTERS
	PUSH	D		;SAVE POINTER
	INX	D		;SKIP FIRST BYTE
	PUSH	D
	MVI	C,3		;ENCODE AZIMUTH
	CALL	LDCHR
	INX	D
	CALL	LDCHR		;ENCODE ELEVATION
	MVI	M,0FFH		;INDICATE BINARY DATA
	POP	D		;LEFT JUSTIFY
	POP	H
	MVI	C,7
	CALL	LDCHR
	JMP	INT50		;AHEAD
INT40:
	MVI	C,4		;LEFT JUSTIFY AZ
	CALL	LJBY4
	MOV	B,A		;SAVE 4TH AZ BYTE
	DCR	C		;ENCODE 1ST 3 BYTES
	XCHG
	CALL	LDCHR
	INX	D
	LDAX	D		;FETCH 1ST EL BYTE
	ANI	0FH		;MASK MSB'S
	ORA	B		;COMBINE W/ 4TH AZ
	MOV	M,A		; BYTE AND ENCODE
	PUSH	D		;SAVE POINTER
	INX	H		;BUMP POINTERS
	INX	D
	CALL	LDCHR		;ENCODE LAST EL BYTES
	POP	H		;LEFT JUSTIFY EL
	INR	C
	CALL	LJBY4
INT50:
	LXI	H,STPCT		;ALL DATA IN?
	LDA	INTCT
	CMP	M
	RNZ			;NO-RETURN
	MVI	A,42H		;ELSE-USER RDY HIGH
	OUT	DRVCMD
	MOV	A,M		;FETCH WORD COUNT
	MVI	M,0		;RESET WORD COUNT
	ADD	A		;BYTE COUNT=WORD*2
	SUI	10		;COUNT-(AZ/EL COUNT)
	JZ	INT53		;IF NO RNG/FOV
	MVI	C,3		;IS RANGE ENCODED?
	CMP	C
	LXI	D,RGDAT		;POINT AT DATA
	JC	INT52		;NO-AHEAD
	LXI	H,RDATA		;ELSE-MOVE RANGE
	INX	D
	CALL	LDCHR		;FOR NEXT FIELD ENC
INT52:
	LDA	RFOVFG		;FOV TO BE ENCODED?
	ANI	9
	JZ	INT53		;NO-AHEAD
	LXI	H,ENCOD+18	;ELSE-ENCODE FOV
	MVI	C,2
	CALL	LDCHR
INT53:
	LXI	H,CNVFG		;CONVERT FLAG SET?
	MOV	A,M
	ORA	A
	RNZ			;YES-EXIT
	DCR	M		;ELSE-SET FLAG
	LXI	H,AEIBF		;POINT AT BUFFER
	LXI	D,AZDAT		;POINT AT DATA
	MVI	C,12		;12 BYTES
	JMP	LDCHR		;LOAD CONV BUFFER
;
;TEST FOR IRIG INTERRUPT
;
INT55:
	LDA	IRIGFG		;IRIG IN SYSTEM
	ORA	A
	RNZ			;NO-RETURN
	POP	H		;RESET STACK POINTER
	IN	ISP		;INTERRUPT?
	ANI	8
	JNZ	IRIGSR		;YES-SERVICE INTR
;
;RETURN FROM INTERRUPT
;
INTRR:
	POP	H		;RESTORE REGISTERS
	POP	D
	POP	B
	POP	PSW
	EI			;ENABLE INTERRUPTS
	RET			;RETURN TO PROGRAM
;
;******************************************************
;
;		CONTINUE INITIALIZATION
;
;******************************************************
;
INIT10:
	XRA	A		;TEST FOR RETICLE GEN
	OUT	31H		;OUTPUT ZERO
	IN	STATUS		;TIMEOUT?
	RLC
	JC	INIT15		;YES-AHEAD
	DCR	C		;DONE?
	JNZ	INIT10		;NO-BACK
INIT15:
	MOV	A,C		;SET/RESET PARAMETER
	STA	RETFG		;ZERO=RETICLE GEN
	MVI	A,45H		;RESET DRV11-J
	OUT	DRVCMD
	MVI	C,5		;TEST FOR FIXED
	CALL	RVSPT		; DATA INPUT
INIT20:
	MVI	A,1
	OUT	FDINP		;RESET INTERRUPT
	IN	STATUS		;TIMEOUT?
	RLC
	JC	INIT25		;YES-AHEAD
	DCR	C		;DONE?
	JNZ	INIT20		;NO-BACK
INIT25:
	MOV	A,C		;SET/RESET FLAG
	STA	FXDFG		;ZERO=FIXED DATA INP
	MVI	C,5		;TEST FOR IRIG
	CALL	RVSPT
INIT30:
	MVI	A,0C0H		;INIT IRIG 8255
	OUT	ICM
	IN	STATUS		;TIMEOUT?
	RLC
	JC	INIT35		;YES-AHEAD
	DCR	C		;DONE?
	JNZ	INIT30		;NO-BACK
INIT35:
	MOV	A,C		;SET/RESET FLAG
	STA	IRIGFG
	XRA	A		;RESET MENU FLAG
	STA	MENUFG
	LDA	XMPAR		;INIT RETICLE MODE
	STA	XSWST
	LDA	DATPAR		;INIT DATA TYPE FLAGS
	LXI	H,DTFLG
	MOV	M,A
	INX	H
	MVI	M,20H
INIT40:
	LDA	MENUFG		;RST0 FROM MENU?
	ORA	A
	JNZ	INIT45		;YES-AHEAD
	LXI	H,FXDBF		;RESET FIXED DATA
	MVI	C,240
	CALL	LDCON
	MVI	C,16		;CLEAR FIXED STATUS
	CALL	LDSPA
	MVI	A,8		;CLEAR PAGE SAVE BUFFER
	CALL	ANNOR
	LXI	H,ENCOD		;RESET ENCODER
	MVI	C,31
	XRA	A
	CALL	LDCON
	LXI	H,LN2BF		;RESET LINE 2 BUFFER
	MVI	C,32
	CALL	LDSPA
	LDA	ANOPAR		;INIT ANNOTATION FLAG
	STA	ANOFG
INIT45:
	XRA	A		;RESET MENU FLAG
	STA	MENUFG
	LXI	H,ZROST		;RESET FLAGS
	MVI	C,ZROLN
	CALL	LDCON
	LXI	H,AEIBF		;RESET CONVERT BUF
	MVI	C,8
	CALL	LDCON
	CMA			;SET CONVERT FLAG
	STA	CNVFG
	MVI	A,43H		;USER RDY HIGH
	OUT	DRVCMD
	XRA	A		;RESET COUNT
	STA	INTCT
	LXI	D,ALTPG		;MOVE ANNOTATION
	LXI	H,PGMEM+64
	MVI	A,8
	CALL	MOVE
	MVI	B,0		;B=0
	LDA	IRIGFG		;IRIG IN SYSTEM?
	ORA	A
	JNZ	INIT50		;NO-AHEAD
	MVI	A,0C0H		;INIT IRIG 8255
	OUT	ICM
	LDA	CMPAR		;IRIG MODE?
	CPI	'I'
	JNZ	INIT50		;NO-AHEAD
	INR	B		;B=1
INIT50:
	MOV	A,B		;CLOCK STATUS
	STA	CLKST
	CALL	CKINIT		;INIT CLOCK
	CALL	XINIT		;INIT RETICLE
	CALL	RIFF		;RESET INTR F/F
	MVI	A,1		;RESET FDI INTR
	OUT	FDCMD
	EI			;ENABLE INTERRUPTS
;
;******************************************************
;
;		EXECUTIVE LOOP
;
;******************************************************
;
RUN:
	LXI	H,VSPFG		;VSP INTERRUPT?
	XRA	A
	CMP	M
	JZ	RUN		;NO-WAIT
	MOV	M,A		;ELSE-RESET FLAG
	LDA	RETFG		;RETICLE GENERATOR?
	ORA	A
	JNZ	RUN05		;NO-AHEAD
	CALL	XOUTDR		;ELSE-OUTPUT POS
	LXI	H,FXDST+1	;POINT AT FIXED STATUS
	LXI	D,ABSPOS	;POINT AT POSITION
	MVI	C,6
	CALL	LDCHR		;UPDATE POSITION
	LDA	XSWST		;RETICLE ON?
	MOV	B,A		;SAVE IN B
	ORI	40H		;ADD ASCII BIAS
	STA	FXDST		;STORE IN BUFFER
	MOV	A,B
	ANI	7
	LHLD	PGPTR		;FETCH PAGE POINTER
	LXI	D,ABSPOS	;POINT AT POSITION
	CNZ	LDXP		;YES-UPDATE ANNO
	SHLD	PGPTR		;STORE POINTER
RUN05:
	LHLD	PGPTR		;FETCH POINTER
	MVI	A,32		;LAST CHAR IN LINE?
	CMP	L
	JZ	$+9		;YES-AHEAD
	MVI	M,' '		;ELSE-SPACE FILL
	INX	H
	JMP	$-7		;BACK
;
;UPDATE LINE 2 ANNOTATION
;
	LXI	H,PGMEM+32	;POINT AT PAGE
	LXI	D,LN2BF		;LINE 2 ANNOTATION
	MVI	C,32		;32 CHARACTERS
	CALL	LDCHR		;UPDATE LINE 2
;
;UPDATE FIXED DATA FLAGS
;
	LDA	DTFLG		;FETCH DATA TYPE
	LXI	H,FXDST+7	;POINT AT FIXED DATA
	MOV	M,A		;STORE DATA TYPE
	INX	H
	LDA	RFOVFG		;RANGE OPTION PARAM
	MOV	M,A
	INX	H
	XCHG
	LXI	H,ASCCLK+1	;POINT AT CLOCK
	MOV	B,M		;FETCH YEAR
	XCHG
	MOV	M,B		;STORE YEAR
	INX	H
	ANI	6		;RANGE OPTION?
	MVI	C,6
	JNZ	$+9		;YES-AHEAD
	CALL	LDSPA		;SPACE FILL
	JMP	$+7		;AHEAD
	INX	D		;ELSE-STORE TIME
	CALL	LDCHR
RUN10:
	LDA	CNVFG		;CONVERT FLAG SET?
	ORA	A
	JZ	RUN		;NO-WAIT
	LXI	H,LN2BF		;POINT AT ANNO BUF
	LXI	D,AZELMG	;POINT AT TEXT
	MVI	C,3		;STORE "AZ:"
	CALL	LDCHR
	PUSH	D		;SAVE POINTER
	XCHG
	LDA	DTFLG		;FETCH DATA TYPE
	SUI	66		;BINARY DATA?
	MOV	B,A		;SAVE COUNT & FLAG
	LXI	H,AEIBF		;POINT AT AZIMUTH
	CZ	AB2BCD		;CONV ANG BIN TO BCD
	CALL	AED2A		;CONVERT TO ASCII
RUN15:
	POP	D		;RESTORE TEXT POINTER
	INR	C		;STORE " EL:"
	CALL	LDCHR
	XCHG
	LXI	H,AEIBF+4	;POINT AT ELEVATION
	XRA	A		;BINARY DATA?
	ORA	B
	CZ	AB2BCD		;YES-CONVERT FOR BINARY
	CALL	AED2A		;CONVERT TO ASCII
RUN20:
	LXI	D,RUN55		;RET ADDR TO STACK
	PUSH	D
	LDA	RFOVFG		;RANGE OPTION?
	ANI	6
	JNZ	RUN25		;YES-AHEAD
	MVI	C,9		;ELSE-SPACE FILL
	JMP	LDSPA
RUN25:
	MVI	M,' '		;STORE SPACE
	INX	H
	MVI	M,'R'		;STORE "R"
	INX	H
	ANI	4
	JZ	RUN35		;IF BINARY
	MVI	M,':'		;STORE COLON
	INX	H
	LXI	D,AEIBF+9	;POINT AT DATA
	XCHG
	CALL	BCDASC		;CONVERT 1ST DIGIT
	XCHG
	MOV	M,A		;STORE
	PUSH	H		;SAVE POINTER
	INX	H
	CALL	B2ACAS		;COMPLETE CONVERSION
	CALL	B2ACAS
	POP	H
	PUSH	H		;LEFT JUSTIFY
	MVI	C,4
	MVI	A,'0'
	JMP	RUN45		;AHEAD
RUN35:
	PUSH	H		;SAVE POINTER
	LXI	H,AEIBF+9	;POINT AT DATA
	CALL	B20BCD		;CONVERT TO BCD
	LXI	H,ABASC		;STORE TEMP.
	PUSH	H
	MOV	M,D
	INX	H
	MOV	M,E
	INX	H
	MOV	M,B
	INX	H
	MOV	M,C
	POP	H		;RESTORE POINTERS
	POP	D
	PUSH	D
	CALL	BCDASC		;CONVERT 1ST DIGIT
	XCHG
	MOV	M,A		;STORE 10^6
	INX	H
	MVI	C,3		;COMPLETE CONVERSION
RUN40:
	CALL	B2ACAS
	DCR	C
	JNZ	RUN40
	POP	H		;POINT AT 10^6
	MVI	A,'0'		;10^6 DIGIT?
	CMP	M
	RNZ			;YES-EXIT
	MVI	M,':'		;ELSE-STORE COLON
	INX	H
	PUSH	H
	MVI	C,5		;SET COUNT
RUN45:
	CMP	M		;CHARACTER ="0"?
	JNZ	RUN50		;NO-AHEAD
	INX	H		;NEXT CHARACTER
	DCR	C		;DONE?
	JNZ	RUN45
RUN50:
	POP	D		;1ST CHARACTER POS
	XCHG
	INR	C		;CHARS DISPLAYED
	CALL	LDCHR
	MVI	A,6		;TOTAT CHAR POSITIONS
	SUB	C		;REMAINING
	MOV	C,A
	JNZ	LDSPA		;SPACE FILL
	POP	D		;RESET STACK POINTER
RUN55:
	XRA	A		;RESET FLAGS
	STA	CNVFG
	STA	VSPFG
	JMP	RUN		;LOOP BACK
;
AZELMG:	DB	'AZ: EL:'
;
;******************************************************
;
;		EXECUTIVE SUBROUTINES
;
;******************************************************
;
;READ DRV11-J INTERFACE SUBROUTINE
;
RDDRV:
	MVI	A,3		;RESET INTERRUPT F/F
	OUT	DRVCMD
	IN	DRVMSB		;READ MSB'S
	MOV	B,A		;SAVE IN B
	IN	DRVLSB		;READ LSB'S
	MOV	C,A		;SAVE IN C
	LDA	STPCT		;ALL DATA IN?
	ORA	A
	RZ			;YES-IGNOR
	LDA	INTCT		;FETCH COUNT
	MOV	L,A
	MVI	H,0		;HL <-COUNT
	DAD	H		;COUNT*2=OFFSET
	LXI	D,INTBF		;POINT AT BUFFER
	DAD	D		;ADD OFFSET
	MOV	M,B		;STORE MSB'S
	INX	H
	MOV	M,C		;STORE LSB'S
	INR	A		;BUMP COUNT
	STA	INTCT		;STORE NEW COUNT
	LXI	H,STPCT		;DONE?
	CMP	M
	RZ			;YES-RETURN
	DCR	A
	LXI	H,FXDFG		;FDI IN SYSTEM
	ORA	M		; AND COUNT=0?
	JNZ	RDR10		;NO-AHEAD
	MOV	A,B		;FETCH MSB'S
	INR	A		;READ FDI?
	JNZ	RDR10		;NO-AHEAD
	LDA	FXDCT		;ELSE-FETCH F.D. COUNT
	DCR	A		;COUNT THIS FIELD
	OUT	FDADR		;OUTPUT COUNT
	XRA	A		;RESET FLAG
	STA	FDIFG
RDR10:
	IN	DRVCMD		;NEW INTERRUPT?
	RAR
	JC	RDDRV		;YES-BACK
	RET			;ELSE-RETURN
;
;******************************************************
;
;ENCODE FIXED DATA SUBROUTINE
;
ENCFD:
	INR	M		;INDICATE FD ENCODED
	LXI	H,INTBF		;LOAD POINTER
	MOV	A,M		;FETCH COMMAND
	INX	H		;POINT AT DATA
	MOV	C,M		;FETCH DATA
	ORA	A		;ENCODE AT FXDCT?
	JZ	EFD10		;YES-AHEAD
	CPI	0FFH		;READ FDI?
	JNZ	EFD05		;NO-AHEAD
	LDA	FDIFG		;BOARD IN SYSTEM?
	MVI	C,0		;SET C=0
	ORA	C
	JNZ	EFD10		;NO-AHEAD
	IN	FDINP		;ELSE-READ FDI
	MOV	C,A		;SAVE IN C
	JMP	EFD10		;AHEAD
EFD05:
	CPI	241		;COUNT >=241?
	JNC	CHGPAR		;YES-TEST PARAM CHG
	STA	FXDCT		;ELSE-CHANGE FXDCT
EFD10:
	LDA	FXDCT		;FETCH COUNT
	DCR	A
	CPI	240		;VALID?
	JNC	DSPFD		;NO-JUST DISPLAY
EFD20:
	LXI	H,ENCOD+16	;ENCODE COUNT
	MOV	M,A
	INX	H		;ENCODE DATA
	MOV	M,C
	MOV	E,A		;COUNT TO DE
	MVI	D,0
	LXI	H,FXDBF		;POINT AT BUFFER
	DAD	D		;ADD OFFSET
	MOV	M,C		;STORE DATA
	JMP	DSPFD		;DISPLAY
;
;******************************************************
;
;READ FRONT PANEL SWITCHES SUBROUTINE
;
RDFPS:
	LXI	H,FPSST		;POINT AT SWITCH STATUS
	IN	FPSIO		;READ SWITCHES
	ANI	0FH		;ALL OFF?
	JNZ	RDS05		;NO-AHEAD
	MOV	M,A		;ELSE-RESET STATUS
	RET
RDS05:
	CMP	M		;CHANGE?
	RZ			;NO-IGNOR
	MOV	M,A		;STORE NEW STATUS
	RRC			;MENU?
	JNC	RDS10		;NO-AHEAD
	LXI	H,ALTPG		;PAGE SAVE BUFFER
	LXI	D,PGMEM+64	;PAGE MEMORY
	MVI	A,8		;8 LINES
	CALL	MOVE		;SAVE ANNOTATION
	MVI	A,45H		;DISABLE DRV11-J
	OUT	DRVCMD
	JMP	MENU		;GO DO MENU
RDS10:
	MVI	A,0CH		;BOX OR B/W?
	ANA	M
	LXI	H,XSWST		;RETICLE SWITCH STATUS
	JZ	RDS15		;NO-AHEAD
	XRA	M		;ELSE-COMPLEMENT
	MOV	M,A		; STATUS BIT
	JMP	XINIT		;REINIT RETICLE
RDS15:
	MOV	A,M		;FETCH STATUS
	ANI	0CH		;SAVE BOX,B/W STAT
	MOV	B,A
	MOV	A,M		;INCR CROSS STATUS
	INR	A
	ANI	3		;MASK
	ORA	B		;COMBINE STATUS
	MOV	M,A
	JMP	XINIT
;
;******************************************************
;
;DISPLAY FIXED DATA SUBROUTINE
;
DSPFD:
	LXI	H,FXDBF		;POINT AT FIXED DATA
	LXI	D,PGMEM+64	;POINT AT PAGE
	LDA	FXDCT		;FETCH COUNT
	DCR	A		;COUNT THIS FIELD
	MOV	C,A		;COUNT TO BC
	MVI	B,0
	DAD	B		;ADD OFFSET
	LDA	ANOFG		;FETCH ANNO FLAG
	ORA	A		;ANNOTATE?
	JNZ	DFD03		;YES-AHEAD
	XCHG			;ELSE-POINT AT PAGE
	DAD	B		;ADD OFFSET
	MVI	M,' '		;INSERT SPACE
	RET
DFD03:
	CPI	0FFH		;ANNOTATE IN ASCII?
	JNZ	DFD15		;NO-AHEAD
	MOV	A,M		;ELSE-FETCH FIXED DATA
	CALL	VALCH		;VALID ASCII CHAR?
	JNC	DFD10		;YES-AHEAD
	MVI	A,' '		;ELSE-INSERT SPACE
DFD10:
	XCHG			;POINT AT PAGE
	DAD	B		;ADD OFFSET
	MOV	M,A		;STORE CHAR
	RET
DFD15:
	CPI	0FH		;ANNO TOP IN HEX?
	JNZ	DFD20		;NO-AHEAD
	MOV	A,C		;FETCH COUNT
	CPI	128		;COUNT >=128?
	RNC			;YES-RETURN
	JMP	DFD25		;CONV & STR AHEAD
DFD20:
	CPI	0F0H		;ANNO BOTTOM IN HEX?
	RNZ			;NO-RETURN
	MOV	A,C		;ELSE-FETCH COUNT
	SUI	128		;COUNT >=128?
	RM			;NO-RETURN
DFD25:
	ADD	A		;COUNT*2
	MOV	C,A
	MOV	A,M		;FETCH FIXED DATA
	XCHG			;POINT AT PAGE
	DAD	B		;ADD OFFSET
	PUSH	PSW		;SAVE DATA
	RRC			;SHIFT RIGHT (4)
	RRC
	RRC
	RRC
	CALL	DFD30		;CONVERT MS DIGIT
	POP	PSW		;CONVERT LS DIGIT
DFD30:
	ANI	0FH		;MASK MSB'S
	ADI	90H		;SO 'A'-'F' SETS CY
	DAA
	ACI	40H		;ADD IN CY & ADJ MSB'S
	DAA
	MOV	M,A		;STORE CHARACTER
	INX	H
	RET
;
;******************************************************
;
;TEST FOR VALID ASCII CHARACTER
;
VALCH:
	ANI	7FH		;MASK MSB
	CPI	' '		;CONTROL CHARACTER
	RC			;YES-RET CY=1
	CPI	'_'+1		;VALID CHARACTER?
	CMC
	RNC			;YES-RETURN CY=0
	CPI	'A'+20H
	RC			;IF INPUT <LC(A)
	CPI	'Z'+21H
	CMC
	RC			;IF INPUT >LC(Z)
	ANI	NOT 20H		;CONVERT TO UC
	RET
;
;LOAD RETICLE POSITION SUBROUTINE
;
LDXP:
	MVI	A,15H		;SET A=15H
	MOV	B,A
	CMP	L		;POINTER <=15?
	JC	$+5		;NO-AHEAD
	MVI	B,':'		;ELSE-B=COLON
	MVI	M,'X'		;STORE "X:"
	INX	H
	MOV	A,B		;FETCH B
	CPI	':'		;COLON?
	JNZ	LDX05		;NO-AHEAD
	MOV	M,A		;ELSE-STORE COLON
	INX	H
LDX05:
	MVI	C,3
	CALL	LDCHR		;STORE X POSITION
	MVI	M,' '		;SPACE
	INX	H
	MVI	M,'Y'		;STORE "Y:"
	INX	H
	MOV	A,B		;B=COLON?
	CPI	':'
	JNZ	LDCHR		;NO-STORE POSITION
	MOV	M,A		;ELSE-STORE COLON
	INX	H
	JMP	LDCHR		;STORE Y POSITION
;
;******************************************************
;
;20 BIT BINARY TO BCD SUBROUTINE
;
B20BCD:
	MOV	A,M		;FETCH MSB'S
	ANI	0FH		;MASK UPPER NIBBLE
	MOV	D,A		;SAVE IN D
	INX	H		;FETCH NEXT 8 BITS
	MOV	E,M
	INX	H		;FETCH LSB'S
	MOV	H,M
	XCHG
	DAD	H		;LEFT JUSTIFY
	DAD	H
	DAD	H
	DAD	H
	MVI	E,4		;SET BIT COUNTER
	CALL	B2B05		;CONVERT
	MOV	L,D		;BRING IN LSB'S
	MVI	E,16		;COMPLETE 1ST CONV
	CALL	B2B10
	MOV	C,A		;SAVE TENS & UNITS
	DAD	H		;LEFT JUSTIFY
	DAD	H
	MVI	E,14		;DO 2ND CONVERSION
	CALL	B2B05
	MOV	B,A		;SAVE 10^2 & 10^3
	MOV	H,L		;LEFT JUSTIFY
	DAD	H
	MVI	E,7		;DO 3RD CONVERSION
	CALL	B2B05
	MOV	E,A		;SAVE 10^4 & 10^5
	MOV	D,L		;SAVE 10^6
	RET
B2B05:
	XRA	A		;RESET ACC
B2B10:
	DCR	E		;DONE?
	RM			;YES-RETURN
	DAD	H		;SHIFT HL LEFT
	ADC	A		;A=A*2+MSB
	DAA			;CONVERT TO BCD
	JNC	B2B10		;IF A*2+MSB <=99
	INX	H		;INDICATE OVERFLOW
	JMP	B2B10		;CONTINUE
;
;******************************************************
;
;COMPUTE TIME OF DAY COUNT SUBROUTINE
;
CTODCT:
	MVI	C,5		;INITIAL COUNT=5
	LDA	CRPAR		;FETCH PARAMETER
	ANI	7FH		;MASK MSB
	MOV	B,A		;SAVE IN B
	CPI	0		;RESOLUTION TO MINUTES?
	RZ			;YES-RETURN
	MVI	C,8		;SET COUNT=8
	CPI	1		;RESOLUTION TO SECONDS?
	RZ			;YES
	MOV	A,B		;FETCH PARAMETER
	ADD	C		;COMPUTE FOR FRAC SEC
	MOV	C,A		;COUNT TO C
	RET
;
;******************************************************
;
;LOAD DAY OF YEAR SUBROUTINE
;
LDDAY:
	LDA	CRPAR		;JULIAN DISPLAY?
	RLC
	JC	LDY05		;NO-AHEAD
	LXI	D,ASCCLK+1	;POINT AT DAY
	MVI	C,5		;5 CHARACTERS
	JMP	LDCHR		;LOAD JULIAN DAY
LDY05:
	PUSH	H		;SAVE POINTER
	LXI	H,DAYSV		;DAY CHANGE?
	LDA	DAY
	CMP	M
	JZ	LDY10		;NO-AHEAD
	MOV	M,A		;SAVE NEW DAY
	CALL	DMYCV		;UPDATE D-M-Y
LDY10:
	POP	H		;RESTORE POINTER
	LXI	D,PDAY		;POINT AT PRESET DAY
	CALL	B2ACAS		;CONVERT & STORE DAY
	MVI	C,3		;STORE MONTH
	CALL	LDCHR
	CALL	B2ACAS		;CONVERT & STORE YEAR
	MVI	M,' '
	INX	H
	LXI	D,ASCCLK+6	;POINT AT HOUR
	RET
;
;******************************************************
;
;LEFT JUSTIFY BY 4 BITS
;
;INPUTS: HL=SOURCE POINTER
;	  C=BYTE COUNT
;
LJBY4:
	PUSH	H		;SAVE INPUTS
	PUSH	B
LJB05:
	MOV	A,M		;FETCH 1ST BYTE
	ADD	A		;SHIFT LEFT (4)
	ADD	A
	ADD	A
	ADD	A
	MOV	M,A		;SAVE RESULT
	DCR	C		;DONE?
	JNZ	LJB10		;NO-AHEAD
	POP	B		;ELSE-RETURN INPUTS
	POP	H
	RET
LJB10:
	INX	H		;FETCH 2ND BYTE
	MOV	A,M
	RRC			;SWAP NIBBLES
	RRC
	RRC
	RRC
	ANI	0FH		;MASK MSB'S
	DCX	H		;COMBINE BYTES
	ORA	M
	MOV	M,A		;STORE
	INX	H		;BUMP POINTER
	JMP	LJB05		;BACK
;
;******************************************************
;
;MENU RESET SUBROUTINE
;
MENUR:
	LDA	RETFG		;RETICLE GENERATOR?
	ORA	A
	RNZ			;NO-RETURN
	CMA			;ELSE-DISABLE RETICLE
	OUT	31H
	RET
;
;******************************************************
;
;BORESIGHT RETICLE MENU BRANCH ROUTINE
;
POSRET:
	LXI	H,BXHAIR	;POS RETICLE BRANCH
	JMP	BX05		;AHEAD
CHGBOX:
	LXI	H,BOX		;CHANGE BOX BRANCH
	JMP	BX05
DEFRET:
	LXI	H,XMCHG		;DEF RETICLE BRANCH
BX05:
	LDA	RETFG		;RETICLE IN SYSTEM?
	ORA	A
	JNZ	MENU		;NO-BACK TO MENU
	PCHL			;ELSE-BRANCH
;
;******************************************************
;
;DEFINE ANNOTATION PARAMETER MENU ROUTINE
;
DEFANO:
	LXI	H,PGMEM		;POINT AT PAGE
	LXI	D,DANOMG	;POINT AT HEADER
	CALL	LDASC		;LOAD HEADER
	CALL	LDASC		;LOAD FORMAT MESSAGE
	LXI	D,SMSG		;POINT AT EXIT MESSAGE
	INX	H
	CALL	LDASC		;LOAD EXIT MESSAGES
	CALL	LDASC
	CALL	LDASC
	CALL	DAN50		;LOAD FORMAT
DAN05:
	IN	STATUS		;WAIT FOR INTR F/F
	RLC
	JNC	DAN05
	CALL	RIFF		;RESET F/F
	LXI	H,DAN05		;RET ADDR TO STACK
	PUSH	H
	LXI	H,FPSST		;POINT AT SWITCH STATUS
	IN	FPSIO		;READ SWITCHES
	ANI	1FH		;ALL OFF?
	JNZ	DAN10		;NO-AHEAD
	MOV	M,A		;ELSE-RESET STATUS
	RET			;BACK
DAN10:
	CMP	M		;CHANGE?
	RZ			;NO-BACK
	MOV	M,A		;ELSE-STORE NEW STATUS
	RRC			;MENU?
	JC	MENU		;YES-BACK TO MENU
	RRC			;LEFT?
	JNC	DAN15		;NO-AHEAD
	ANI	4		;ALSO RIGHT?
	RZ			;NO-BACK
	LXI	H,ANOPAR	;PARAMETER CHANGE?
	LDA	ANOFG
	CMP	M
	JZ	MENU		;NO-BACK TO MENU
	MOV	M,A		;ELSE-WRITE NEW PARAM
	LDA	ANADR
	MVI	C,1
	CALL	WTPAR
	JMP	MENU		;BACK TO MENU
DAN15:
	ANI	3		;UP OR DOWN?
	RZ			;NO-BACK
	LXI	H,ANOFG		;POINT AT FLAG
	MOV	A,M		;FETCH FLAG
	ORA	A		;NO ANNOTATION?
	JNZ	DAN20		;NO-AHEAD
	MVI	M,0FH		;ELSE-MAKE IT TOP
	JMP	DAN50		;WRITE NEW MESSAGE
DAN20:
	CPI	0FH		;TOP HEX?
	JNZ	DAN25		;NO-AHEAD
	MVI	M,0F0H		;ELSE-MAKE IT BOTTOM
	JMP	DAN50
DAN25:
	CPI	0F0H		;BOTTOM HEX?
	JNZ	DAN30		;NO-AHEAD
	MVI	M,0FFH		;ELSE-MAKE IT ASCII
	JMP	DAN50
DAN30:
	MVI	M,0		;MAKE IT TOP
DAN50:
	LDA	ANOFG		;FETCH FLAG
	ORA	A		;NO ANNOTATION?
	LXI	H,PGMEM+72	;POINT AT PAGE
	JNZ	DAN55		;NO-AHEAD
	LXI	D,NMSG		;ELSE-STORE MESSAGE
	JMP	LDASC
DAN55:
	CPI	0FH		;TOP HEX?
	JNZ	DAN60		;NO-AHEAD
	LXI	D,TMSG
	JMP	LDASC
DAN60:
	CPI	0F0H		;BOTTOM HEX?
	JNZ	DAN65		;NO-AHEAD
	LXI	D,BMSG
	JMP	LDASC
DAN65:
	LXI	D,AMSG		;ELSE-ASCII
	JMP	LDASC
;
DANOMG:	DB	'**DEFINE FIXED DATA ANNOTATION**',0DH,0DH
FMSG:	DB	'FORMAT:',0DH,0DH
NMSG:	DB	'NONE',0DH
AMSG:	DB	'ASCII',0DH
TMSG:	DB	'UPPER HALF HEX',0DH
BMSG:	DB	'LOWER HALF HEX',0DH
SMSG:	DB	'PRESS ^ OR V TO SELECT',0DH
EMSG:	DB	'PRESS < AND > TO SAVE',0DH
MMSG:	DB	'PRESS MENU TO EXIT',0DH
;
;******************************************************
;
;DEFINE DATA TYPE MENU ROUTINE
;
DEFDAT:
	LDA	DTFLG		;FETCH DATA TYPE
	MOV	B,A		;SAVE IN B
	LXI	H,PGMEM		;POINT AT PAGE
	LXI	D,DFMSG		;POINT AT MESSAGE
	MVI	C,13		;13 CHARACTERS
	CALL	LDCHR		;STORE MESSAGE
	CALL	LDDT		;LOAD DATA TYPE
DDT05:
	IN	STATUS		;INTR F/F SET?
	RLC
	JNC	DDT05		;NO-BACK
	CALL	RIFF		;RESET F/F
	LXI	H,FPSST		;POINT AT SW STATUS
	IN	FPSIO		;READ SWITCHES
	ANI	1FH		;ALL OFF?
	JNZ	DDT10		;NO-AHEAD
	MOV	M,A		;ELSE-RESET STATUS
	JMP	DDT05		;BACK
DDT10:
	CMP	M		;CHANGE?
	JZ	DDT05		;NO-BACK
	MOV	M,A		;STORE NEW STATUS
	RRC			;MENU?
	JNC	DDT15		;NO-AHEAD
	MOV	A,B
	STA	DTFLG		;UPDATE FLAG
	STA	FXDST+7		;UPDATE FIXED DATA
	LXI	H,DATPAR	;PARAMETER CHANGE?
	CMP	M
	JZ	MENU		;NO-EXIT
	MOV	M,A		;ELSE-UPDATE PARAM
	LDA	DTADR		;WRITE NEW PARAMETER
	MVI	C,1
	CALL	WTPAR
	JMP	MENU		;EXIT
DDT15:
	MVI	A,'D'		;SET A="D"
	CMP	B		;BCD DATA?
	JZ	DDT20		;YES-AHEAD
	MVI	A,'F'		;ELSE-FORCE BCD
DDT20:
	SUI	2		;SET NEW FLAG
	MOV	B,A
	LXI	H,DDT05		;RET ADDR TO STACK
	PUSH	H
LDDT:
	LXI	H,PGMEM+14	;POINT AT PAGE
	MVI	C,6		;6 CHARACTERS
	LXI	D,BINMG		;POINT AT BIN MESG
	MOV	A,B		;FETCH PARAMETER
	CPI	'B'
	JZ	LDCHR		;YES-STORE "BINARY"
	LXI	D,BCDMG		;ELSE-STORE "BCD"
	JMP	LDCHR
;
DFMSG:	DB	' DATA FORMAT:'
BINMG:	DB	'BINARY'
BCDMG:	DB	'BCD   '
;
;******************************************************
;
;CHANGE DATA TYPE FROM EXTERNAL SOURCE ROUTINE
;
CHGPAR:
	CPI	241		;CHANGE RETICLE FORM?
	JZ	RETCHG		;YES-AHEAD
	CPI	248		;CHANGE DATA TYPE FLAG?
	JZ	CGP05		;YES-AHEAD
	CPI	249		;CHG R/FOV FLAG?
	RNZ			;NO-RETURN
	MOV	A,C		;FETCH DATA
	LXI	H,RFOVFG	;POINT AT FLAG
	CPI	' '		;DISABLE?
	JZ	CGP15		;YES-AHEAD
	ANI	6		;MASK FOR RANGE OPT
	JZ	$+4		;IF NO RANGE OPT
	RPE			;IF INVALID
	MOV	B,A		;SAVE IN B
	MOV	A,C		;TEST FOR FOV OPT
	ANI	9
	JZ	$+4
	RPE
	ORA	B		;COMBINE
	RZ			;IF INVALID
	ORI	40H		;ADD ASCII BIAS
	MVI	B,249
	JMP	CGP15		;AHEAD
CGP05:
	MOV	A,C		;FETCH DATA
	LXI	H,DTFLG		;POINT AT PARAMETER
CGP10:
	CPI	'B'		;BINARY?
	JZ	CGP15		;YES-AHEAD
	CPI	'D'		;BCD?
	RNZ			;NO-IGNOR
	MVI	B,248
CGP15:
	MOV	M,A		;STORE PARAMETER
	JMP	RCG05		;AHEAD
;
;******************************************************
;
;CHANGE OR POSITION CROSSHAIR EXTERNALLY
;
RETCHG:
	MOV	A,C		;FETCH DATA
	ANI	0FH		;MASK
	PUSH	PSW		;SAVE ON STACK
	STA	XSWST		;STORE AS SWITCH STATUS
	CALL	XINIT		;REINITIALIZE RETICLE
	POP	PSW		;UPDATE FIXED DATA
	ORI	40H
	MOV	C,A
	MVI	B,241
RCG05:
	MOV	A,B		;FETCH COUNT
	STA	FXDCT		;STORE NEW COUNT
	DCR	A
	JMP	EFD20		;ENCODE
;
;******************************************************
;
;		EXECUTIVE TABLES
;
;******************************************************
;
;DEFAULT PARAMETERS TABLE
;
DPART:
NOPAR:	DB	27		;NUMBER OF PARAMETERS
TSTBT:	DB	60H		;TEST BYTE
DEFLM:	DB	10		;MAXIMUM # LINES
DEFLC:	DB	10		;DEFAULT # LINES
DEFLP1:	DB	10,25,40,120,135;DEFAULT LINE POSITIONS
	DB	150,165,180,195,210
DEFCMD:	DB	'M'		;DEFAULT CLOCK MODE
DEFYR:	DB	86H		;DEFAULT YEAR
DEFCR:	DB	3		;DEFAULT RESOLUTION
DEFXMD:	DB	5		;DEFAULT RETICLE
DEFXP:	DW	500,240		;DEFAULT RETICLE POS
DEFBX:	DW	12,4		;DEFAULT BOX SIZE
DEFAN:	DB	0		;DEFAULT ANNOTATION
DEFDT:	DB	'B'		;DEFAULT DATA TYPE
;
;PARAMETER ADDRESS TABLE
;
TBADR:	DB	0		;TEST BYTE
LCADR:	DB	2		;LINE COUNT
CMADR:	DB	13		;CLOCK MODE
YRADR:	DB	14		;YEAR
CRADR:	DB	15		;RESOLUTION
XMADR:	DB	16		;RETICLE MODE
XPADR:	DB	17		;RETICLE POSITION
XBADR:	DB	21		;BOX SIZE
ANADR:	DB	25		;ANNOTATION
DTADR:	DB	26		;DATA TYPE
;
;MENU LINE POSITION TABLE
;
MENULP:
	DB	10		;NUMBER OF ENTRIES
	DB	20,38,56,74,92,110
	DB	128,146,164,182
;
;MENU ENTRY TABLE
;
MTAB:
	DB	10		;NUMBER OF ENTRIES
	DB	'-- MODEL 4963 MENU --',0DH
	DB	'EXIT MENU',0DH
	DB	'SET CLOCK',0DH
	DB	'FORMAT CLOCK',0DH
	DB	'POSITION TEXT',0DH
	DB	'POSITION RETICLE',0DH
	DB	'CHANGE BOX SIZE',0DH
	DB	'DEFINE ANNOTATION',0DH
	DB	'DEFINE RETICLE',0DH
	DB	'DEFINE DATA',0DH
;
;MENU BRANCH TABLE
;
BRTAB:
	DW	EXIT
	DW	SETCK
	DW	FORCK
	DW	POSAN
	DW	POSRET
	DW	CHGBOX
	DW	DEFANO
	DW	DEFRET
	DW	DEFDAT
;
;******************************************************
;
;		EXECUTIVE DEFINED MEMORY
;
;******************************************************
;
	DSEG			;DATA SEGMENT
;
;FLAGS ETC. RESET DURING INITIALIZATION
;
ZROST	EQU	$		;START OF BUFFER
VSPFG:	DS	1		;VSP INTERRUPT FLAG
FLDCT:	DS	1		;FIELD COUNTER
FXDCT:	DS	1		;FIXED DATA COUNTER
INTCT:	DS	1		;INTERFACE COUNT
INTPT:	DS	2		;INTERFACE POINTER
DATFG:	DS	1		;DATA ENCODED FLAG
STPCT:	DS	1		;STOP READ COUNTER
;
;INTERFACE BUFFER
;
INTBF:	DS	2		;FIXED DATA
AZDAT:	DS	4		;AZIMUTH DATA
ELDAT:	DS	4		;ELEVATION DATA
RGDAT:	DS	4		;RANGE DATA
FOVDAT:	DS	2		;FIELD OF VIEW
RDATA:	DS	3		;ENCODER RANGE DATA
ZROLN	EQU	$-ZROST		;BUFFER LENGTH
;
CNVFG:	DS	1		;CONVERT FLAG
FDIFG:	DS	1		;FIXED DATA INTR FLAG
;
;OPTION FLAGS
;
RETFG:	DS	1		;RETICLE FLAG
IRIGFG:	DS	1		;IRIG FLAG
FXDFG:	DS	1		;FXD DATA INPUT FLAG
;
;PARAMETER BUFFER
;
PARSV:
LMPAR:	DS	1		;MAXIMUN # LINES
LCPAR:	DS	1		;ACTUAL # LINES
LP1PAR:	DS	10		;LINE POSITIONS
CMPAR:	DS	1		;CLOCK MODE
YRPAR:	DS	1		;YEAR
CRPAR:	DS	1		;RESOLUTION
XMPAR:	DS	1		;RETICLE MODE
XPPAR:	DS	4		;RETICLE POSITION
XBPAR:	DS	4		;BOX SIZE
ANOPAR:	DS	1		;ANNOTATION
DATPAR:	DS	1		;AZ/EL DATA TYPE
;
;EXECUTIVE STORAGE
;
PONWD:	DS	2		;POWER ON TEST WORD
XSWST:	DS	1		;RETICLE SWITCH STATUS
FPSST:	DS	1		;FRONT PANEL SW STATUS
DAYSV:	DS	1		;DAY SAVE CELL
DRVST:	DS	1		;DRV11J READY STATUS
PGPTR:	DS	2		;PAGE POINTER
ANOFG:	DS	1		;ANNOTATION FLAG
DTFLG:	DS	1		;AZ/EL DATA TYPE FLAG
RFOVFG:	DS	1		;RANGE/FOV DATA TYPE
ENCPTR:	DS	2		;ENCODER POINTER
;
;LARGE BUFFERS
;
FDBST	EQU	$		;START OF FXD DATA BUF
FXDBF:	DS	256		;FIXED DATA BUFFER
FXDST	EQU	FDBST+240	;START OF FD STATUS
ALTPG:	DS	320		;PAGE SAVE BUFFER
AEIBF:	DS	12		;CONVETSION BUFFER
;
;ANNOTATION LINE 2 BUFFER
;
LN2BF:	DS	3		;LINE 2 BUFFER
AZ0BF:	DS	8		;AZIMUTH
ELTXT:	DS	4		;ELEVATION TEXT
ELOBF:	DS	8		;ELEVATION
RTXT:	DS	3		;RANGE TEXT
RANGE:	DS	6		;RANGE
;
	END
