
S1C88409 TECHNICAL MANUAL
EPSON
237
APPENDIX: CONTROLLING THE TOUCH PANEL CONTROLLER
JRS
TCGETCD14
TCGETCD12:
;else (switch = 1) then
M_BSET
tpc_flg0,TC_SWITCH1,A
;
switch1 = 1
TCGETCD14:
(8) Calculate X coordinate
LD
BA,HL
;BA = x axis data (xtgt)
LD
HL,[tc_xorg]
;HL = x axis origin data (xorg)
SUB
BA,HL
;BA=xtgt - xorg
JRS
NC,TCGETCD20
;if xtgt - xorg < 0 then
LD
BA,#0
;
xtgt - xorg = 0
TCGETCD20:
LD
L,[tc_xsft]
;L = shift counter
INC
L
TCGETCD30:
DEC
L
JRS
Z,TCGETCD40
SRL
B
;shift 1 bit to right
RR
A
JRS
TCGETCD30
TCGETCD40:
SRL
B
JRS
C,TCGETCD45
;if B reg is not 0 then over flow
LD
L,#D_PXL_X
;L = display dot number (DMAX)
MLT
;HL = DMAX * (xtgt - xorg)
LD
A,[tc_xspn]
;A = x axis coordinate span (xspn)
DIV
;L = DMAX * (xtgt - xorg) / xspn
CP
L,#D_PXL_X
;if x coord
≥ MAX then
JRS
C,TCGETCD50
TCGETCD45:
LD
L,#D_PXL_X-1
;
x coord = MAX-1
TCGETCD50:
LD
BA,[IX]
;BA = y axis data (ytgt)
LD
[IX],L
;wk0 = x axis coordinate
(9) Calculate Y coordinate
;BA = y axis data (ytgt)
LD
HL,[tc_yorg]
;HL = y axis origin data (yorg)
SUB
BA,HL
;BA = ytgt - yorg
JRS
NC,TCGETCD60
;if ytgt - yorg < 0 then
LD
BA,#0
;
ytgt - yorg = 0
TCGETCD60:
LD
L,[tc_ysft]
;L = shift counter
INC
L
TCGETCD70:
DEC
L
JRS
Z,TCGETCD80
SRL
B
;shift 1 bit to right
RR
A
JRS
TCGETCD70
TCGETCD80:
SRL
B
JRS
C,TCGETCD85
;if B reg is not 0 then over flow
LD
L,#D_PXL_Y
;L = display dot number (DMAX)
MLT
;HL = DMAX * (ytgt - yorg)
LD
A,[tc_yspn]
;A = y axis coordinate span (yspn)
DIV
;L = DMAX * (ytgt - yorg) / yspn
CP
L,#D_PXL_Y
;if y coord
≥ MAX then
JRS
C,TCGETCD90
TCGETCD85:
LD
L,#D_PXL_Y-1
;
y coord = MAX - 1
TCGETCD90:
LD
A,L
;A = y axis coordinate
LD
B,[IX]
;A = x axis coordinate
(10) Restore the saved register and release the work area
ADD
SP,#2
;2 byte returned
POP
HL
;HL register is returned
POP
IX
;IX register is returned
POP
SC
;SC register is returned
RET