;save#D:BCALC.PT5
;draw text wndw	;!!!!!!!! INVERSE CHARS !!!!!!!!
DRWIN	LDA #0
	STA TM1
	TAY 
	TAX 
DIT	STX TM2
	LDX TM1
	LDA TWINL,X
	CLC 
	ADC #2
	STA L
	LDA TWINH,X
	ADC #0
	STA L+1
	LDX TM2
DRLP	LDA STRING,X
	JSR AS2IC
	CPX XPOS
	BNE DRSC
	EOR #$80
DRSC	STA (L),Y
	INX 
	INY 
	CPY #38
	BNE DRLP
	LDY #0
	INC TM1
	LDA TM1
	CMP #3
	BNE DIT
	RTS 
;get a key w/OPTION	;!!!!!!!! INVERSE CHARS !!!!!!!!
GAKEY	LDA CONSOL
	CMP #6
	BNE GCH
	PLA 
	PLA 
	LDA #EOL
	STA STRING
	LDA #0
	STA EDIT
	STA SPFLG
	SEC 
	RTS 
GCH	LDA CH
	CMP #$FF
	BEQ GAKEY
	JSR GNKEY
	LDX XPOS
	RTS 
;input routine	;!!!!!!!! INVERSE CHARS !!!!!!!!
INPUT	JSR CLRSTR
INPUT2	LDA #0
	STA XPOS
INMAIN	JSR DRWIN
	JSR GAKEY
	LDX XPOS
	LDY EDIT 	;edit mode?
	BNE ENTS 	;yes
	LDY SPFLG 	;comd mode?
	BNE ENTS 	;yes
	LDY #4 	;ck 4 eol &
IELP	CMP ENKEY,Y 	;cursor keys
	BEQ INEN
	DEY 
	BPL IELP
	BMI SESC
INEN	STA CDIR
	CMP #EOL
	BNE INDON
	STY CDIR
	JMP INDON
ENTS	CMP #EOL
	BNE SESC
	JMP INDON
SESC	CMP #27 	;ESC?
	BNE INEXT
	JSR GAKEY
	CMP #EOL
	BEQ INDON
	JMP INOVR
INEXT	LDY #12 	;test special
IN1LP	CMP INSPC,Y
	BEQ INPRC
	DEY 
	BPL IN1LP
INOVR	STA STRING,X
	INX 
	STX XPOS
	CPX #114
	BCC INMAIN
	DEX 
	STX XPOS
	BNE INMAIN
;
INPRC	LDA INTABL,Y
	STA INJSR+1
	LDA INTABH,Y
	STA INJSR+2
INJSR	JSR $FFFF
	JMP INMAIN
;
INDON	LDY #114
INOUT	DEY 
	LDA STRING,Y
	CMP #$20
	BEQ INOUT
	LDA #EOL
	INY 
	STA STRING,Y
	STY STR
	LDA #0
	STA EDIT
	CLC 
	RTS 
;kill input	;!!!!!!!! INVERSE CHARS !!!!!!!!
ZAPST	JSR CLRSTR
	LDA #0
	STA XPOS
	RTS 
;del char	;!!!!!!!! INVERSE CHARS !!!!!!!!
INDEL	LDX XPOS
	BEQ INDO
	DEX 
	LDA #$20
	STA STRING,X
	STX XPOS
INDO	RTS 
;input left	;!!!!!!!! INVERSE CHARS !!!!!!!!
INLEFT	LDX XPOS
	BEQ INDO
	DEX 
	STX XPOS
	RTS 
;input rt	;!!!!!!!! INVERSE CHARS !!!!!!!!
INRT	LDX XPOS
	CPX #113
	BCS INDO
	INX 
	STX XPOS
	RTS 
;cntrol-del	;!!!!!!!! INVERSE CHARS !!!!!!!!
INCTDL	LDX XPOS
INCTD	LDA STRING+1,X
	STA STRING,X
	INX 
	CPX #$7A
	BNE INCTD
	RTS 
;cntrol-ins	;!!!!!!!! INVERSE CHARS !!!!!!!!
ININS	LDX #$7A
ININD	LDA STRING,X
	STA STRING+1,X
	DEX 
	CPX XPOS
	BPL ININD
	INX 
	LDA #$20
	STA STRING,X
	STA STRING+114
	RTS 
;inout up	;!!!!!!!! INVERSE CHARS !!!!!!!!
INUP	LDA XPOS
	SEC 
	SBC #38
	BPL INST
	CLC 
	ADC #114
