LEX 'CURLEX' Curser control LEX file TITLE Cursor LEX 1985/03/16 John R Baker 618 * revised Ver.<850623>, trapped calc mode ID #5E last scratch ID MSG 0 no message table POLL POLHND poll handler code ENDTXT no keywords * ************************ * these are the equates * pKYDF EQU #0001B the key definition poll flCALC EQU #FFFC0 calc mode flag flUSER EQU #FFFF7 user mode flag SFLAG? EQU #1364C routine to test system flags gLEFT EQU #0009F key number for g< key gRIGHT EQU #000A0 key number for g> key CSLC5 EQU #1B435 C shift left 5 nibs ESCSEQ EQU #023C1 sends escape sequences to the display CSRC5 EQU #1B41B C shift right 5 nibs * ************************ * POLHND LC(2) pKYDF ?B=C B is this key definition poll? GOYES tstkey yes, continue RTNSXM no, return, XM set ************************ tstkey C=D A save D(A), position in LEX buffer R3=C in R3 LC(2) flCALC GOSBVL SFLAG? is CALC mode active ? GOC Keyext yes, exit, CALC not allowed LC(2) flUSER no, continue GOSBVL SFLAG? is USER mode on ? GOC key01 yes, continue Keyext C=R3 no D=C A restore D(A) RTNSXM return, XM set ************************ key01 C=R3 D=C A restore D(A) C=R0 get current key GOSBVL CSRC5 put in C(A), (actually C(B)) A=C A put in A(A), (actually A(B)) LC(2) gLEFT ?A=C B is it g< ? (blue-shift left arrow) GOYES left yes, go load left escape sequence LC(2) gRIGHT no, load C with right key ?A=C B is it g> ? (blue-shifted right arrow) GOYES right yes, go load right escape sequence RTNSXM no, return, not a key we recognise ************************ left LC(2) #44 escape sequence, cursor left GOTO key02 continue with common code ************************ right LC(2) #43 escape sequence, cursor right ************************ key02 C=0 M preclear M field P= 3 set to load M field for counter LC(2) 21 counter for 21 shifts P= 0 reset P to zero R3=C store escape char & counter in R3 ************************ C=RSTK save 3 return stack levels GOSBVL CSLC5 only 2 available C=RSTK and we need 5 GOSBVL CSLC5 ESCSEQ needs 4 & we need 1 to call C=RSTK R0=C save stack levels in R0 ************************ loop C=R3 put escape char in C(B) C=C-1 M decrement counter field GOC key03 if carry set, we are done R3=C save new counter value in R3 GOSBVL ESCSEQ send sequence to LCD and pil display GONC loop BET, loop again ************************ key03 C=R0 restore return stack RSTK=C GOSBVL CSRC5 RSTK=C GOSBVL CSRC5 RSTK=C ************************ ST=0 0 say we're not returning a value * that is, we 'acted' on the key XM=0 indicate poll 'handled', polling stops RTN return to character editor * ************************ * * for further information see IDS VOL 3 * module MN&ED [14C99], the Character Editer * module SB&DSP [01C3C], the Display Driver * END