(******************************************************************************) (* GRQUERY.MOD - Procedure to Qualify "GrafixCard and "CommPort" *) (* *) (* Taken from GRQUERY.C by Metagraphics Software Corporation *) (* Translated to TopSpeed Modula-2 v3.00. *) (* *) (* PSW 10/31/90 01:49am *) (******************************************************************************) IMPLEMENTATION MODULE GrQry; (* * Graphix * Release 3.7 * (c) Copyright 1986-1992 PMI * Green Bay, Wisconsin * (414) 468-6040 * All rights reserved * *) (******************************************************************************) (* This procedure, in conjunction with QueryGrafix and QueryComm, is used to *) (* dynamically determine and set the graphics hardware configuration for *) (* MetaWINDOW use. *) (* *) (* In certain configurations it is possible to have multiple display adaptors *) (* installed in one PC, or in some cases one display adaptor supports multiple*) (* operating modes. For these cases the response from QueryGrafix() and *) (* QueryComm() cannot be used directly for the InitGrafix() or InitMouse() *) (* calls. Procedure GrQuery() qualifies the QueryGrafix() and QueryComm() *) (* responses to select the initial graphics card and comm port for MetaWINDOW *) (* use. *) (* *) (* A secondary function of this routine is to allow the operator to specify *) (* overriding graphic card and mouse settings from the program startup command*) (* line. This is useful to cover situations when working with "compatible" *) (* graphics cards which are not fully recognized by the MetaWINDOW routines. *) (* IF the hardware design of a "compatible" adaptor is not exactly the same *) (* as one of the MetaWINDOW supported cards, QueryGrafix may not return the *) (* proper expected results (this usually occurs if the adaptor supports *) (* special "extended" features, or in multiple monitor systems). Also the *) (* operator may choose to override the default mouse comm port. Selections may*) (* be made from the command line, or from the environment variable called *) (* METAPARM The logic is: *) (* *) (* Commmand line option ? *) (* | | *) (* yes no, check for environment var *) (* | | *) (* | Env var METAPARM set ? *) (* | | | *) (* | yes no, Do Queryfunctions *) (* | | | *) (* +------+--------+ *) (* | *) (* Parse result *) (* | *) (* Is a ";" present ? (ie, no wait option) *) (* | | *) (* yes no, Invoke Confirm screen, *) (* | | *) (* | D or I entered before time out ? *) (* | | | *) (* | no yes, Do menus *) (* | | | *) (* | |-----------+ *) (* | | *) (* Continue with application *) (* | *) (* v *) (* *) (* GrQuery should be included (or linked) within the code module of your *) (* main program. Variables are passed as VAR parameters to GrQuery(). *) (* *) (* VAR *) (* GrafixCard, CommPort: INTEGER; *) (* *) (* BEGIN *) (* : *) (* GrQuery(GrafixCard, CommPort); *) (* Meta.InitGrafix(-GrafixCard); *) (* Meta.InitMouse(CommPort); *) (* : *) (* END *) (* *) (******************************************************************************) IMPORT Meta; IMPORT GrConst; IMPORT Lib; IMPORT Str; IMPORT IO; CONST (*** Set GRQtrim = TRUE to remove menu selection code ***) GRQtrim = FALSE; (*** Set DOSDISP = TRUE to use very simple text output code ***) (*** Ensure that GRQtrim is TRUE if DOSDISP is TRUE. ***) DOSDISP = FALSE; (*** Set SMALLMENU = TRUE to use the smaller selection of devices available ***) (*** with MetaWINDOW 3.7c, FALSE for MetaWINDOW/Plus. ***) SMALLMENU = FALSE; THORZLINE = '-'; (* ASCII Terminal box characters *) TVERTLINE = '|'; TLEFTTCORN = '*'; TRIGHTTCORN = '*'; TLEFTBCORN = '*'; TRIGHTBCORN = '*'; TLEFTTEE = '*'; TRIGHTTEE = '*'; HORZLINE = 205; (* Extended ansi box characters *) VERTLINE = 186; LEFTTCORN = 201; RIGHTTCORN = 187; LEFTBCORN = 200; RIGHTBCORN = 188; LEFTTEE = 204; RIGHTTEE = 185; (* Menu selection title string *) GRQTITLE = 'Confirm Graphic Devices'; (* Terminated or exit message *) GRQQUITSTR = 'MetaWINDOW terminated.'; (* The menu header. Insert your own message here. *) GRQHDRSTR = 'MetaWINDOW for TopSpeed Modula-2'; GRQDELAY = 180; (* Time out delay in system clock *) (* ticks (18.2 per sec), 0 = forever *) GrQLines = 25; (* Maximum number of lines on the *) (* screen, when GRQtrim TRUE *) CNORMAL = 1700H; (* Attribute values for set_attr - *) CINVERSE = 7000H; (* color display. *) CHILITE = 1F00H; MNORMAL = 0700H; (* Attribute values for set_attr - *) MINVERSE = 7000H; (* mono display. *) MHILITE = 0F00H; kESC = 1BH; (* Key codes. *) kCR = 0DH; Home = 71; End = 79; PgDn = 81; PgUp = 73; UP_arr = 72; LF_arr = 75; DN_arr = 80; RT_arr = 77; TOP = -2; (* Miscellaneous. *) BOT = -3; SUP = 06H; SDOWN = 07H; GRQMAXLEN = 127; GRQLINLEN = 80; TYPE txAttr = RECORD (* Text attribute values for text *) normal: WORD; (* color vs mono screens. *) inverse: WORD; hilite: WORD; END; device = RECORD (* Device information. *) devslash: ARRAY[0..3] OF CHAR; devnum: INTEGER; devdesc: ARRAY[0..34] OF CHAR; devhres: CARDINAL; devvres: CARDINAL; devcolors:INTEGER; END; iDevTab = ARRAY[0..6] OF device; (* Input device table. *) (*%T SMALLMENU *) TYPE oDevTab = ARRAY[0..18] OF device; (* Output device table. *) CONST oDev = oDevTab ( device("w:1", GrConst.WYS640x400, " Amdek 1280", 640, 400, 0), device("a:1", GrConst.ATT640x400, " Compaq Plasma & AT&T ", 640, 400, 0), device("g", GrConst.GEN640x480, " Genoa, SuperEGA 4880", 640, 480, 16), device("h", GrConst.HER720x348, " Hercules, Monographics", 720, 348, 0), device("c:1", GrConst.CGA640x200, " IBM, CGA", 640, 200, 2), device("c:2", GrConst.CGA320x200, " IBM, CGA", 320, 200, 4), device("e:1", GrConst.EGAMono, " IBM, EGA", 640, 350, 0), device("e:2", GrConst.EGA320x200, " IBM, EGA", 320, 200, 16), device("e:3", GrConst.EGA640x200, " IBM, EGA", 640, 200, 16), device("e:4", GrConst.EGA640x350, " IBM, EGA", 640, 350, 16), device("e:5", GrConst.MGA640x480, " IBM, MCGA", 640, 480, 2), device("e:6", GrConst.MGA640x350, " IBM, EGA", 640, 350, 2), device("e:7", GrConst.EGA640x480, " IBM, VGA", 640, 480, 16), device("l:2", GrConst.PAR640x480, " Paradise, Autoswitch EGA/480", 640, 480, 16), device("o", GrConst.TOS640x400, " Toshiba, 3100", 640, 400, 0), device("l:1", GrConst.EVA640x480, " Tseng Labs, EVA-480", 640, 480, 16), device("u:1", GrConst.VGA640x480, " Video Seven, VEGA/Deluxe", 640, 480, 16), device("w:1", GrConst.WYS640x400, " Wyse, WY-700", 640, 400, 0), device("", 0, "** No Graphics Device Located **", 0, 0, 0) ); (*%E SMALLMENU *) (*%F SMALLMENU *) TYPE oDevTab = ARRAY[0..142] OF device; (* Output device table. *) CONST oDev = oDevTab ( device("w:1", GrConst.WYS640x400, " Amdek 1280", 640, 400, 0), device("w:2", GrConst.WYS1280x400, "+ Amdek 1280", 1280, 400, 0), device("w:3", GrConst.WYS1280x800, "+ Amdek 1280", 1280, 800, 0), device("a:4", GrConst.ATI800x600, "+ ATI, VGA Wonder", 800, 600, 16), device("a:5", GrConst.ATI1024x768F, "+ ATI, VGA Wonder", 1024, 768, 16), device("a:6", GrConst.ATI640x480X, "+ ATI, VGA Wonder", 640, 480, 256), device("a:2", GrConst.DEB640x200, "+ AT&T, DEB Graphics", 640, 200, 16), device("a:3", GrConst.DEB640x400, "+ AT&T, DEB Graphics", 640, 400, 16), device("c:3", GrConst.CT640x480X, "+ CHIPS and Tech 82C45x", 640, 480, 256), device("e:9", GrConst.VESA800x600, "+ VESA standard", 800,600, 16), device("c:4", GrConst.CT1024x768, "+ CHIPS and Tech 82C45x", 1024, 768, 16), device("a:1", GrConst.ATT640x400, " Compaq Plasma & AT&T ", 640, 400, 0), device("b:1", GrConst.COR1600x1280V, "+ Cornerstone, Vista 1600", 1600, 1280, 0), device("b:2", GrConst.COR1600x1280VA, "+ Cornerstone, Vista 1600/alt", 1600, 1280, 0), device("b:3", GrConst.COR1600x1280DP, "+ Cornerstone, DualPage", 1600, 1280, 0), device("b:4", GrConst.COR1600x1280DPA, "+ Cornerstone, DualPage/noJP1", 1600, 1280, 0), device("b:5", GrConst.COR1600x1280MCA, "+ Cornerstone, DualPage-PS2", 1600, 1280, 0), device("b:6", GrConst.SP768x1008, "+ Cornerstone, SinglePage", 768, 1008, 0), device("b:7", GrConst.SP768x1008A, "+ Cornerstone, Single/noJP1", 768, 1008, 0), device("b:8", GrConst.COR1280x960, "+ Cornerstone, PC1280", 1280, 960, 0), device("b:9", GrConst.COR1280x960A, "+ Cornerstone, PC1280/noJP1", 1280, 960, 0), device("b:10", GrConst.COR1280x1024, "+ Cornerstone, PC1280", 1280, 1024, 0), device("b:11", GrConst.COR1280x1024A, "+ Cornerstone, PC1280/noJP1", 1280, 1024, 0), device("z:0", GrConst.PAR800x600, "+ Eizo, MD-B07", 800, 600, 16), device("z:1", GrConst.STB640x350X, "+ Eizo, MD-B10", 640, 350, 256), device("z:2", GrConst.STB640x480X, "+ Eizo, MD-B10", 640, 480, 256), device("z:3", GrConst.STB800x600, "+ Eizo, MD-B10", 800, 600, 16), device("z:4", GrConst.STB1024x768, "+ Eizo, MD-B10", 1024, 768, 16), device("v:1", GrConst.EVR640x200, "+ Everex, Graphics Edge", 640, 200, 16), device("v:2", GrConst.EVR640x400, "+ Everex, Graphics Edge", 640, 400, 16), device("v:3", GrConst.EVX800x600, "+ Everex, EVGA EV-673", 800,600, 16), device("f:7", GrConst.FKY1120x750m, "+ Fujitsu, FMRxx, 24 dot",1120,750, 0), device("f:8", GrConst.FKY1120x750, "+ Fujitsu, FMRxx, 24 dot",1120,750, 16), device("f:9", GrConst.FKY640x400, "+ Fujitsu, FMRxx, 16 dot", 640,400, 16), device("g", GrConst.GEN640x480, " Genoa, SuperEGA 4880", 640, 480, 16), device("g:1", GrConst.GEN800x600, "+ Genoa, SuperEGA 4880", 800, 600, 16), device("g:2", GrConst.GEN640x350X, "+ Genoa, SuperVGA 5000", 640, 350, 256), device("g:3", GrConst.GEN640x480X, "+ Genoa, SuperVGA 5000", 640, 480, 256), device("g:4", GrConst.GEN800x600, "+ Genoa, SuperVGA 5000", 800, 600, 16), device("g:5", GrConst.GEN1024x768, "+ Genoa, SuperVGA 5000",1024, 768, 16), device("g:7", GrConst.GEN640x480S, "+ Genoa, SuperVGA 6000", 640, 480, 256), device("g:8", GrConst.GEN1024x768S, "+ Genoa, SuperVGA 6000",1024, 768, 16), device("e:9", GrConst.VESA800x600, "+ Genoa, VESA standard", 800,600, 16), device("h", GrConst.HER720x348, " Hercules, Monographics", 720, 348, 0), device("x:4", GrConst.EXPL320x200, "+ HeadStart Explorer", 320, 200, 16), device("c:1", GrConst.CGA640x200, " IBM, CGA", 640, 200, 2), device("c:2", GrConst.CGA320x200, " IBM, CGA", 320, 200, 4), device("e:1", GrConst.EGAMono, " IBM, EGA", 640, 350, 0), device("e:2", GrConst.EGA320x200, " IBM, EGA", 320, 200, 16), device("e:3", GrConst.EGA640x200, " IBM, EGA", 640, 200, 16), device("e:4", GrConst.EGA640x350, " IBM, EGA", 640, 350, 16), device("e:5", GrConst.MGA640x480, " IBM, MCGA", 640, 480, 2), device("e:6", GrConst.MGA640x350, " IBM, EGA", 640, 350, 2), device("e:7", GrConst.EGA640x480, " IBM, VGA", 640, 480, 16), device("e:8", GrConst.VGA320x200, "+ IBM, VGA (analog)", 320, 200, 256), device("f:4", GrConst.EGA640x350MP, "+ IBM, EGA (planar mode)", 640,350, 16), device("f", GrConst.JRT320x200, "+ IBM, PCjr", 320, 200, 16), device("x:1", GrConst.TTS720x350, "+ IBM, 3270", 720, 350, 2), device("x:2", GrConst.TTS360x350, "+ IBM, 3270", 360, 350, 4), device("m", GrConst.MDS736x1008, "+ MDS, Genius", 736, 1008, 0), device("j:1", GrConst.NEC640x400, "+ NEC, PC-9800/VM", 640, 400, 16), device("j:2", GrConst.MEC640x400, "+ NEC, PC-9800/VM", 640, 400, 2), device("l:6", GrConst.NSI800x600, "+ NSI, Smart EGA/Plus", 800, 600, 16), device("i", GrConst.NNR512x512, "+ Number 9, Revolution", 512, 485, 256), device("i:1", GrConst.OAK800x600, "+ Oak, OTI-067 VGA", 800, 600, 16), device("i:2", GrConst.OAK1024x768, "+ Oak, OTI-067 VGA", 1024, 768, 16), device("i:3", GrConst.OAK640x480X, "+ Oak, OTI-067 VGA", 640, 480, 256), device("k:1", GrConst.OCD640x350X, "+ Orchid, Designer VGA", 640, 350, 256), device("k:2", GrConst.OCD640x480X, "+ Orchid, Designer VGA", 640, 480, 256), device("k:3", GrConst.OCD800x600, "+ Orchid, Designer VGA", 800, 600, 16), device("k:4", GrConst.OCD1024x768, "+ Orchid, Designer VGA", 1024, 768, 16), device("l:2", GrConst.PAR640x480, " Paradise, Autoswitch EGA/480", 640, 480, 16), device("l:3", GrConst.PAR800x600, "+ Paradise, VGA ", 800, 600, 16), device("l:4", GrConst.PAR640x480x, "+ Paradise, VGA Professional", 640, 480, 256), device("l:5", GrConst.PAR1024x768, "+ Paradise, VGA Professional", 1024, 768, 16), device("q:1", GrConst.STB640x350X, "+ Quadram, QuadVGA Spectra", 640, 350, 256), device("q:2", GrConst.STB640x480X, "+ Quadram, QuadVGA Spectra", 640, 480, 256), device("q:3", GrConst.STB800x600, "+ Quadram, QuadVGA Spectra", 800, 600, 16), device("q:4", GrConst.STB1024x768, "+ Quadram, QuadVGA Spectra", 1024, 768, 16), device("d:1", GrConst.SIG640x400, "+ Sigma Design, Color-400", 640, 400, 16), device("d:2", GrConst.SIG1664x1200, "+ Sigma Design, L*View", 1664, 1200, 0), device("d:3", GrConst.SIG1664x1200A, "+ Sigma Design, L*View (A000)", 1664, 1200, 0), device("d:4", GrConst.SIG1664x1200MCA, "+ Sigma Design, L*View (PS/2)", 1664, 1200, 0), device("s:1", GrConst.STB640x352, "+ STB, Graphics Plus-II", 640, 352, 0), device("s:2", GrConst.STB320x200, "+ STB, Graphics Plus-II", 320, 200, 16), device("s:3", GrConst.STB640x200, "+ STB, Graphics Plus-II", 640, 200, 4), device("s:4", GrConst.STB640x400, "+ STB, Graphics Plus-III", 640, 400, 0), device("s:5", GrConst.STB640x350X, "+ STB, VGA Extra/EM", 640, 350, 256), device("s:6", GrConst.STB640x480X, "+ STB, VGA Extra/EM", 640, 480, 256), device("s:7", GrConst.STB800x600, "+ STB, VGA Extra/EM", 800, 600, 16), device("s:8", GrConst.STB1024x768, "+ STB, VGA Extra/EM", 1024, 768, 16), device("o:1", GrConst.TS4640x350x, "+ STB, VGA EM-PLUS", 640, 350, 256), device("o:2", GrConst.TS4640x480x, "+ STB, VGA EM-PLUS", 640, 480, 256), device("o:3", GrConst.STB800x600, "+ STB, VGA EM-PLUS", 800, 600, 16), device("o:4", GrConst.TS4800x600x, "+ STB, VGA EM-PLUS", 800, 600, 256), device("o:5", GrConst.TS41024x768x, "+ STB, VGA EM-PLUS", 1024, 768, 256), device("f", GrConst.JRT320x200, "+ Tandy, 1000 EX", 320, 200, 16), device("t:1", GrConst.TEC720x352, "+ Tecmar, Graphics Master", 720, 352, 0), device("t:2", GrConst.TEC720x704, "+ Tecmar, Graphics Master", 720, 704, 0), device("t:3", GrConst.TEC640x200, "+ Tecmar, Graphics Master", 640, 200, 16), device("t:4", GrConst.TEC640x400, "+ Tecmar, Graphics Master", 640, 400, 16), device("t:5", GrConst.TEC320x200, "+ Tecmar, Graphics Master", 320, 200, 16), device("t:6", GrConst.TEC640x350X, "+ Tecmar, VGA/AD", 640, 350, 256), device("t:7", GrConst.TEC640x480X, "+ Tecmar, VGA/AD", 640, 480, 256), device("t:9", GrConst.TEC800x600, "+ Tecmar, VGA/AD", 800, 600, 16), device("t:10", GrConst.TEC1024x768, "+ Tecmar, VGA/AD", 1024, 768, 16), device("o", GrConst.TOS640x400, " Toshiba, 3100", 640, 400, 0), device("r:1", GrConst.TRI800x600, "+ Trident Impact", 800, 600, 16), device("r:2", GrConst.TRI1024x768, "+ Trident Impact", 1024, 768, 16), device("r:3", GrConst.TRI640x480x, "+ Trident Impact", 640, 480, 256), device("r:4", GrConst.TRI800x600x, "+ Trident Impact", 800, 600, 256), device("r:5", GrConst.TRI1024x768x, "+ Trident Impact", 1024, 768, 256), device("f:5", GrConst.TARG512x482, "+ Truevision, Targa M8", 512,482,256), device("l:1", GrConst.EVA640x480, " Tseng Labs, EVA-480", 640, 480, 16), device("s:5", GrConst.STB640x350X, "+ Tseng Labs 3000 chip", 640, 350, 256), device("s:6", GrConst.STB640x480X, "+ Tseng Labs 3000 chip", 640, 480, 256), device("s:7", GrConst.STB800x600, "+ Tseng Labs 3000 chip", 800, 600, 16), device("s:8", GrConst.STB1024x768, "+ Tseng Labs 3000 chip", 1024, 768, 16), device("o:1", GrConst.TS4640x350x, "+ Tseng Labs 4000 chip", 640, 350, 256), device("o:2", GrConst.TS4640x480x, "+ Tseng Labs 4000 chip", 640, 480, 256), device("o:3", GrConst.STB800x600, "+ Tseng Labs 4000 chip", 800, 600, 16), device("o:4", GrConst.TS4800x600x, "+ Tseng Labs 4000 chip", 800, 600, 256), device("o:5", GrConst.TS41024x768x, "+ Tseng Labs 4000 chip", 1024, 768, 256), device("e:9", GrConst.VESA800x600, "+ VESA, VGA", 800,600, 16), device("u:3", GrConst.VGA720x540, "+ Video Seven, FastWrite VGA", 720, 540, 16), device("u:4", GrConst.VGA800x600, "+ Video Seven, FastWrite VGA", 800, 600, 16), device("u:5", GrConst.VGA640x480X, "+ Video Seven, FastWrite VGA", 640, 480,256), device("u:1", GrConst.VGA640x480, " Video Seven, VEGA/Deluxe", 640, 480, 16), device("u:2", GrConst.VGA752x410, "+ Video Seven, VEGA/Deluxe", 752, 410, 16), device("u:3", GrConst.VGA720x540, "+ Video Seven, VEGA VGA", 720, 540, 16), device("u:4", GrConst.VGA800x600, "+ Video Seven, VEGA VGA", 800, 600, 16), device("u:5", GrConst.VGA640x480X, "+ Video Seven, VGA 1024i", 640, 480, 256), device("u:3", GrConst.VGA720x540, "+ Video Seven, VGA 1024i", 720, 540, 16), device("u:4", GrConst.VGA800x600, "+ Video Seven, VGA 1024i", 800, 600, 16), device("u:7", GrConst.VGA1024x768, "+ Video Seven, VGA 1024i", 1024, 768, 16), device("u:5", GrConst.VGA640x480X, "+ Video Seven, VRAM VGA", 640, 480,256), device("u:3", GrConst.VGA720x540, "+ Video Seven, VRAM VGA", 720, 540, 16), device("u:4", GrConst.VGA800x600, "+ Video Seven, VRAM VGA", 800, 600, 16), device("u:6", GrConst.VGA1024x768x2, "+ Video Seven, VRAM VGA", 1024, 768, 2), device("w:1", GrConst.WYS640x400, " Wyse, WY-700", 640, 400, 0), device("w:2", GrConst.WYS1280x400, "+ Wyse, WY-700", 1280, 400, 0), device("w:3", GrConst.WYS1280x800, "+ Wyse, WY-700", 1280, 800, 0), device("", 0, "** No Graphics Device Located **", 0, 0, 0) ); (*%E SMALLMENU *) iDev = iDevTab ( (* ("m:b", MsMouse, "Microsoft bus mouse", 0, 0, -1), *) device("m:d", GrConst.MsDriver, "MS DOS mouse driver", 0, 0, -1), device("m:1", GrConst.MsCOM1, "Microsoft mouse, COM1", 0, 0, -1), device("m:2", GrConst.MsCOM2, "Microsoft mouse, COM2", 0, 0, -1), device("1", 1, "Logitech/Mouse Systems mouse, COM1", 0, 0, -1), device("2", 2, "Logitech/Mouse Systems mouse, COM2", 0, 0, -1), device("m:f", GrConst.FKYMsDriver, "Fujitsu DOS mouse driver", 0, 0, -1), device("", 0, "** No Input Device Located **", 0, 0, 0) ); VAR line: ARRAY[0..GRQMAXLEN] OF CHAR; str, buf: ARRAY[0..GRQLINLEN] OF CHAR; txtAttrVal: txAttr; PROCEDURE GrQuit(Msg: ARRAY OF CHAR; Val: SHORTCARD); VAR i: INTEGER; BEGIN i := Meta.QueryError(); Meta.StopMouse(); Meta.StopEvent(); Meta.SetDisplay(GrConst.TextPg0); Meta.ClearText(); IF (i # 0) THEN IO.WrStr('QueryError = '); IO.WrInt(i DIV 128, 3); IO.WrStr('/'); IO.WrInt(i MOD 128, 3); IO.WrLn(); END; IF Msg[0] = CHR(0) THEN IO.WrStr('Normal end of program.'); ELSE IO.WrStr(Msg); END; Lib.SetReturnCode(Val); IO.WrLn(); HALT END GrQuit; (*%F GRQtrim *) (******************************************************************************) (* PC direct BIOS calls. These routines implement the standard text *) (* functions for GotoXY, setting Attributes, scrolling text, and outputing a *) (* character. A typical 80x25 text screen has coordinates of 0, 0 (min) *) (* to 79, 24 (max). *) (******************************************************************************) (*#save, call(reg_param=>(ax, bx, cx, dx) reg_saved=>(ax, bx, cx, dx, si, di, es, ds, st1, st2), inline=>on) *) TYPE DoScrollCODE = ARRAY[0..1] OF SHORTCARD; PROCEDURE doScroll(ax, bx, cx, dx: CARDINAL) = DoScrollCODE( 0CDH, 010H (* int 10H *) ); (*#restore *) PROCEDURE txtScroll(dir, sx, sy, ex, ey, dist: CARDINAL); (*** PC-BIOS scroll routine. Moves a block of text up or down. ***) BEGIN doScroll((dir << 8) + dist, txtAttrVal.normal, (sy << 8) + sy, (ey << 8) + ex); END txtScroll; (*#save, call(reg_param=>() reg_saved=>(bx, cx, dx, si, di, es, ds, st1, st2), reg_return=>(ax), near_call=>on) *) TYPE TxtMonoCODE = ARRAY[0..12] OF SHORTCARD; PROCEDURE txtMono(): BOOLEAN = TxtMonoCODE( 0CDH, 011H, (* int 11H *) 025H, 030H, 00H, (* and ax, 30H *) 0A9H, 030H, 00H, (* test ax, 30H *) 074H, 002H, (* je true *) 033H, 0C0H, (* xor ax, ax *) 0C3H (* true: ret 0 *) ); (*#restore *) (*#save, call(reg_param=>(bx, cx, ax, dx) reg_saved=>(bx, si, di, es, ds, st1, st2), near_call=>on) *) TYPE TxtAttrCODE = ARRAY[0..10] OF SHORTCARD; PROCEDURE txtAttr(attrib, sx, sy, ex: CARDINAL) = TxtAttrCODE( 08AH, 0E8H, (* mov ch, al *) 08AH, 0F0H, (* mov dh, al *) 033H, 0C0H, (* xor ax, ax *) 0B4H, 006H, (* mov ah, 6H *) 0CDH, 010H, (* int 10H *) 0C3H (* ret *) ); (*#restore *) (*#save, call(reg_param=>(ax), reg_saved=>(cx, dx, si, di, es, ds, st1, st2), near_call=>on) *) TYPE TxtChoutCODE = ARRAY[0..6] OF SHORTCARD; PROCEDURE txtChOut(ch: BYTE) = TxtChoutCODE( 0B4H, 00EH, (* mov ah, 0EH *) 032H, 0FFH, (* xor bh, bh *) 0CDH, 010H, (* int 10H *) 0C3H (* ret *) ); (*#restore *) (*#save, call(reg_param=>(dx, ax), reg_saved=>(cx, si, di, es, ds, st1, st2), near_call=>on) *) TYPE TxtXYCODE = ARRAY[0..8] OF SHORTCARD; PROCEDURE txtXY(x, y: CARDINAL) = TxtXYCODE( 08AH, 0F0H, (* mov dh, al *) 0B4H, 002H, (* mov ah, 2H *) 032H, 0FFH, (* xor bh, bh *) 0CDH, 010H, (* int 10H *) 0C3H (* ret *) ); (*#restore *) (*#save, call(reg_param=>(), reg_saved=>(bx, si, di, es, ds, st1, st2), reg_return=>(dx), near_call=>on) *) TYPE Time55CODE = ARRAY[0..4] OF SHORTCARD; PROCEDURE time55(): CARDINAL = Time55CODE( 033H, 0C0H, (* xor ax, ax *) 0CDH, 01AH, (* int 1AH *) 0C3H (* ret *) ); (*#restore *) PROCEDURE txtFrame(sx, sy, ex, ey: CARDINAL); (*** Draw a text frame. ***) VAR i: CARDINAL; BEGIN (*** Draw horizontal lines. ***) FOR i := sx + 1 TO ex DO txtXY(i, sy); txtChOut(HORZLINE); txtXY(i, ey); txtChOut(HORZLINE) END; (*** Draw vertical lines. ***) FOR i := sy + 1 TO ey DO txtXY(sx, i); txtChOut(VERTLINE); txtXY(ex, i); txtChOut(VERTLINE) END; (*** Place corners. ***) txtXY(sx, sy); txtChOut(LEFTTCORN); txtXY(ex, sy); txtChOut(RIGHTTCORN); txtXY(sx, ey); txtChOut(LEFTBCORN); txtXY(ex, ey); txtChOut(RIGHTBCORN) END txtFrame; PROCEDURE txtBar(sx, sy, ex: CARDINAL); (*** Draw a horizontal bar with T connectors on each end. ***) VAR i: CARDINAL; BEGIN FOR i := sx + 1 TO ex DO txtXY(i, sy); txtChOut(HORZLINE) END; txtXY(sx, sy); txtChOut(LEFTTEE); txtXY(ex, sy); txtChOut(RIGHTTEE) END txtBar; PROCEDURE bPrint(msg: ARRAY OF CHAR); (*** Print a string of text, bypassing DOS. ***) VAR i: CARDINAL; BEGIN i := 0; WHILE (msg[i] # CHR(0)) DO txtChOut(msg[i]); INC(i) END END bPrint; PROCEDURE txtTitle(msg: ARRAY OF CHAR; y: CARDINAL); (*** Print msg - centered and hilite. ***) VAR i, x: CARDINAL; BEGIN i := Str.Length(msg); x := (GRQLINLEN - i) DIV 2; txtAttr(txtAttrVal.hilite, x, y, x + i - 1); txtXY(x, y); bPrint(msg) END txtTitle; PROCEDURE getKey(VAR s, a: CHAR); (*** Get extended keys - returns scancode and ascii value in passed ***) (*** parameters. Sets the first value with the scan code, the second ***) (*** with the ASCII code. ***) BEGIN a := IO.RdKey(); IF (a # CHR(0)) THEN (*** if ASCII, null scan code ***) s := CHR(0) ELSE (*** If first code is null, there is a scan code waiting. ***) s := IO.RdKey() END END getKey; PROCEDURE Qbeep(); (*** Ring da bell. ***) BEGIN IO.WrChar(CHR(7H)) END Qbeep; PROCEDURE dispItem(devptr: ARRAY OF device; item, max_item: CARDINAL; line: ARRAY OF CHAR; dosout: BOOLEAN); (*** Display device line item. dosout is a flag to use dos or bypass it ***) (*** for the BIOS call. ***) VAR OK : BOOLEAN; i, j: CARDINAL; dev: device; BEGIN IF (item > max_item) OR (item < 0) THEN (*** Don't go off the end of the list. ***) RETURN END; dev := devptr[item]; FOR i := 0 TO GRQLINLEN DO line[i] := ' ' END; (* see if its a graphics card *) IF (dev.devcolors > -1) THEN Str.Insert(line, '-', 1); Str.Insert(line, dev.devslash, 2); Str.Insert(line, dev.devdesc, 11); Str.IntToStr(LONGINT(dev.devhres), buf, 10, OK); Str.Insert(line, buf, 45); Str.Insert(line, ' x ', 50); Str.IntToStr(LONGINT(dev.devvres), buf, 10, OK); Str.Insert(line, buf, 53); IF (dev.devcolors = 0) THEN Str.Insert(line, 'monochrome', 60) ELSE Str.IntToStr(LONGINT(dev.devcolors), buf, 10, OK); Str.Insert(line, buf, 60) END; line[71] := CHR(0) ELSE (*** Input device. ***) Str.Insert(line, '-', 1); Str.Insert(line, dev.devslash, 2); Str.Insert(line, dev.devdesc, 11); line[50] := CHR(0) END; IF (dosout) THEN IO.WrStr(line) ELSE bPrint(line) END; END dispItem; PROCEDURE viewList(devptr: ARRAY OF device; curDev: CARDINAL; mouse: BOOLEAN): CARDINAL; (*** Menu device selection - uses cursor keys to select. ***) VAR choosing, refrsh: BOOLEAN; x, y, page_head, (* top of page *) page_len, (* number of lines on page *) cur_select, (* the initial selection number *) tail_sel, (* how many selections are there *) cy, (* the cursor position *) ex: CARDINAL; (* the length of the bar (calculated) *) s, a: CHAR; i: CARDINAL; BEGIN page_head := 0; page_len := GrQLines - 6; (*** Set menu x, y position. ***) y := 4; IF (mouse) THEN x := 10; ELSE x := 5; END; (*** Clear screen. ***) txtScroll(SUP, 0, 0, 79, 24, 0); (*** Make menu screen. ***) txtFrame(1, 1, 78, GrQLines - 2); txtBar(1, 3, 78); txtAttr(txtAttrVal.hilite, 9, GrQLines - 1, 68); txtXY(9, GrQLines - 1); bPrint('Cursor keys [] -> move, [Ù] -> select, [Esc] -> Abort'); IF (mouse) THEN txtTitle('Select Input Device', 0); txtXY(x - 2, y - 2); bPrint('Cmd Line Pointing Device '); (*** Set line length. ***) ex := 54 ELSE txtTitle('Select Display Device/Mode', 0); txtXY(x - 2, y - 2); bPrint('Cmd Line Graphics Device Resolution Colors '); ex := 74 END; (*** Find the number of entries in menu. ***) tail_sel := HIGH(devptr); (*** Set max page length - fewer items will simply shrink 'page'. ***) IF tail_sel < page_len THEN page_len := tail_sel + 1 END; (*** Set current selection, ie default entry. ***) IF curDev > tail_sel THEN cur_select := 0 ELSE cur_select := curDev END; (*** Set the select bar position. ***) cy := y; IF (cur_select # 0) THEN IF (cur_select > (page_len DIV 2)) THEN (*** Position cursor in the middle. ***) INC(cy, (page_len DIV 2)); page_head := cur_select - (page_len DIV 2) ELSE INC(cy, cur_select) END END; choosing := TRUE; refrsh := TRUE; WHILE (choosing) DO (*** Where the bar is on the page. ***) IF (NOT refrsh) THEN txtAttr(txtAttrVal.inverse, x, cy, ex) END; (*** Rewrite entire page. ***) IF (refrsh) THEN FOR i := 0 TO page_len - 1 DO txtXY(x, y + i); IF (y + i = cy) THEN txtAttr(txtAttrVal.inverse, x, cy, ex) END; dispItem(devptr, page_head + i, tail_sel, str, FALSE) END; refrsh := FALSE; ELSE (*** Just moved bar. ***) txtXY(x, cy); dispItem(devptr, cur_select, tail_sel, str, FALSE) END; (*** Get cursor out of way. ***) txtXY(0, GrQLines - 1); getKey(s, a); (*** Escape. ***) IF (a = CHR(kESC)) THEN GrQuit(GRQQUITSTR, 9) END; (*** Made a choice. ***) IF (a = CHR(kCR)) THEN RETURN cur_select END; txtAttr(txtAttrVal.normal, x, cy, ex); txtXY(x, cy); dispItem(devptr, cur_select, tail_sel, str, FALSE); CASE s OF | CHR(UP_arr), CHR(LF_arr): IF (cur_select > 0) THEN DEC(cur_select); IF (cy > y) THEN DEC(cy) ELSE (*** Top of page; move up one line. ***) IF (page_head > 0) THEN DEC(page_head); txtScroll(SDOWN, x, y, ex, y + page_len - 1, 1) END END END; | CHR(DN_arr), CHR(RT_arr): IF (cur_select < tail_sel) THEN INC(cur_select); IF (cy < (page_len + y - 1)) THEN INC(cy) ELSE (*** Bottom of page; move down one line. ***) IF (page_head < tail_sel) THEN INC(page_head); txtScroll(SUP, x, y, ex, y+page_len-1, 1) END END END; | CHR(Home): IF (cur_select > 0) THEN (*** Set page, select, to 0 and set cursor bar. ***) page_head := 0; cur_select := 0; cy := y; refrsh := TRUE END; | CHR(End): IF (cur_select < tail_sel) THEN (*** Set page, select, and set cursor bar. ***) page_head := tail_sel - page_len + 1; cur_select := tail_sel; cy := page_len + y - 1; refrsh := TRUE END; | CHR(PgDn): IF (cur_select < tail_sel) THEN INC(page_head, page_len); INC(cur_select, page_len); IF (page_head + page_len > tail_sel + 1) OR (cur_select > tail_sel) THEN page_head := tail_sel + 1 - page_len; cur_select := tail_sel; cy := page_len + y - 1; END; refrsh := TRUE END; | CHR(PgUp): IF (cur_select > 0) THEN IF (page_head < page_len) OR (cur_select < page_len) THEN page_head := 0; cy := y; cur_select:= 0 ELSE DEC(page_head, page_len); DEC(cur_select, page_len); END; refrsh := TRUE END ELSE Qbeep() END END; RETURN 0 END viewList; PROCEDURE grQMenu(VAR GrafixCard, CommPort: INTEGER); (*** Allow menu selection of desired devices. ***) VAR i, inum, onum, x, y: CARDINAL; ktime: CARDINAL; z, w: CHAR; OK: BOOLEAN; BEGIN LOOP (*** Find display adapter info. ***) onum := 0; WHILE (oDev[onum].devnum # 0) AND (oDev[onum].devnum # GrafixCard) DO INC(onum) END; (*** Find input device info. ***) inum := 0; WHILE (iDev[inum].devnum # 0) AND (iDev[inum].devnum # CommPort) DO INC(inum) END; (*** Clear screen. ***) txtScroll(SUP, 0, 0, 79, 24, 0); txtFrame(1, 1, 78, GrQLines - 2); txtBar(1, 3, 78); y := 0; txtTitle(GRQHDRSTR, y); INC(y, 2); txtTitle(GRQTITLE, y); (*** Print MetaWINDOW version. ***) Str.Copy(line, '-[ '); Meta.MetaVersion(buf); Str.Append(line, buf); Str.Append(line, ' ]-'); txtTitle(line, GrQLines - 1); x := 4; y := 5; txtXY(x, y); (*** Display graphics device. ***) FOR i := 0 TO GRQLINLEN DO line[i] := ' ' END; IF (GrafixCard # 0) THEN bPrint('Display Device / Mode:'); Str.Copy(line, oDev[onum].devdesc); Str.IntToStr(LONGINT(oDev[onum].devhres), buf, 10, OK); Str.Append(line, ', '); Str.Append(line, buf); Str.Append(line, 'x'); Str.IntToStr(LONGINT(oDev[onum].devvres), buf, 10, OK); Str.Append(line, buf); IF (oDev[onum].devcolors = 0) THEN Str.Append(line, ' monochrome') ELSE Str.Append(line, ' '); Str.IntToStr(LONGINT(oDev[onum].devcolors), buf, 10, OK); Str.Append(line, buf); Str.Append(line, ' color') END; txtAttr(txtAttrVal.hilite, x + 23, y, Str.Length(line) + x + 25); txtXY(x + 23, y); bPrint(line) ELSE txtAttr(txtAttrVal.hilite, x, y, Str.Length(oDev[onum].devdesc) + x); bPrint(oDev[onum].devdesc) END; (*** Display input device. ***) INC(y, 2); txtXY(x, y); bPrint('Input Device or Mouse:'); txtAttr(txtAttrVal.hilite, x + 23, y, Str.Length(iDev[inum].devdesc) + x + 25); txtXY(x + 23, y); bPrint(iDev[inum].devdesc); INC(y, 3); txtXY(x, y); txtAttr(txtAttrVal.hilite, x, y, x + 3); bPrint('[D] -> choose an alternate Display.'); INC(y, 2); txtXY(x, y); txtAttr(txtAttrVal.hilite, x, y, x + 3); bPrint('[I] -> choose an alternate Input device or mouse.'); INC(y, 2); txtXY(x, y); txtAttr(txtAttrVal.hilite, x, y, x + 5); bPrint('[Esc] -> Escape to DOS.'); INC(y, 2); txtXY(x, y); txtAttr(txtAttrVal.hilite, x, y, x + 7); bPrint('[other] -> accept defaults'); INC(y, 3); txtXY(x, y); bPrint('Choice ? [ ]'); txtXY(x + 12, y); (*** Wait for a key or timeout. ***) ktime := time55(); LOOP IF (time55() > ktime + GRQDELAY) THEN Meta.ClearText(); txtXY(0, 0); RETURN END; IF (IO.KeyPressed()) THEN EXIT END END; (*** Get a key and process. ***) getKey(z, w); CASE w OF | CHR(kESC): (*** Escape key. ***) GrQuit(GRQQUITSTR, 9) | 'D', 'd': i := viewList(oDev, onum, FALSE); GrafixCard := oDev[i].devnum | 'I', 'i': i := viewList(iDev, inum, TRUE); CommPort := iDev[i].devnum ELSE (*** Any other key accepts choice. ***) Meta.ClearText(); txtXY(0, 0); RETURN END END END grQMenu; (*%E GRQtrim = FALSE *) (*%T GRQtrim *) PROCEDURE dumpList(); (*** Print the entire device list. ***) VAR i, j: CARDINAL; OK : BOOLEAN; BEGIN Meta.MetaVersion(line); IO.WrLn(); IO.WrStr(line); IO.WrLn(); IO.WrLn(); IO.WrStr(' Output Devices (Displays)'); IO.WrLn(); IO.WrLn(); IO.WrStr('Cmd Line Graphics Device Resolution Colors '); IO.WrLn(); IO.WrStr('======================================================================'); IO.WrLn(); FOR i := 0 TO HIGH(oDev) DO FOR j := 0 TO GRQLINLEN DO line[j] := ' ' END; Str.Insert(line, '-', 1); Str.Insert(line, oDev[i].devslash, 2); Str.Insert(line, oDev[i].devdesc, 11); Str.IntToStr(LONGINT(oDev[i].devhres), buf, 10, OK); Str.Insert(line, buf, 45); Str.Insert(line, ' x ', 50); Str.IntToStr(LONGINT(oDev[i].devvres), buf, 10, OK); Str.Insert(line, buf, 53); IF (oDev[i].devcolors = 0) THEN Str.Insert(line, 'monochrome', 60); ELSE Str.IntToStr(LONGINT(oDev[i].devcolors), buf, 10, OK); Str.Insert(line, buf, 60); END; line[70] := CHR(0); IO.WrStr(line); IO.WrLn(); END; IO.WrLn(); IO.WrStr(' Input Devices (Mouse)'); IO.WrLn(); IO.WrLn(); IO.WrStr('Cmd Line Pointing Device '); IO.WrLn(); IO.WrStr('======================================================================'); IO.WrLn(); FOR i := 0 TO HIGH(iDev) DO FOR j := 0 TO GRQLINLEN DO line[j] := ' ' END; Str.Insert(line, '-', 1); Str.Insert(line, iDev[i].devslash, 2); Str.Insert(line, iDev[i].devdesc, 11); line[50] := CHR(0); IO.WrStr(line); IO.WrLn(); END; Lib.SetReturnCode(0); HALT END dumpList; (*%E GRQtrim = TRUE *) PROCEDURE grQParse(VAR GrafixCard, CommPort: INTEGER): BOOLEAN; (*** Parse the command line or METAPARM environment variable for options. ***) (*** Sets global GrafixCard and CommPort to selection if any. ***) (*** Returns True if the /; option present, else returns False ***) VAR pass: BOOLEAN; i, dev: CARDINAL; choice: BOOLEAN; j, k: CARDINAL; BEGIN line[0] := CHR(0); Meta.GetCmdLine(line); (*** Is there a command line choice? ***) choice := FALSE; i := 0; LOOP IF (line[i] = CHR(0)) THEN EXIT END; IF ((line[i] = '-') OR (line[i] = '/')) THEN choice := TRUE; EXIT END; INC(i) END; (*** NULL terminate line. ***) line[GRQMAXLEN] := CHR(0); (*** If no cmd line, is there an environment var? ***) IF (NOT choice) THEN Lib.EnvironmentFind("METAPARM", line) END; (*** Force to upper case, remove spaces. ***) Str.Lows(line); (*** Process each option on the line. ***) (*** Set bypass menu to FALSE. ***) pass := FALSE; i := 0; LOOP WHILE (line[i] # CHR(0)) AND (line[i] # '/') AND (line[i] # '-') DO INC(i) END; IF (line[i] = CHR(0)) THEN EXIT END; INC(i); (*%T GRQtrim *) IF line[i] = '?' THEN dumpList() END; (*%E GRQtrim = TRUE *) IF line[i] = ';' THEN pass := TRUE END; (*** Table look up for each output device. ***) dev := 0; WHILE (GrafixCard = 0) AND (dev <= HIGH(oDev)) DO j := 0; WITH oDev[dev] DO WHILE (devslash[j] = line[i+j]) AND (devslash[j] # CHR(0)) DO INC(j) END; IF (devslash[j] = CHR(0)) AND (line[i+j] # ':') THEN GrafixCard := devnum; INC(i, j); END; END; INC(dev) END; (*** Table look up for each input device. ***) dev := 0; WHILE (CommPort = 0) AND (dev <= HIGH(iDev)) DO j := 0; WITH iDev[dev] DO WHILE (devslash[j] = line[i+j]) AND (devslash[j] # CHR(0)) DO INC(j) END; IF (devslash[j] = CHR(0)) AND (line[i+j] # ':') THEN CommPort := devnum; INC(i, j); END; END; INC(dev) END; END; RETURN pass END grQParse; PROCEDURE bitAnd(A1, A2: CARDINAL) : CARDINAL; (*** Return the bitwise and of the two parameters. ***) BEGIN RETURN CARDINAL(BITSET(A1) * BITSET(A2)) END bitAnd; PROCEDURE GrInit(VAR GrafixCard, CommPort: INTEGER); (*** Use QueryGrafix() and QueryCom() to try and determine the devices ***) (*** currently in use. As a safety measure GrafixCard and CommPort are ***) (*** initialised to 0. ***) VAR qGraf, qComm: INTEGER; BEGIN (*** Initialise GrafixCard and CommPort to 0. ***) GrafixCard := 0; CommPort := 0; (*** Is the driver loaded ? ***) qComm := Meta.QueryComm(); IF (qComm < 0) THEN GrInitErr(GrafixCard, CommPort, qComm) END; (*** Use QueryGrafix() to determine GrafixCard. ***) qGraf := Meta.QueryGrafix(); CASE qGraf OF GrConst.EXPL320x200, GrConst.SP768x1008, GrConst.SP768x1008A, GrConst.COR1280x960, GrConst.COR1280x960A, GrConst.COR1280x1024, GrConst.COR1280x1024A, GrConst.COR1600x1280DP, GrConst.COR1600x1280DPA, GrConst.COR1600x1280MCA, GrConst.SIG1664x1200MCA, GrConst.FKY1120x750, GrConst.FKY640x400, GrConst.NDI640x480x4D, GrConst.HP1024x768x4, GrConst.GRX1024x768x4A, GrConst.NEC640x400: GrafixCard := qGraf ELSE IF (bitAnd(qGraf, GrConst.VGA640x480) = GrConst.VGA640x480) THEN (*** Vega Deluxe. ***) IF (bitAnd(qGraf, 0030H) = 0010H) THEN GrafixCard := GrConst.EGAMono ELSE GrafixCard := GrConst.EGA640x350 END ELSIF (bitAnd(qGraf, GrConst.EVA640x480) = GrConst.EVA640x480) THEN (*** Tseng Labs EVA/480. ***) IF (bitAnd(qGraf, 0030H) = 0010H) THEN GrafixCard := GrConst.EGAMono ELSE GrafixCard := GrConst.EGA640x350 END ELSIF bitAnd(qGraf, GrConst.EGAMono) # 0 THEN IF bitAnd(qGraf, 0100H) # 0 THEN (*** IBM PS/2 ***) IF bitAnd(qGraf, 10H) # 0 THEN GrafixCard := GrConst.MGA640x480 ELSE GrafixCard := GrConst.EGA640x480 END ELSIF (bitAnd(qGraf, 0030H) = 0010H) THEN (*** IBM EGA ***) GrafixCard := GrConst.EGAMono ELSIF ((bitAnd(qGraf, 0030H) = 0030H) AND (bitAnd(qGraf, 0C0H) # 0)) THEN GrafixCard := GrConst.EGA640x350 ELSE GrafixCard := GrConst.EGA640x200 END ELSIF bitAnd(qGraf, GrConst.ATT640x400) # 0 THEN IF bitAnd(qGraf, 1) # 0 THEN GrafixCard := GrConst.DEB640x400 ELSE GrafixCard := GrConst.ATT640x400 END ELSIF bitAnd(qGraf, GrConst.TOS640x400) # 0 THEN GrafixCard := GrConst.TOS640x400 ELSIF bitAnd(qGraf, GrConst.CGA320x200) # 0 THEN GrafixCard := GrConst.CGA640x200 ELSIF bitAnd(qGraf, GrConst.HER720x348) # 0 THEN GrafixCard := GrConst.HER720x348 ELSIF bitAnd(qGraf, GrConst.TEC720x352) # 0 THEN IF bitAnd(qGraf, 2) # 0 THEN GrafixCard := GrConst.TEC640x200 ELSE GrafixCard := GrConst.TEC720x352 END ELSIF bitAnd(qGraf, GrConst.EVR640x200) # 0 THEN GrafixCard := GrConst.EVR640x200 ELSIF bitAnd(qGraf, GrConst.STB640x352) # 0 THEN GrafixCard := GrConst.STB640x352 ELSIF bitAnd(qGraf, GrConst.TTS720x350) # 0 THEN IF bitAnd(qGraf, 1) # 0 THEN GrafixCard := GrConst.TTS360x350 ELSE GrafixCard := GrConst.TTS720x350 END ELSIF bitAnd(qGraf, GrConst.SIG640x400) # 0 THEN GrafixCard := GrConst.SIG640x400 ELSIF bitAnd(qGraf, GrConst.TOS640x400) # 0 THEN GrafixCard := GrConst.TOS640x400 ELSIF bitAnd(qGraf, GrConst.WYS640x400) # 0 THEN GrafixCard := GrConst.WYS640x400 ELSIF bitAnd(qGraf, GrConst.MDS736x1008) # 0 THEN GrafixCard := GrConst.MDS736x1008 END END; (*** Use the result from QueryCom() to determine CommPort. ***) IF bitAnd(qComm, GrConst.FKYMsDriver) # 0 THEN CommPort := GrConst.FKYMsDriver ELSIF bitAnd(qComm, GrConst.MsDriver) # 0 THEN CommPort := GrConst.MsDriver (*** ELSIF bitAnd(qComm, GrConst.MsMouse) # 0 THEN CommPort := GrConst.MsMouse ***) ELSIF bitAnd(qComm, 2) # 0 THEN CommPort := GrConst.MsCOM2 ELSIF bitAnd(qComm, 1) # 0 THEN CommPort := GrConst.MsCOM1 END END GrInit; PROCEDURE GrInitErr(GrafixCard, CommPort, val: INTEGER); (*** Print an initialisation error message. ***) VAR i: CARDINAL; BEGIN IO.WrLn(); IO.WrStr('MetaWINDOW SYSTEM ERROR: '); IF (val = -1) THEN IO.WrLn(); IO.WrLn(); IO.WrStr('The Metagraphics Driver (METASHEL.EXE) is not installed.'); IO.WrLn() ELSIF (val = -2) THEN IO.WrStr('The InitGrafix('); IO.WrInt(GrafixCard, 6); IO.WrStr(') call is invalid.'); IO.WrLn(); IO.WrLn(); IO.WrStr('REASON: '); IF (GrafixCard = 0) THEN IO.WrStr('MetaWINDOW was unable to find a default adaptor, '); IO.WrLn(); IO.WrStr(' and you did not select one.') ELSE i := 0; WHILE (GrafixCard # oDev[i].devnum) AND (i # HIGH(oDev)) DO INC(i) END; IF (GrafixCard = oDev[i].devnum) THEN Str.Copy(buf, oDev[i].devdesc); ELSE Str.Copy(buf, '*** No graphics adaptor ***'); END; IF (buf[0] = '+') THEN (*** MetaWINDOW Plus device. ***) buf[0] := ' '; IO.WrStr('The'); IO.WrStr(buf); IO.WrStr(' system is supported in'); IO.WrLn(); IO.WrStr(' MetaWINDOW/PLUS and MetaWINDOW/Premium only.'); IO.WrLn() ELSIF (buf[0] = '*') THEN (*** MetaWINDOW Premium device. ***) buf[0] := ' '; IO.WrStr('The'); IO.WrStr(buf); IO.WrStr(' system is supported in'); IO.WrLn(); IO.WrStr(' MetaWINDOW/Premium only.'); IO.WrLn() ELSE buf[0] := ' '; IO.WrStr('Device'); IO.WrStr(buf); IO.WrStr(' is not'); IO.WrLn(); Meta.MetaVersion(buf); IO.WrStr(' supported in '); IO.WrStr(buf); IO.WrLn() END END END; Lib.SetReturnCode(1); HALT END GrInitErr; PROCEDURE GrQuery(VAR GrafixCard, CommPort: INTEGER); (*** Determine which devices are available. ***) VAR i: INTEGER; pass: BOOLEAN; c: CHAR; BEGIN (*** Initialise GrafixCard and CommPort from QueryGrafix() and ***) (*** QueryComm(). These settings can be changed by grQParse(). ***) GrInit(GrafixCard, CommPort); (*** Parse out the command line or environment variable, if any. ***) pass := grQParse(GrafixCard, CommPort); (*** If the /; option was present, don't do anything more. ***) IF (pass) THEN RETURN END; (*%F GRQtrim *) (*** Test to see if mono or color display installed and set vals into ***) (*** global structure. ***) IF txtMono() THEN (* on a monochrome system *) txtAttrVal.normal := MNORMAL; txtAttrVal.inverse := MINVERSE; txtAttrVal.hilite := MHILITE ELSE (* color system *) txtAttrVal.normal := CNORMAL; txtAttrVal.inverse := CINVERSE; txtAttrVal.hilite := CHILITE END; (*** Allow text screen menu selection. ***) grQMenu(GrafixCard, CommPort); (*%E GRQtrim *) (*%T DOSDISP *) Meta.MetaVersion(line); IO.WrLn(); IO.WrStr('-[ '); IO.WrStr(line); IO.WrStr(' ]-'); IO.WrLn(); (* find display adapter info *) i := 0; WHILE (oDev[i].devnum # 0) AND (oDev[i].devnum # GrafixCard) DO INC(i) END; IO.WrLn(); IO.WrStr('DISPLAY: -'); IO.WrStr(oDev[i].devslash); IO.WrStr(' -> '); IO.WrStr(oDev[i].devdesc); IO.WrStr(', '); IO.WrInt(oDev[i].devhres, 4); IO.WrStr(' x '); IO.WrInt(oDev[i].devvres, 4); IO.WrLn(); (* find input device info *) i := 0; WHILE (iDev[i].devnum # 0) AND (iDev[i].devnum # CommPort) DO INC(i) END; IO.WrStr(' MOUSE: -'); IO.WrStr(iDev[i].devslash); IO.WrStr(' -> '); IO.WrStr(iDev[i].devdesc); IO.WrLn(); c := IO.RdKey(); (*%E DOSDISP *) (*** GrafixCard and CommPort are now set with valid InitGrafix and ***) (*** InitMouse values (or are equal to zero if no devices were found ***) (*** or specified). ***) END GrQuery; BEGIN END GrQry.