INST	STA XPOS
	RTS 
;inp dwn	;!!!!!!!! INVERSE CHARS !!!!!!!!
INDWN	LDA XPOS
	CLC 
	ADC #38
	CMP #114
	BCC INST
	SEC 
	SBC #114
	JMP INST
;xpos to strt of line	;!!!!!!!! INVERSE CHARS !!!!!!!!
INMOD	LDX #0
	LDA XPOS
	CMP #38
	BCC INMD
	LDX #38
	CMP #76
	BCC INMD
	LDX #76
INMD	STX XPOS
	RTS 
;insert line	;!!!!!!!! INVERSE CHARS !!!!!!!!
ININLN	JSR INMOD
	LDA #37
	STA TM3
INLNL	JSR ININS
	DEC TM3
	BPL INLNL
	RTS 
;del a line	;!!!!!!!! INVERSE CHARS !!!!!!!!
INDLLN	JSR INMOD
	LDA #37
	STA TM3
INLND	JSR INCTDL
	DEC TM3
	BPL INLND
	RTS 
;command mode	;!!!!!!!! INVERSE CHARS !!!!!!!!
COMMODE	LDA #4
	STA DLIC+1
	LDA #1
	STA SPFLG
	JSR INPUT
	BCS CMOUT
	JSR LO2UP
CMAOK	LDX #0 	;Command #
	LDA # <CMTAB
	STA L
	LDA # >CMTAB
	STA L+1
CMBG	LDY #0
CMST	LDA (L),Y
	BEQ COMMODE
	CMP STRING,Y
	BNE CU3
	INY 
	CPY #3
	BNE CMST
;
	LDA COML,X
	STA CMJP+1
	LDA COMH,X
	STA CMJP+2
	JSR CLRTXT
CMJP	JSR $FFFF
CMOUT	LDA #0
	STA DLIC+1
	STA SPFLG
	JMP BFLP
;
CU3	INX 
	LDA L
	CLC 
	ADC #3
	STA L
	BCC CMBG
	INC L+1
	BNE CMBG
;show col/row	;!!!!!!!! INVERSE CHARS !!!!!!!!
SHWCRI	LDA SCOL
	LDX #0
XGZ	SEC 
	SBC #26
	BMI XGY
	INX 
	BNE XGZ
XGY	PHA 
	TXA 
	CLC 
	ADC #$A1
	STA SCMEM+19
	PLA 
	CLC 
	ADC #$BB
	STA SCMEM+20
	LDX SROW
	INX 
	TXA 
	LDX #0
XGU	SEC 
	SBC #10
	BMI XGV
	INX 
	BNE XGU
XGV	PHA 
	TXA 
	CLC 
	ADC #$90
	STA SCMEM+21
	PLA 
	CLC 
	ADC #$9A
	STA SCMEM+22
	RTS 
;print sheet	;!!!!!!!! INVERSE CHARS !!!!!!!!
PRNT	JSR CLRTXT
	LDA #'P
	STA FNAME
	LDA #':
	STA FNAME+1
	LDA #EOL
	STA FNAME+2
	LDA # >PRITMS
	LDX # <PRITMS
PRNTIT	LDY #0
	STY CPOS 	;curs. index
	JSR PRNTTW
	JSR PRMS1
	JSR STCRS
	JSR PRMS2
	JSR STCRS
	LDA COLF
	STA TM 	;1st col
	LDA COLS
	SEC  	;chk cell range
	SBC COLF
	BMI PERRR
	LDA ROWS
	SEC 
	SBC ROWF
	BPL PROK
PERRR	LDY #141 	;range err
PERRA	JSR DSKERR
	JMP HM3
;open #2 P:	;!!!!!!!! INVERSE CHARS !!!!!!!!
PROK	  CLOSE 2
	LDX #$20
	LDA #3
	STA ICCOM,X
	LDA # >FNAME
	STA ICBAH,X
	LDA # <FNAME
	STA ICBAL,X
	LDA #0
	STA AUX2,X
	LDA #8
	STA AUX1,X
	JSR CIOV
	BMI PERRA
PXD	LDX TM 	;curr col
	LDA COLW,X 	;get width
	STA GMX
	LDA ROWF
	JSR LOCCEL
	BCS CMTE 	;empty
	LDY #1
	LDA (LL),Y
	STA FORMAT
	LDY #3
	LDA (LL),Y
	BPL PXF
	JMP ISERR 	;error	;!!!!!!!! INVERSE CHARS !!!!!!!!
