PROGRAM PLT1 C C..... This module tests the special keyboard C..... functions for the PLTRTN. It will return the C..... READ status and display other info about the C..... READ. Screen clear is performed each time. C..... CTRL-Z(^Z) will allow the user to exit the C..... program. C..... Set up needed arrays DIMENSION ISTAT(2) LOGICAL*1 BUFF(80) C..... Set up the major loop. CALL CLRSCN(1,1) ! Clear the screen CALL ESCSET(1) ! SET TER ESC C CALL AUTOCR(0) ! Set ter NOCARRIAGE C..... The timeout is a MOD-10 number. That is, C..... it is specified in terms of tens of seconds. C..... Therefore, for a 10 second wait , the timeout C..... value would be 1. ITMO = 10/10 ! Set timeout value 10 CALL PSREAD(BUFF,80,2,1,ISTAT,ITMO) ! Read the input line IF (ISTAT(1) .EQ. -10) GO TO 200 ! EOF - Then exit ILEN=ISTAT(2) ! Set string length IF (ISTAT(2) .EQ. 0) ILEN = 1 ! No length, use dummy C..... Now output the INFO to the user CALL CLRSCN(3) ! Clear the screen WRITE (5,100) ISTAT(1),ISTAT(2),(BUFF(I),I=1,ISTAT(2)) 100 FORMAT(1X,'Return status was [',I6,']',/, 1 1X,'Characters read [',I6,']',/, 2 1X,'Input string was [',A1,']') GO TO 10 C..... exit stuff 200 CONTINUE C..... Now let's try to use these to do something C..... practical!(Heaven forbid). C C..... The following definitions are what are returned C..... to us for status. C..... Cursor up = -24575 C..... Cursor down = -24319 C..... Cursor right = -24063 C..... Cursor left = -23807 C..... Break key = -00066 C..... End-Of-File = -00010 C..... New line = +00013 C..... What I'm going to do is to allow you to use the C..... four arrow keys to move about the screen. Press the C..... "BREAK" key to erase the screen, "^Z" to exit program. IROW = 1 ICOL = 1 201 CALL CLRSCN(1) ! Clear the screen 202 CALL PSREAD(BUFF,80,IROW,ICOL,ISTAT) ! Read from the screen IF (ISTAT(1) .EQ. -10) GO TO 300 IF (ISTAT(1) .NE. +13) GO TO 204 ICOL=1 IROW=IROW+1 IF (IROW .GT. 24) IROW = 1 GO TO 202 204 IF (ISTAT(1) .NE. -66) GO TO 210 GO TO 201 ! Break key, clear the screen 210 IF (ISTAT(1) .NE. -24575) GO TO 220 IROW=IROW-1 ! Cursor Up IF (IROW .LT. 1) IROW=24 GO TO 202 220 IF (ISTAT(1) .NE. -24319) GO TO 230 IROW = IROW+1 IF (IROW .GT. 24) IROW = 1 GO TO 202 230 IF (ISTAT(1) .NE. -24063) GO TO 240 ICOL = ICOL+1 IF (ICOL .GT. 80) ICOL = 1 GO TO 202 240 IF (ISTAT(1) .NE. -23807) GO TO 202 ICOL=ICOL-1 IF (ICOL .LT. 1) ICOL=80 GO TO 202 300 CALL CLRSCN(1) ! Clear the screen CALL ESCSET(0) ! Set ter NOESC CALL AUTOCR(1) ! Set ter CARRIAGE STOP END