Asynchronous Terminals and Printer Processes Programming Manual

TERMINAL PROGRAMMING CONSIDERATIONS
Page Mode
INT .BUFFER[0:1023], ! screen input buffer
.CONTROL^BUF[0:1], ! for sending escape
! sequences to terminal
COUNT^READ; ! number of bytes read
STRING
.SBUFFER := @BUFFER '<' 1, ! redefine as byte
! array
.SCONTROL^BUF := @CONTROL^BUF '<' 1; !
LITERAL
READCOUNT = 2048, ! read count for full screen
ESC = %33, ! ASCII ESC character
CLEAR^SPACES = ";", ! "esc,clear^spaces"= clear screen
TBLOCK^MODE = "B", ! "esc,tblock^mode"= set tblock mode
TCONV^MODE = "C", ! "esc,tconv^mode" = set tconv mode
SENDALL = "5", ! "esc,sendall" = send page
! unprotected, to cursor
CHANGE^MODE = 8, ! set mode, set transfer mode function
CONV^MODE = 0, ! set mode parameter 1, set conv mode
PAGE^MODE = 1; ! set mode parameter 1, set page mode
.
! put the file into page mode
CALL SETMODE ( TERM^NUM, CHANGE^MODE, PAGE^MODE );
IF < THEN ... ; ! error
.
.
! clear the screen, put the terminal into block mode, then
! wait for function key to be pressed
SCONTROL^BUF ':=' [ ESC, CLEAR^SPACES, ESC, TBLOCK^MODE ];
CALL WRITEREAD ( TERM^NUM, CONTROL^BUF, 4, 2 );
IF = THEN ! function key pressed
BEGIN
.
! examine the returned data in the buffer to determine which
! key was pressed
! writeread completes when the operator presses a function key
.
END
ELSE
IF < THEN ... ; ! error
! read the screen.
SBUFFER ':=' [ ESC, SENDALL ];
! send "send page unprotected" escape sequence to the terminal
CALL WRITEREAD (TERM^NUM, BUFFER, 2, READCOUNT , COUNT^READ);
IF < THEN ... ; ! error
4-11