PXF	AND #3
	BEQ PXA 	;text
	JMP ITSAN 	;#/F
PXA	LDY #2
	LDA (LL),Y
	TAY 
	JSR ADDDT 	;up 4
	LDA #EOL
	STA STRING,Y
PXC	DEY 
	BMI PXB
	LDA (LL),Y
	STA STRING,Y
	JMP PXC
PXB	LDA # <STRING
	STA IL
	LDA # >STRING
	STA IL+1
	JSR FRMTXT
PXE	JSR SNDOUT
	INC TM 	;do nxt col
	LDA TM
	CMP COLS
	BEQ PXD
	BCC PXD
	LDA COLF
	STA TM
	JSR SNDEOL 	;snd eol
	INC ROWF 	;next row
	LDA ROWF
	CMP ROWS
	BEQ PXD
	BCC PXD
	  CLOSE 2
	RTS  	;done	;!!!!!!!! INVERSE CHARS !!!!!!!!
;send out blanks	;!!!!!!!! INVERSE CHARS !!!!!!!!
CMTE	JSR SPLBF
	JMP PXE
;line feed	;!!!!!!!! INVERSE CHARS !!!!!!!!
SNDEOL	LDA #11
	LDX #$20
	STA ICCOM,X
	LDA #0
	STA ICBLL,X
	STA ICBLH,X
	LDA #$9B
	JSR CIOV
	BMI LSERR
	RTS 
;send out cell	;!!!!!!!! INVERSE CHARS !!!!!!!!
SNDOUT	LDA #11
	LDX #$20
	STA ICCOM,X
	LDA GMX
	STA ICBLL,X
	LDA #0
	STA ICBLH,X
	LDA # >LBUF
	STA ICBAH,X
	LDA # <LBUF
	STA ICBAL,X
	JSR CIOV
	BMI LSERR
	RTS 
;list/prnt err	;!!!!!!!! INVERSE CHARS !!!!!!!!
LSERR	PLA 
	PLA 
	JMP GENER
;space out lbuf	;!!!!!!!! INVERSE CHARS !!!!!!!!
SPLBF	LDX #$7F
	LDA #$20
SL9	STA LBUF,X
	DEX 
	BPL SL9
	RTS 
;err in cell	;!!!!!!!! INVERSE CHARS !!!!!!!!
ISERR	JSR SPLBF
	LDY #4
ISA	LDA CERR,Y
	STA LBUF,Y
	DEY 
	BPL ISA
	JMP PXE
;its a # or F	;!!!!!!!! INVERSE CHARS !!!!!!!!
ITSAN	CMP #1
	BNE ITSAF
	JSR ADDDT
	LDX LL
	LDY LL+1 	;???	;!!!!!!!! INVERSE CHARS !!!!!!!!
ITSG	JSR FLD0R
	JSR FASC
	JSR FRMNUM
	JMP PXE
;must be a F	;!!!!!!!! INVERSE CHARS !!!!!!!!
ITSAF	LDY #2
	LDA (LL),Y
	TAY 
	JSR ADDDT
	TYA 
	SEC 
	SBC #6
	CLC 
	ADC LL
	TAX 
	LDA LL+1
	ADC #0
	TAY 
	JMP ITSG
;list to disk	;!!!!!!!! INVERSE CHARS !!!!!!!!
LIST	JSR ST2BF1
	JSR FINARG
	JSR GTFILE
	JSR CHKDEV
	BCC LDOK
	JMP DEVERR
LDOK	JSR FILEXST
	BCC FILOK
	JMP HOME
FILOK	JSR CLRTXT
	LDA # >LSMES
	LDX # <LSMES
	JMP PRNTIT
;copy & move	;!!!!!!!! INVERSE CHARS !!!!!!!!
;cmflg 0=cpy 1=mov	;!!!!!!!! INVERSE CHARS !!!!!!!!
;copy a block verbatim	;!!!!!!!! INVERSE CHARS !!!!!!!!
COPY	JSR CLRTXT
	LDA # >CPYMES
	LDX # <CPYMES
	LDY #0
	STY CMFLG
JMCPY	STY CPOS
	JSR PRNTTW
	JSR PRMS1
	JSR STCRS
	JSR PRMS2
	JSR STCRS
	JSR PRMS3
	JSR STCRS
;chk for block errs	;!!!!!!!! INVERSE CHARS !!!!!!!!
	LDA COLS
	CMP COLF
	BCS CLOK
CSER	JMP PERRR
CLOK	LDA ROWS
	CMP ROWF
	BCC CSER
