public tekemu,tekini,tekrint,tekend,tekgraf ; Terminal emulation public tekcls, tekesc, tekflg ; used by msz file include ccsdef.h ENQ equ 05h ; ^E ENQ for TEK enquiries CAN equ 18h ; ^X to return to ANSI mode ESCZ equ 1Ah ; SUB, ESC-^Z triggers crosshairs VT equ 0bh ; ^K go up one line FS equ 1ch ; ^\ for point plot mode GS equ 1Dh ; ^] draw line (1st move is invisible) RS equ 1Eh ; ^^ for incremental line plot mode US equ 1Fh ; ^_ (underscore) returns to text mode accent equ 60h ; accent grave txtmode equ 4 ; text mode for TEKTRONIX status maxtekx equ 1024 ; horizontal and maxteky equ 780 ; vertical resolution of TEK 4010 screen equ 10h ; IBM Bios screen call uparr equ 72 ; DOS scan codes for arrow keys dnarr equ 80 lftarr equ 75 rgtarr equ 77 homscn equ 71 ; DOS home screen scan code shuparr equ '8' ; ascii codes for shifted arrows shdnarr equ '2' shlftarr equ '4' shrgtarr equ '6' ; Graph_mode for different systems: cga equ 6 ; highest resolution mode for CGA mono equ 7 ; real monochrome display adapter colorega equ 14 ; Low-res mode, color EGA monoega equ 15 ; mono ega needs mode 15 ega equ 16 ; Hi-res mode - EGA olivetti equ 72 ; Olivetti's Hi-res - 50 lines text toshiba equ 74h ; Toshiba T3100, like Olivetti vaxmate equ 0D0h ; DEC VAXmate II, like Olivetti hercules equ 255 ; pseudo mode for Hercules graphics ; Note: IBM VGA modes 17 & 18, 640 by 480, can be used by setting "ega" above ; to 17 or 18 and modifying ybot to be 479 and ymult to be 48 at label tekin5. ; The code will scale everything appropriately for the new screen size, but ; there will be insufficient memory to retain the entire graphics image. ; Manual override SET TERMINAL GRAPHICS VGA accomplishes these two steps. segega equ 0a000h ; segments of display memory, EGA,VGA segcga equ 0b800h ; CGA, AT&T/Olivetti and relatives seghga equ 0b000h ; HGA segmono equ 0b000h ; Monochrome ; Hercules equates: index equ 03b4h ; 6845 index register cntrl equ 03b8h ; Display mode control port hstatus equ 03bah ; status port scrn_on equ 8 ; bit to turn screen on grph equ 2 ; graphics mode text equ 20h ; text mode config equ 03bfh ; configuration port genable equ 1+2 ; enable graphics (1) on two pages (2) hiy equ 1 ; codes for Tek graphics components loy equ 2 hix equ 4 lox equ 3 datas segment public 'datas' extrn flags:byte, portval:word, rxtable:byte, vtemu:byte extrn tv_mode:byte extrn isccdos:byte ; Jun 25,1990 xmult dw ? ; scaling factor for x is xdiv dw ? ; xmult/xdiv ymult dw ? ; scaling factor for y is ydiv dw ? ; ymult/ydiv xmax dw ? ; ybot dw ? ; ; required for Hercules screen handling gtable db 35h,2dh,2eh,7 ; bytes for 6845 controller db 5bh,2,57h,57h ; - graphics mode db 2,3,0,0 ttable db 61h,50h,52h,0fh ; bytes for 6845 controller db 19h,6,19h,19h ; - text mode db 2,0dh,0bh,0ch attlogo db 'OLIVETTI' ; Olivetti M24/28, AT&T 6300 rom id attlen equ $-attlogo ; length toshlogo db ' TT33110000 TTOOSSHHIIBBAA' ; Toshiba T3100 logo toshlen equ $-toshlogo ; length declogo db 'Copyright Digital Equipment Corp' ; DEC VAXmate declen equ $-declogo ttstate dw tektxt ; state machine control pointer prestate dw 0 ; previous state, across interruptions visible db 0 ; 0 to move, 1 to draw a line tek_hiy dw 0 ; Y coordinate in Tektronix mode tek_loy db 0 tek_hix dw 0 ; X coordinate in Tektronix mode tek_lox db 0 tek_lsb db 0 ; Low-order 2 bits of X + low Y ; (4014 mode) status db 0 lastc db 0 ; last x/y coord fragment seen masktab db 80h,40h,20h,10h,8,4,2,1 ; quicker than calculations! ; dashed line patterns linetab dw 0ffffh ; ESC accent 11111111 11111111 dw 0aaaah ; ESC a 10101010 10101010 dw 0f0f0h ; ESC b 11110000 11110000 dw 0fafah ; ESC c 11111010 11111010 dw 0ffcch ; ESC d 11111111 11001100 dw 0fc92h ; ESC e 11111100 10010010 linepat dw 0ffffh ; active line pattern, from above ;End of init data IDSEQ dw tekem ; address of response to terminal CTLTAB dw 0 ; .. inquiry tekem db 'IBM_TEK' ; .. and the response db escape,'/Z',0 x_coord dw 0 ; Tek text char X coordinate y_coord dw 8 ; Tek text char Y coordinate xcross dw 0 ; cross hairs to start at centre ycross dw 0 oldx dw 0 ; Tek coordinates of last point oldy dw 767 ; initially top left scalex dw 0 ; PC coord for scaled x value scaley dw 0 ; for scaled y value curmode db 0 ; screen mode before graphics tekgraf db 0 ; Tek graphics board selection (def=auto) ; local variables for LINE plotting routine graph_mode db 0 ; graphics video mode, default is none cursor dw 0 ; saved text cursor inited db 0 ; non-zero if inited (retains page) tekflg db 0 ; Tek mode active flag yflags db 0 ; flags byte from msy flow dw 0 ; flow control word gpage db 0 ; display adapter graphics page gfcol db 15 ; graphics foreground colour gbcol db 0 ; graphics background color tfcol db 0 ; temp foreground color tbcol db 0 ; temp background color lastd db 0,0 ; worker for ESC [ Pn ; Pn m scanner colortb db 0,4,2,6,1,5,3,7 ; color reversed-bit setting bytes moremsg db ' More >' mormsglen equ $-moremsg ; length of message ccode db 0 ; temp for holding plot color code linelen dw 0 ; offset increment between scan lines putc dw mputc ; ptr to plot a character routine psetup dw psetupm ; ptr to plot setup routine pincy dw pincym ; ptr to inc y routine plotptr dw pltmon ; ptr to dot plot routine gcplot dw gcgen ; ptr to char plot routine segscn dw 0b800h ; actual screen segment to use ; ANSI Escape sequence to exit Tek mode tkoff db escape,'[?38l' ; Exit Tek mode escape sequence tkofflen equ $-tkoff ; length of sequence tkoffs db 6 dup (0) ; received chars in rcv'd sequence tkcnt dw 0 ; counter of matched char in tkoffs bypass db 0 ; GIN mode bypass condition (0=off) temp dw 0 ; 8*8 font for Hercules and such, CGA, and EGA ; - allows 43 lines, and 80 (90 for Hercules) chars per line. ; all printing (?) characters from to - two characters per line ; 8 bits per scan line, given top line first, 8 scan lines. font db 0,0,0,0,0,0,0,0, 18h,18h,18h,18h,18h,0,18h,0 db 6ch,6ch,6ch,0,0,0,0,0, 36h,36h,7fh,36h,7fh,36h,36h,0 db 0ch,3fh,68h,3eh,0bh,7eh,18h,0, 60h,66h,0ch,18h,30h,66h,06h,0 db 38h,6ch,6ch,38h,6dh,66h,3bh,0, 0ch,18h,30h,0,0,0,0,0 db 0ch,18h,30h,30h,30h,18h,0ch,0, 30h,18h,0ch,0ch,0ch,18h,30h,0 db 0,18h,7eh,3ch,7eh,18h,0,0, 0,18h,18h,7eh,18h,18h,0,0 db 0,0,0,0,0,18h,18h,30h, 0,0,0,7eh,0,0,0,0 db 0,0,0,0,0,18h,18h,0, 0,06h,0ch,18h,30h,60h,0,0 db 3ch,66h,6eh,7eh,76h,66h,3ch,0, 18h,38h,18h,18h,18h,18h,7eh,0 db 3ch,66h,06h,0ch,18h,30h,7eh,0, 3ch,66h,06h,1ch,06h,66h,3ch,0 db 0ch,1ch,3ch,6ch,7eh,0ch,0ch,0, 7eh,60h,7ch,06h,06h,66h,3ch,0 db 1ch,30h,60h,7ch,66h,66h,3ch,0, 7eh,06h,0ch,18h,30h,30h,30h,0 db 3ch,66h,66h,3ch,66h,66h,3ch,0, 3ch,66h,66h,3eh,06h,0ch,38h,0 db 0,0,18h,18h,0,18h,18h,0, 0,0,18h,18h,0,18h,18h,30h db 0ch,18h,30h,60h,30h,18h,0ch, 0,0,0,7eh,0,7eh,0,0,0 db 30h,18h,0ch,06h,0ch,18h,30h, 0,3ch,66h,0ch,18h,18h,0,18h,0 db 3ch,66h,6eh,6ah,6eh,60h,3ch, 0,3ch,66h,66h,7eh,66h,66h,66h,0 db 7ch,66h,66h,7ch,66h,66h,7ch, 0,3ch,66h,60h,60h,60h,66h,3ch,0 db 78h,6ch,66h,66h,66h,6ch,78h, 0,7eh,60h,60h,7ch,60h,60h,7eh,0 db 7eh,60h,60h,7ch,60h,60h,60h, 0,3ch,66h,60h,6eh,66h,66h,3ch,0 db 66h,66h,66h,7eh,66h,66h,66h, 0,7eh,18h,18h,18h,18h,18h,7eh,0 db 3eh,0ch,0ch,0ch,0ch,6ch,38h, 0,66h,6ch,78h,70h,78h,6ch,66h,0 db 60h,60h,60h,60h,60h,60h,7eh, 0,63h,77h,7fh,6bh,6bh,63h,63h,0 db 66h,66h,76h,7eh,6eh,66h,66h, 0,3ch,66h,66h,66h,66h,66h,3ch,0 db 7ch,66h,66h,7ch,60h,60h,60h, 0,3ch,66h,66h,66h,6ah,6ch,36h,0 db 7ch,66h,66h,7ch,6ch,66h,66h, 0,3ch,66h,60h,3ch,06h,66h,3ch,0 db 7eh,18h,18h,18h,18h,18h,18h, 0,66h,66h,66h,66h,66h,66h,3ch,0 db 66h,66h,66h,66h,66h,3ch,18h, 0,63h,63h,6bh,6bh,7fh,77h,63h,0 db 66h,66h,3ch,18h,3ch,66h,66h, 0,66h,66h,66h,3ch,18h,18h,18h,0 db 7eh,06h,0ch,18h,30h,60h,7eh, 0,7ch,60h,60h,60h,60h,60h,7ch,0 db 0,60h,30h,18h,0ch,06h,0,0, 3eh,06h,06h,06h,06h,06h,3eh,0 db 18h,3ch,66h,42h,0,0,0,0, 0,0,0,0,0,0,0,0ffh db 30h,18h,0ch,0,0,0,0,0, 0,0,3ch,06h,3eh,66h,3eh,0 db 60h,60h,7ch,66h,66h,66h,7ch,0, 0,0,3ch,66h,60h,66h,3ch,0 db 06h,06h,3eh,66h,66h,66h,3eh,0, 0,0,3ch,66h,7eh,60h,3ch,0 db 0eh,18h,18h,3ch,18h,18h,18h,0, 0,0,3eh,66h,66h,3eh,06h,3ch db 60h,60h,7ch,66h,66h,66h,66h,0, 18h,0,38h,18h,18h,18h,3ch,0 db 18h,0,38h,18h,18h,18h,18h,70h, 60h,60h,66h,6ch,78h,6ch,66h,0 db 38h,18h,18h,18h,18h,18h,3ch,0, 0,0,76h,7fh,6bh,6bh,63h,0 db 0,0,7ch,66h,66h,66h,66h,0, 0,0,3ch,66h,66h,66h,3ch,0 db 0,0,7ch,66h,66h,7ch,60h,60h,0, 0,3eh,66h,66h,3eh,06h,07h db 0,0,6ch,76h,60h,60h,60h,0, 0,0,3eh,60h,3ch,06h,7ch,0 db 30h,30h,7ch,30h,30h,30h,1ch,0, 0,0,66h,66h,66h,66h,3eh,0 db 0,0,66h,66h,66h,3ch,18h,0, 0,0,63h,6bh,6bh,7fh,36h,0 db 0,0,66h,3ch,18h,3ch,66h,0, 0,0,66h,66h,66h,3eh,06h,3ch db 0,0,7eh,0ch,18h,30h,7eh,0, 0ch,18h,18h,70h,18h,18h,0ch,0 db 18h,18h,18h,0,18h,18h,18h,0, 30h,18h,18h,0eh,18h,18h,30h,0 db 31h,6bh,46h,0,0,0,0,0, 8 dup (0ffh) datas ends