C C=========================================================================== C C MATROX TEK 4010 graphics emulator (not using internal scaling) C C 8.0" x 6.0" (1235 x 240) via small TEK (975 x 739) C C=========================================================================== C JDEV = JDEV - 1 IF (JDEV .NE. 0) GOTO 6999 C IF ((IMODE .LT. -5) .OR. (IMODE .GT. 6)) RETURN GOTO (6000,6005,6010,6020,6030,6040,6050,6060,6070,6090, 1 6100,6200),IMODE+6 C C mode -5: we exist C 6000 X = 1.0 GOTO 90 C C mode -4: initialize C 6005 CALL GTATT(LUNGRP) ! and attach the terminal, set up loon GOTO 90 C C mode -3: return screen size C 6010 X = 8.0 Y = 6.0 GOTO 90 C C mode -2: alpha cursor position C 6020 CALL GTTEKI(IX,IY,I,2) ! request alpha cursor X = IX / 121.875 Y = IY-16 / 115.333 ! this thing displays 16-255 (?) GOTO 90 C C mode -1: graphics cursor position C 6030 CALL GTTEKI(IX,IY,I,1) ! request graphics cursor X = IX / 121.875 Y = IY-16 / 115.333 XT = XTLAST YT = YTLAST GOTO 6050 ! reposition cursor with a dark vector C C mode 0: clear screen C 6040 CALL GT(ESCAPE) ! make sure we're in transparent mode CALL GT('2') CALL GT(ESCAPE) ! make sure we're in ANSI mode CALL GT('<') CALL GT(ESCAPE) ! erase all CALL GT('[2J') CALL GT("35) ! now to 4010 mode CALL GT(ESCAPE) ! tell it we're going to configure it CALL GT('TA') CALL GT(ESCAPE) ! nibs = 1 CALL GT('TB') CALL GT(ESCAPE) ! solid line CALL GT('`') CALL GT(ESCAPE) ! exit configure mode CALL GT('T@') CALL GT(ESCAPE) ! erase graphics memory CALL GT("14) CALL GT(ESCAPE) ! and back to transparent mode CALL GT('2') CALL GTF ! flush the buffer (do it) LINPAT = -1 ! initialization does this ... NIBS = 1 GOTO 90 C C mode 1: unwritten vector C 6050 CALL GT("35) ! invokes graphics; dark vect 1st GOTO 6080 C C mode 2: written vector C 6060 GOTO 6080 ! must assume in graf mode. do it. C C mode 3: point plot C 6070 CALL GT("34) ! invokes point plot mode C C modes 1,2,3: send out the X,Y coordinates C 6080 IX = MIN1(975.,AMAX1(0.,121.875*XT+0.5)) IY = MIN1(692.,AMAX1(0.,115.333*YT+0.5)) + 16 CALL GTTEK(IX,IY) GOTO 90 C C mode 4: finish the plot C 6090 CALL GT("35) ! dark vector CALL GTTEK(0,692) ! to the top left corner CALL GT("15) ! enter alpha mode CALL GT(ESCAPE) ! enter transparent mode CALL GT('2') CALL GTF ! flush the buffer CALL GTATT(-LUNGRP) ! deattach the terminal CALL CLOSE(LUNGRP) GOTO 90 C C mode 5: set nibs (X;pen width) and line pattern (Y) C 6100 IX = X IF (IX .EQ. NIBS) GOTO 6102 NIBS = IX IF (NIBS .LT. 1) NIBS = 1 IF (NIBS .GT. "37) NIBS = "37 CALL GT(ESCAPE) ! set configure mode CALL GT('TA') CALL GT(ESCAPE) ! set the pen width CALL GT('Sa ') CALL GT("100+NIBS) ! This is the actual width CALL GT(ESCAPE) ! get out of configure mode CALL GT('T@') C C line pattern generation (only one set of on/off distances allowed) C 6102 IY = Y ! get line pattern IF (IY .EQ. LINPAT) GOTO 90 ! if set, don't change LINPAT = IY ! set for later CALL GT(ESCAPE) ! set up configure mode CALL GT('TA') CALL GT(ESCAPE) ! init. for new pattrn IF (LINPAT .NE. -1) GOTO 6105 CALL GT('`') ! use solid line GOTO 90 C C non-solid line - figure it out C 6105 CALL GT('D ') YT = Y IF (YT .LT. 0) YT = YT + 65536.0 ! YT = real 0-65k IY = 1 IX = 1 ! counts # bits on/off C main loop - count down from the top DO 6140 I=15,0,-1 XT = 2.0**FLOAT(I) ! XY = value of a bit N = 0 ! N will be the bit IF ((XT - 0.1) .GT. YT) GOTO 6110 ! account of roundoff N = 1 ! this bit was set YT = YT - XT ! reduce our counter C now, N is the value of the next bit, YT reduced if needed 6110 IF (N .NE. IY) GOTO 6120 C we're counting this type (IY=0 ==> off ==> N=0, etc) IX = IX + 1 GOTO 6140 C bits changed from on to off, or vise versa. ship out bits, set up new 6120 IF (IY .EQ. 0) GOTO 6150 CALL GT("140+IX) CALL GT(' ') IY = 0 ! set up to count the bits off IX = 1 6140 CONTINUE C IF (IY .EQ. 0) GOTO 6150 ! go send out the off count CALL GT("140+IX) ! ship out last of the ons CALL GT(' ') IX = 1 ! set up at least on off bit 6150 CALL GT("100+IX) ! send out the off count CALL GT(ESCAPE) ! get out of configure mode CALL GT('T@') GOTO 90 C C mode 6: identify ourself C 6200 WRITE (LUN,6210) 6210 FORMAT('+ VT100 with MATROX adapter') GOTO 90 C C all done - get ready for the next C 6999 CONTINUE