;chk if dest = corners	;!!!!!!!! INVERSE CHARS !!!!!!!!
	LDA COLT
	CMP COLF
	BNE LOWR
	LDA ROWT
	CMP ROWF
	BEQ CSER
LOWR	LDA COLT
	CMP COLS
	BNE CKOK
	LDA ROWT
	CMP ROWS
	BEQ CSER
;set cntrs	;!!!!!!!! INVERSE CHARS !!!!!!!!
CKOK	LDA COLS
	SEC 
	SBC COLF
	STA DM4
	STA DM2
	LDA ROWS
	SEC 
	SBC ROWF
	STA DM5
;offsets	;!!!!!!!! INVERSE CHARS !!!!!!!!
	SEC 
	LDA COLT
	SBC COLF
	STA COFST
	SEC 
	LDA ROWT
	SBC ROWF
	STA ROFST
	JSR CHKFSD 	;A =typ inc
	ASL A
	TAX 
	LDA INCTAB,X
	STA INCRES+1
	LDA INCTAB+1,X
	STA INCRES+2
	JSR IVCRS
CPY1	LDA COLF
	STA DM6
	LDA COLT
	STA DM7
CPY5	LDA ROWT 	;dest
	JSR STRAD 	;get add
CPY2	LDY #0 	;see if MT
	LDA (LL),Y
	CMP #$FF 	;MT
	BEQ NOEN
	CMP DM7 	;col?
	BEQ FUL
	BCS NOEN
	JSR UP1COL
	JMP CPY2
FUL	LDX DM7
	LDA ROWT
	JSR DELTCL
NOEN	LDA LL
	STA IL
	LDA LL+1
	STA IL+1
	LDA ROWF
	JSR STRAD
CPY3	LDY #0 	;chk source
	LDA (LL),Y
	CMP #$FF
	BEQ INCRES 	;no cell
	CMP DM6 	;col?
	BEQ GT1
	BCS INCRES 	;no cell
	JSR UP1COL
	JMP CPY3
;move cell to bf1	;!!!!!!!! INVERSE CHARS !!!!!!!!
GT1	LDA # >BF1
	STA JL+1
	LDA # <BF1
	STA JL
	LDY #2
	LDA (LL),Y
	CLC 
	ADC #DTLEN
	TAY 
	DEY 
	STA LENG 	;4 move
	STY GMX
CPY4	LDA (LL),Y
	STA (JL),Y
	DEY 
	CPY #$FF
	BNE CPY4
	LDA DM7 	;new col #
	STA BF1
	LDA IL
	STA LL
	LDA IL+1
	STA LL+1
	LDA CMFLG
	BEQ NOCHG
	JSR MVPARS
NOCHG	LDY GMX
	INY 
	STY LENG
	JSR MOVUP
	LDA ROWT
	JSR UPRAD
	LDY GMX
CPY6	LDA (JL),Y
	STA (IL),Y
	DEY 
	CPY #$FF
	BNE CPY6
INCRES	JSR $FFFF
	BCS CFIN
	JMP CPY5
CFIN	JSR RECALC
	JSR REFSCR
	JSR IVCRS
	CLC 
	RTS 
;increase ptr routs	;!!!!!!!! INVERSE CHARS !!!!!!!!
RTDN	INC DM7
	INC DM6 	;next col
	DEC DM4
	LDA DM4
	CMP #$FF
	BNE RBX
RBZ	INC ROWT 	;next row
	INC ROWF
RRR	DEC DM5
	LDA DM5
	CMP #$FF
	BNE RBY
	SEC  	;done
	RTS 
RBY	LDA COLF
	STA DM6
	LDA COLT
	STA DM7
	LDA DM2
	STA DM4
RBX	CLC 
	RTS  	;keep going
;
RTUP	INC DM7
	INC DM6
	DEC DM4
	LDA DM4
	CMP #$FF
	BNE RBX
	DEC ROWT
	DEC ROWF
	JMP RRR
;
LFDN	DEC DM7
	DEC DM6
	DEC DM4
	LDA DM4
	CMP #$FF
	BNE RBX
	BEQ RBZ
;check source,end &dest. cell	;!!!!!!!! INVERSE CHARS !!!!!!!!
;if in sheet	;!!!!!!!! INVERSE CHARS !!!!!!!!
CHKFSD	LDA ROWT
	CMP ROWF
	BNE TBFH
	LDA COLT 	;A,E
	CMP COLF
	BNE VAE
VER	PLA  	;error
	PLA 
	JMP PERRR
VAE	BCC VEE 	;E
	LDA COLS 	;A
	SEC 
	SBC COLF
	CLC 
	ADC COLT
	STA COLT
	CMP #64 	;0-63
	BCS VER
	LDA COLS 	;switch
	PHA 
	LDA COLF
	STA COLS
	PLA 
	STA COLF
	LDA #1 	;lfdn
	CLC 
	RTS 
VEE	LDA #0 	;rtdn
	CLC 
	RTS 
TBFH	BCC VEE
	LDA ROWS
	SEC 
	SBC ROWF
	CLC 
	ADC ROWT
	STA ROWT
	CMP #64
	BCS VER
	LDA ROWS 	;switch
	PHA 
	LDA ROWF
	STA ROWS
	PLA 
	STA ROWF
	LDA #2 	;rtup
	CLC 
	RTS 
;
INCTAB	.WORD RTDN
	.WORD LFDN
	.WORD RTUP
;prn ms3	;!!!!!!!! INVERSE CHARS !!!!!!!!
PRMS3	LDA #2
	STA ASAV
	LDA # >CMES3
	LDX # <CMES3
	LDY #3
	JMP PRMA
;move block	;!!!!!!!! INVERSE CHARS !!!!!!!!
MOVEB	JSR CLRTXT
	LDA #1
	STA ASAV
	STA CMFLG
	LDA # >MOVMES
	LDX # <MOVMES
	LDY #0
	JMP JMCPY 	;jmp in2 cpy
;reassign cell values	;!!!!!!!! INVERSE CHARS !!!!!!!!
;if error = changed to eol	;!!!!!!!! INVERSE CHARS !!!!!!!!
;dm0,dm1 used	;!!!!!!!! INVERSE CHARS !!!!!!!!
MVPARS	LDY #4
	LDA BF1,Y
	CMP #'=
	BEQ JAA
JAB	RTS  	;quit
JAA	INY 
	CPY GMX 	;max len
	BCS JAB 	;end!
	LDA BF1,Y
	CMP #'D
	BCS JAA 	;nxt
	CMP #'A
	BCC JAA
	STY Y9 	;get cell
	JSR GTCLRW
	BCC JAC
JAD	LDY Y9
	BNE JAA
JAC	LDA COLNU
	CLC 
	ADC COFST 	;col offset
	STA COLNU
	CMP #64
	BCS JAB 	;err
	LDA ROWNU
	CLC 
	ADC ROFST 	;row offset
	STA ROWNU
	CMP #64
	BCS JAD 	;err
	LDY Y9
;now change'm	;!!!!!!!! INVERSE CHARS !!!!!!!!
	LDX #2
	LDA COLNU
JAE	CMP N26,X
	BCS JAF
	DEX 
	BPL JAE
JAF	PHA 
	LDA AS26,X
	STA BF1,Y
	PLA 
	SEC 
	SBC N26,X
	CLC 
	ADC #65
	INY 
	STA BF1,Y
	INC ROWNU
	LDA ROWNU
	LDX #9
JAH	CMP DECM,X
	BCS JAG
	DEX 
	BPL JAH
JAG	PHA 
	LDA DECN,X
	INY 
	STA BF1,Y
	PLA 
	SEC 
	SBC DECM,X
	TAX 
	LDA DECN,X
	INY 
	STA BF1,Y
	JMP JAA
;recalc 	;!!!!!!!! INVERSE CHARS !!!!!!!!
RECALC	LDA #0
	STA ROWNU
	STA COLNU
	LDA RCFLG
	BNE BYC
;by rows	;!!!!!!!! INVERSE CHARS !!!!!!!!
IG	JSR RARITH
	INC COLNU
	LDA COLNU
	CMP #64
	BCC IG
	LDA #0
	STA COLNU
	INC ROWNU
	LDA ROWNU
	CMP #64
	BCC IG
BYR	JSR REFSCR
	JMP IVCRS
;by cols	;!!!!!!!! INVERSE CHARS !!!!!!!!
BYC	JSR RARITH
	INC ROWNU
	LDA ROWNU
	CMP #64
	BCC BYC
	LDA #0
	STA ROWNU
	INC COLNU
	LDA COLNU
	CMP #64
	BCC BYC
	BCS BYR 	;done
;arith done here	;!!!!!!!! INVERSE CHARS !!!!!!!!
RARITH	LDA ROWNU
	LDX COLNU
	STA TA1
	STX TA2
	JSR LOCCEL
	BCC RBD
RBFF	JMP RBGH 	;none
RBD	LDA LL
	STA TA3
	LDA LL+1
	STA TA4
	LDY #3
	LDA (LL),Y
	BMI RBFF 	;err
	CMP #2 	;func?
	BNE RBFF 	;no
	DEY 
	LDA (LL),Y
	SEC 
	SBC #6
	TAY  	;end of F
	LDA #EOL
	STA STRING,Y
	JSR ADDDT 	;up 4
RRJ	DEY 
	BMI RRB
	LDA (LL),Y
	STA STRING,Y
	JMP RRJ
RRB	JSR TRYFNC
	LDA TA3
	STA LL
	LDA TA4
	STA LL+1
	LDY #2
	LDA (LL),Y
	SEC 
	SBC #2
	CLC 
	ADC LL
	STA FLPTR
	LDA LL+1
	ADC #0
	STA FLPTR+1
	JSR FST0P
RBGH	LDA TA1
	STA ROWNU
	LDA TA2
	STA COLNU
	RTS 
;delete block	;!!!!!!!! INVERSE CHARS !!!!!!!!
DELETE	JSR CLRTXT
	LDA # >DELMS
	LDX # <DELMS
	LDY #0
	STY CPOS
	JSR PRNTTW
	JSR PRMS1
	JSR STCRS
	JSR PRMS2
	JSR STCRS
	LDA COLS
	CMP COLF
	BCC KER
	LDA ROWS
	CMP ROWF
	BCS DLC
KER	JMP PERRR 	;ERR 141
;now delete
DLC	LDA COLF
	STA COLT
DLB	LDX COLT
	LDA ROWF
	JSR LOCCEL
	BCS DLA
	LDA ROWF
	JSR DELTCL
DLA	INC COLT
	LDA COLT
	CMP COLS
	BEQ DLB
	BCC DLB
	INC ROWF
	LDA ROWF
	CMP ROWS
	BEQ DLC
	BCC DLC
	JSR CLRTXT
	JSR CLRSCN
	JSR REFSCR
	JMP IVCRS 	;done
;prnt in txtwind	;!!!!!!!! INVERSE CHARS !!!!!!!!
;asav=hpos A=hi X=lo Y=lin#	;!!!!!!!! INVERSE CHARS !!!!!!!!
PRNTTW	STA IL+1
	STX IL
	STY YSAV
	LDA TWINL,Y
	CLC 
	ADC #2
	STA L
	LDA TWINH,Y
	ADC #0
	STA L+1
	LDY #0
PR1	LDA (IL),Y
	CMP #EOL
	BEQ PR2
	STA (L),Y
	INY 
	BNE PR1
PR2	RTS 
;get RET/ESC	;!!!!!!!! INVERSE CHARS !!!!!!!!
RETESC	JSR GNKEY
	CMP #$9B
	BNE III
	CLC 
	RTS 
III	CMP #$1B
	BNE IIT
	SEC 
	RTS 
IIT	JSR MVCRS 	;move?
	JMP RETESC
;stor crs pos	;!!!!!!!! INVERSE CHARS !!!!!!!!
STCRS	LDX CPOS
	LDA SCOL
	STA COLF,X
	LDA SROW
	STA ROWF,X
	INC CPOS
	RTS 
;print ms1	;!!!!!!!! INVERSE CHARS !!!!!!!!
PRMS1	LDA # >CMES1
	LDX # <CMES1
	LDY #1
PRMA	STY YSAV 	;line#
	JSR PRNTTW
	JSR RETESC
	BCS EOUT
	RTS 
EOUT	PLA  	;exit
	PLA 
	JSR CLRTXT
	RTS 
;prn ms2	;!!!!!!!! INVERSE CHARS !!!!!!!!
PRMS2	LDA # >CMES2
	LDX # <CMES2
	LDY #2
	JMP PRMA 	;cheat
;chk parmeters	;!!!!!!!! INVERSE CHARS !!!!!!!!
;locat cell	;!!!!!!!! INVERSE CHARS !!!!!!!!
;X=col A=row ll=loc	;!!!!!!!! INVERSE CHARS !!!!!!!!
LOCCEL	STX COLNU
	JSR STRAD
FU	LDY #0
	LDA (LL),Y
	CMP #$FF
	BEQ FQE
	CMP COLNU
	BEQ FQF
	BCC FQG
FQE	SEC 
	RTS 
FQG	JSR UP1COL
	JMP FU
FQF	CLC 
	RTS 
