From 2d04cacc5322951f187bb17e017c12920ac8ebe2 Mon Sep 17 00:00:00 2001 From: Mark Zbikowski Date: Thu, 25 Apr 2024 21:24:10 +0100 Subject: MZ is back! --- v4.0/src/CMD/GRAPHICS/GRAPHICS.ASM | 76 ++ v4.0/src/CMD/GRAPHICS/GRAPHICS.LNK | 15 + v4.0/src/CMD/GRAPHICS/GRAPHICS.OB | 32 + v4.0/src/CMD/GRAPHICS/GRAPHICS.PRO | 231 ++++ v4.0/src/CMD/GRAPHICS/GRAPHICS.SKL | 66 ++ v4.0/src/CMD/GRAPHICS/GRBWPRT.ASM | 631 +++++++++++ v4.0/src/CMD/GRAPHICS/GRBWPRT.EXT | 24 + v4.0/src/CMD/GRAPHICS/GRCOLPRT.ASM | 1122 +++++++++++++++++++ v4.0/src/CMD/GRAPHICS/GRCOLPRT.EXT | 25 + v4.0/src/CMD/GRAPHICS/GRCOMMON.ASM | 858 ++++++++++++++ v4.0/src/CMD/GRAPHICS/GRCOMMON.EXT | 32 + v4.0/src/CMD/GRAPHICS/GRCPSD.ASM | 109 ++ v4.0/src/CMD/GRAPHICS/GRCPSD.EXT | 24 + v4.0/src/CMD/GRAPHICS/GRCTRL.ASM | 2162 ++++++++++++++++++++++++++++++++++++ v4.0/src/CMD/GRAPHICS/GRCTRL.EXT | 47 + v4.0/src/CMD/GRAPHICS/GRCTRL.STR | 111 ++ v4.0/src/CMD/GRAPHICS/GRINST.ASM | 973 ++++++++++++++++ v4.0/src/CMD/GRAPHICS/GRINST.EXT | 43 + v4.0/src/CMD/GRAPHICS/GRINT2FH.ASM | 146 +++ v4.0/src/CMD/GRAPHICS/GRINT2FH.EXT | 26 + v4.0/src/CMD/GRAPHICS/GRLOAD.ASM | 840 ++++++++++++++ v4.0/src/CMD/GRAPHICS/GRLOAD.EXT | 55 + v4.0/src/CMD/GRAPHICS/GRLOAD2.ASM | 910 +++++++++++++++ v4.0/src/CMD/GRAPHICS/GRLOAD2.EXT | 32 + v4.0/src/CMD/GRAPHICS/GRLOAD3.ASM | 729 ++++++++++++ v4.0/src/CMD/GRAPHICS/GRLOAD3.EXT | 28 + v4.0/src/CMD/GRAPHICS/GRMSG.EQU | 84 ++ v4.0/src/CMD/GRAPHICS/GRPARMS.ASM | 717 ++++++++++++ v4.0/src/CMD/GRAPHICS/GRPARMS.EXT | 24 + v4.0/src/CMD/GRAPHICS/GRPARSE.ASM | 87 ++ v4.0/src/CMD/GRAPHICS/GRPARSE.EXT | 24 + v4.0/src/CMD/GRAPHICS/GRPATTRN.ASM | 217 ++++ v4.0/src/CMD/GRAPHICS/GRPATTRN.EXT | 31 + v4.0/src/CMD/GRAPHICS/GRPATTRN.STR | 125 +++ v4.0/src/CMD/GRAPHICS/GRPRINT.EXT | 29 + v4.0/src/CMD/GRAPHICS/GRSHAR.STR | 127 +++ v4.0/src/CMD/GRAPHICS/MAKEFILE | 64 ++ 37 files changed, 10876 insertions(+) create mode 100644 v4.0/src/CMD/GRAPHICS/GRAPHICS.ASM create mode 100644 v4.0/src/CMD/GRAPHICS/GRAPHICS.LNK create mode 100644 v4.0/src/CMD/GRAPHICS/GRAPHICS.OB create mode 100644 v4.0/src/CMD/GRAPHICS/GRAPHICS.PRO create mode 100644 v4.0/src/CMD/GRAPHICS/GRAPHICS.SKL create mode 100644 v4.0/src/CMD/GRAPHICS/GRBWPRT.ASM create mode 100644 v4.0/src/CMD/GRAPHICS/GRBWPRT.EXT create mode 100644 v4.0/src/CMD/GRAPHICS/GRCOLPRT.ASM create mode 100644 v4.0/src/CMD/GRAPHICS/GRCOLPRT.EXT create mode 100644 v4.0/src/CMD/GRAPHICS/GRCOMMON.ASM create mode 100644 v4.0/src/CMD/GRAPHICS/GRCOMMON.EXT create mode 100644 v4.0/src/CMD/GRAPHICS/GRCPSD.ASM create mode 100644 v4.0/src/CMD/GRAPHICS/GRCPSD.EXT create mode 100644 v4.0/src/CMD/GRAPHICS/GRCTRL.ASM create mode 100644 v4.0/src/CMD/GRAPHICS/GRCTRL.EXT create mode 100644 v4.0/src/CMD/GRAPHICS/GRCTRL.STR create mode 100644 v4.0/src/CMD/GRAPHICS/GRINST.ASM create mode 100644 v4.0/src/CMD/GRAPHICS/GRINST.EXT create mode 100644 v4.0/src/CMD/GRAPHICS/GRINT2FH.ASM create mode 100644 v4.0/src/CMD/GRAPHICS/GRINT2FH.EXT create mode 100644 v4.0/src/CMD/GRAPHICS/GRLOAD.ASM create mode 100644 v4.0/src/CMD/GRAPHICS/GRLOAD.EXT create mode 100644 v4.0/src/CMD/GRAPHICS/GRLOAD2.ASM create mode 100644 v4.0/src/CMD/GRAPHICS/GRLOAD2.EXT create mode 100644 v4.0/src/CMD/GRAPHICS/GRLOAD3.ASM create mode 100644 v4.0/src/CMD/GRAPHICS/GRLOAD3.EXT create mode 100644 v4.0/src/CMD/GRAPHICS/GRMSG.EQU create mode 100644 v4.0/src/CMD/GRAPHICS/GRPARMS.ASM create mode 100644 v4.0/src/CMD/GRAPHICS/GRPARMS.EXT create mode 100644 v4.0/src/CMD/GRAPHICS/GRPARSE.ASM create mode 100644 v4.0/src/CMD/GRAPHICS/GRPARSE.EXT create mode 100644 v4.0/src/CMD/GRAPHICS/GRPATTRN.ASM create mode 100644 v4.0/src/CMD/GRAPHICS/GRPATTRN.EXT create mode 100644 v4.0/src/CMD/GRAPHICS/GRPATTRN.STR create mode 100644 v4.0/src/CMD/GRAPHICS/GRPRINT.EXT create mode 100644 v4.0/src/CMD/GRAPHICS/GRSHAR.STR create mode 100644 v4.0/src/CMD/GRAPHICS/MAKEFILE (limited to 'v4.0/src/CMD/GRAPHICS') diff --git a/v4.0/src/CMD/GRAPHICS/GRAPHICS.ASM b/v4.0/src/CMD/GRAPHICS/GRAPHICS.ASM new file mode 100644 index 0000000..8b401b9 --- /dev/null +++ b/v4.0/src/CMD/GRAPHICS/GRAPHICS.ASM @@ -0,0 +1,76 @@ + PAGE ,132 ;AN000; + TITLE DOS GRAPHICS Command - Command Entry Point + ;AN000; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;AN000; +;; MS DOS GRAPHICS Command +;; (C) Copyright 1988 Microsoft +;; ;AN000; +;; File Name: GRAPHICS.ASM ;AN000; +;; ---------- ;AN000; +;; ;AN000; +;; Description: ;AN000; +;; ------------ ;AN000; +;; This file contains the GRAPHICS command entry point. ;AN000; +;; A jump is made to the GRAPHICS_INSTALL procedure ;AN000; +;; in file GRINST.ASM to begin installation processing. ;AN000; +;; ;AN000; +;; Documentation Reference: ;AN000; +;; ------------------------ ;AN000; +;; OASIS High Level Design ;AN000; +;; OASIS GRAPHICS I1 Overview ;AN000; +;; ;AN000; +;; Procedures Contained in This File: ;AN000; +;; ---------------------------------- ;AN000; +;; None ;AN000; +;; ;AN000; +;; Include Files Required: ;AN000; +;; ----------------------- ;AN000; +;; GRINST.EXT - Externals for GRINST.ASM ;AN000; +;; ;AN000; +;; ;AN000; +;; External Procedure References: ;AN000; +;; ------------------------------ ;AN000; +;; FROM FILE GRINST.ASM: ;AN000; +;; GRAPHICS_INSTALL - Main module for installation. ;AN000; +;; ;AN000; +;; Linkage Instructions: ;AN000; +;; -------------------- ;AN000; +;; LINK GRAPHICS GRINT2FH GRPATTRN GRCTRL GRCPSD GRCOLPRT GRBWPRT ;AN000; +;; GRINST GRPARSE grparms GRLOAD GRLOAD2 GRLOAD3; ;AN000; +;; EXE2BIN GRAPHICS.EXE GRAPHICS.COM ;AN000; +;; ;AN000; +;; Change History: ;AN000; +;; --------------- ;AN000; +;; ;AN000; +;; A000 - Denotes 4.00 level source. ;AN000; +;; A001 - PTM1779 - invalid parm msg followed by garbage ;AN001; +;; Module affected: GRPARMS.ASM ;AN001; +;; A002 - PTM2666 - Release environment string before terminating. ;AN002; +;; Module affected: GRINST.ASM ;AN002; +;; A003 - PTM3915 - Change to include common copyright file. +;; Module affected: GRAPHICS.ASM +;; ;AN000; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;AN000; + ;; ;AN000; + ;; ;AN000; +CODE SEGMENT PUBLIC 'CODE' ;; ;AN000; + ASSUME CS:CODE,DS:CODE ;; ;AN000; + ORG 100H ;; required for .COM ;AN000; + ;; ;AN000; + ;; ;AN000; + INCLUDE GRINST.EXT ;; Bring in external declarations ;AN000; + ;; for transient command processing ;AN000; +START: ;; ;AN000; + ;; ;AN000; + JMP GRAPHICS_INSTALL ;; ;AN000; + ;; ;AN000; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;AN000; +;; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;AN000; + ;; +; INCLUDE COPYRIGH.INC ;; included in message services ;AN003; + ;; ;AN000; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;AN000; + ;AN000; +CODE ENDS ;AN000; + END START ;AN000; diff --git a/v4.0/src/CMD/GRAPHICS/GRAPHICS.LNK b/v4.0/src/CMD/GRAPHICS/GRAPHICS.LNK new file mode 100644 index 0000000..6c3f5bb --- /dev/null +++ b/v4.0/src/CMD/GRAPHICS/GRAPHICS.LNK @@ -0,0 +1,15 @@ +GRAPHICS+ +GRINT2FH+ +GRPATTRN+ +GRCTRL+ +GRCPSD+ +GRCOLPRT+ +GRBWPRT+ +GRINST+ +GRPARSE+ +grparms+ +GRLOAD+ +GRLOAD2+ +GRLOAD3 +GRAPHICS.EXE; + \ No newline at end of file diff --git a/v4.0/src/CMD/GRAPHICS/GRAPHICS.OB b/v4.0/src/CMD/GRAPHICS/GRAPHICS.OB new file mode 100644 index 0000000..a10128d --- /dev/null +++ b/v4.0/src/CMD/GRAPHICS/GRAPHICS.OB @@ -0,0 +1,32 @@ +PRINTCODECODE_SEGژ( g +R+2Z%uË&>}n&q;   "k&\-68:>ANDGmKoPV,e +^_][YZX.. +t>u 3آ^_][YZXPRQSUWV$t >u<}P>uI>tB<~ < +t/3ؠf"&t׋3t&>| +t +u ㋇3'>}?QYQ 2"u IKuJ}YBYQ 2">} +ĈIKu߿3GGE$EEKI}ً +׊ +YB;t}4ma!S*0_6<c\fqr__ĆXČ\Ę3Ě=Ġ3Ģ5ı"Ľ3Ŀ9=3k \O\ ZSoi#\:^>ZK@PmS:b^fZj\u|ŌŷoŻ\m !2-(3"-ML3<3$O2!#%'0 +xٜɠ3۹?>uR 2$uBZI}u&AZ+R 2$NB<| Nt N>uZA;uK1<2 \^2?VDmH8O^^n[ă6ĉĝ6Ġ[Ĥ6Ĩ\Į[IJ6ĸ6Ļ[Ŀ6m +Q +Q>u3۹?>uQYQ 2$uIuJ}Y+}&BYQ2 2$NI2Q<| +NY22Q, +, +YNYB;uL3<3?U\w\)x1^BExNVSmW8\bxn^|xāĆwĝ6ĠĤxĭw6mooooMM} +wMMX.$Т ymcb5WR?>uZR 3 +u>t  +u&BNuI}tMZ|&QRV3ۺAt;~C^ZY4u}ǀZ3RP 3 +u>t "Xt BNuQYZA;u R̵QY332۴ +u >t +F:uSR3Ҋ3ۃ>t'3OG}es3۸\3>t +t C:uރ>t Z[2:t&QYQ 3 +u>t  +u"INuJ}tEY}&GQRV3ۺt;~C^ZY4u} tǀYQP 3 +u>t "Xt INuڋYB;uĸ Q +COLOR8COLOR4COLOR1COMPACTGRAPHICSTHERMAL/R/r/B/b/LCD/lcd. 2G O= tWV +t'Q$u..󫸐..+ء..4..|w.tKu9..GF.D.E.D.E.D.E.D.E..t.O./.o.o.o..- diff --git a/v4.0/src/CMD/GRAPHICS/GRAPHICS.PRO b/v4.0/src/CMD/GRAPHICS/GRAPHICS.PRO new file mode 100644 index 0000000..5ccc7b2 --- /dev/null +++ b/v4.0/src/CMD/GRAPHICS/GRAPHICS.PRO @@ -0,0 +1,231 @@ +;---------------------------------------------------------------------------- + ;DOS (C)Copyright 1988 Microsoft + ;Licensed Material - Program Property of Microsoft +;---------------------------------------------------------------------------- +PRINTER GRAPHICS,THERMAL ;; 5152, 4201, 4202(8"), 5201-002(8"), 5202, 3812 + ;; 4207, 4208, 5140 + + ; Maximum Print width: 8" + ; Horizontal BPI: 120 Vertical BPI: 72 + ; SETUP Statements contain the following escape sequences: + ; 27,51,24 = set line spacing to 24/216 + ; GRAPHICS Statements use ESC "L" with the last two bytes being + ; the data count (low,high) + + DISPLAYMODE 4,5,13,19 ;; 320x200 > 6.7"x8.9" rotated + SETup 27,51,24 + GRAPHICS 32,32,32,32,32,32,27,76,LOWCOUNT,HIGHCOUNT + PRINTBOX STD,4,2,ROTATE + PRINTBOX LCD,2,2,ROTATE + + DISPLAYMODE 6,14 ;; 640x200 > 6.7"x8.9" rotated + SETup 27,51,24 + GRAPHICS 32,32,32,32,32,32,27,76,LOWCOUNT,HIGHCOUNT + PRINTBOX STD,4,1,ROTATE + PRINTBOX LCD,2,1,ROTATE + + DISPLAYMODE 15,16 ;; 640x350 > 5.8"x8.9" rotated + SETup 27,51,24 + GRAPHICS 32,32,32,32,32,32,32,27,76,LOWCOUNT,HIGHCOUNT + PRINTBOX STD,2,1,ROTATE + PRINTBOX LCD ;; PC/Convertible doesn't support these modes + + DISPLAYMODE 17,18 ;; 640x480 > 8"x8.9" rotated + SETup 27,51,24 + GRAPHICS 27,76,LOWCOUNT,HIGHCOUNT + PRINTBOX STD,2,1,ROTATE + PRINTBOX LCD ;; PC/Convertible doesn't support these modes + + +;--------------------------------------------------------------------------- +PRINTER COLOR8 ;; 5182 CMY Ribbon + + ; Maximum Print width: 8" + ; Horizontal BPI: 168 in 1:1 aspect ratio, 140 in 5:6 aspect ratio + ; Vertical BPI: 84 + ; SETUP Statements contain the following escape sequences: + ; 27,51,14 = set line spacing to 14/144 + ; 27,110,[0|1] = 0 sets aspect ratio to 5:6, 1 sets it to 1:1 + ; GRAPHICS Statements use ESC "L" with the last two bytes being + ; the data count (low,high) + + COLORSELECT Y,27,121 ;; yellow band + COLORSELECT M,27,109 ;; magenta band + COLORSELECT C,27,99 ;; cyan band + COLORSELECT B,27,98 ;; black band + ;; + ;; Following RGB's represent the first 16 + ;; screen colors. + ;; SCREEN COLOR PRINT COLOR + ;; ------------ ----------- + COLORPRINT 0,0,0,B ;; BLACK BLACK + COLORPRINT 0,0,42,C ;; BLUE CYAN + COLORPRINT 0,42,0,Y,C ;; GREEN GREEN + COLORPRINT 0,42,42,C ;; CYAN CYAN + COLORPRINT 42,0,0,Y,M ;; RED RED + COLORPRINT 42,0,42,C,M ;; PURPLE PURPLE + COLORPRINT 42,21,0,Y,C,M ;; BROWN BROWN + COLORPRINT 42,42,42 ;; LOW WHITE WHITE (NOTHING) + COLORPRINT 21,21,21,B ;; GREY BLACK + COLORPRINT 21,21,63,C ;; HIGH BLUE CYAN + COLORPRINT 21,63,21,Y,C ;; HIGH GREEN GREEN + COLORPRINT 21,63,63,C ;; HIGH CYAN CYAN + COLORPRINT 63,21,21,Y,M ;; HIGH RED RED + COLORPRINT 63,21,63,M ;; MAGENTA MAGENTA + COLORPRINT 63,63,21,Y ;; YELLOW YELLOW + COLORPRINT 63,63,63 ;; HIGH WHITE WHITE (NOTHING) + + COLORPRINT 42,42,0,Y ;; This statement maps the "yellow" in CGA + ;; palette 0 to yellow + ;; + DISPLAYMODE 4,5,13,19 ;; 320x200 + SETUP 27,51,14,27,110,0 ;; aspect ratio = 5:6 + GRAPHICS 32,32,32,32,27,76,LOWCOUNT,HIGHCOUNT + PRINTBOX STD,4,2,ROTATE + DISPLAYMODE 6,14 ;; 640x200 + SETUP 27,51,14,27,110,0 ;; aspect ratio = 5:6 + GRAPHICS 32,32,32,32,27,76,LOWCOUNT,HIGHCOUNT + PRINTBOX STD,4,1,ROTATE + DISPLAYMODE 15,16 ;; 640x350 + SETUP 27,51,14,27,110,1 ;; aspect ratio = 1:1 + GRAPHICS 32,32,32,32,27,76,LOWCOUNT,HIGHCOUNT + PRINTBOX STD,3,1,ROTATE + DISPLAYMODE 17,18 ;; 640x480 + SETUP 27,51,14,27,110,1 ;; aspect ratio = 1:1 + GRAPHICS 32,32,32,32,27,76,LOWCOUNT,HIGHCOUNT + PRINTBOX STD,2,1 + +;--------------------------------------------------------------------------- +PRINTER COLOR4 ;; 5182 RGB Ribbon + + ; Maximum Print width: 8" + ; Horizontal BPI: 168 in 1:1 aspect ratio, 140 in 5:6 aspect ratio + ; Vertical BPI: 84 + ; SETUP Statements contain the following escape sequences: + ; 27,51,14 = set line spacing to 14/144 + ; 27,110,[0|1] = 0 sets aspect ratio to 5:6, 1 sets it to 1:1 + ; GRAPHICS Statements use ESC "L" with the last two bytes being + ; the data count (low,high) + + COLORSELECT R,27,121 ;; red band + COLORSELECT G,27,109 ;; green band + COLORSELECT B,27,99 ;; blue band + COLORSELECT X,27,98 ;; black band + ;; + ;; Following RGB's represent the first 16 + ;; screen colors. + ;; SCREEN COLOR PRINT COLOR + ;; ------------ ----------- + COLORPRINT 0,0,0,X ;; BLACK BLACK + COLORPRINT 0,0,42,B ;; BLUE BLUE + COLORPRINT 0,42,0,G ;; GREEN GREEN + COLORPRINT 0,42,42,B ;; CYAN BLUE + COLORPRINT 42,0,0,R ;; RED RED + COLORPRINT 42,0,42,R ;; PURPLE RED + COLORPRINT 42,21,0,X ;; BROWN BLACK + COLORPRINT 42,42,42 ;; LOW WHITE WHITE (NOTHING) + COLORPRINT 21,21,21,X ;; GREY BLACK + COLORPRINT 21,21,63,B ;; HIGH BLUE BLUE + COLORPRINT 21,63,21,G ;; HIGH GREEN GREEN + COLORPRINT 21,63,63,B ;; HIGH CYAN BLUE + COLORPRINT 63,21,21,R ;; HIGH RED RED + COLORPRINT 63,21,63,R ;; MAGENTA RED + COLORPRINT 63,63,21 ;; YELLOW WHITE (NOTHING) + COLORPRINT 63,63,63 ;; HIGH WHITE WHITE (NOTHING) + + COLORPRINT 42,42,0,B ;; This statement maps the "yellow" in CGA + ;; palette 0 to blue as was done in + ;; versions of GRAPHICS + ;; + DISPLAYMODE 4,5,13,19 ;; 320x200 + SETUP 27,51,14,27,110,0 ;; aspect ratio = 5:6 + GRAPHICS 32,32,32,32,27,76,LOWCOUNT,HIGHCOUNT + PRINTBOX STD,4,2,ROTATE + DISPLAYMODE 6,14 ;; 640x200 + SETUP 27,51,14,27,110,0 ;; aspect ratio = 5:6 + GRAPHICS 32,32,32,32,27,76,LOWCOUNT,HIGHCOUNT + PRINTBOX STD,4,1,ROTATE + DISPLAYMODE 15,16 ;; 640x350 + SETUP 27,51,14,27,110,1 ;; aspect ratio = 1:1 + GRAPHICS 32,32,32,32,27,76,LOWCOUNT,HIGHCOUNT + PRINTBOX STD,3,1,ROTATE + DISPLAYMODE 17,18 ;; 640x480 + SETUP 27,51,14,27,110,1 ;; aspect ratio = 1:1 + GRAPHICS 32,32,32,32,27,76,LOWCOUNT,HIGHCOUNT + PRINTBOX STD,2,1 + +;--------------------------------------------------------------------------- +PRINTER GRAPHICSWIDE ;; 4202(13.5"), 5201-002(13.5") + + ; Maximum Print width: 13.5" + ; Horizontal BPI: 120 Vertical BPI: 72 + ; SETUP Statements contain the following escape sequences: + ; 27,88,1,255 = enable 13.5" printing + ; 27,51,24 = set line spacing to 24/216 + ; 27,51,18 = set line spacing to 18/216 (320x200 MODES ONLY!!) + ; GRAPHICS Statements use ESC "L" with the last two bytes being + ; the data count (low,high) + + DISPLAYMODE 4,5,13,19 ;; 320x200 > 10.7"x8.3" non-rotated + SETup 27,88,1,255,27,51,18 + GRAPHICS 27,76,LOWCOUNT,HIGHCOUNT + PRINTBOX STD,4,3 + + DISPLAYMODE 6,14 ;; 640x200 - same as for 8" printing + SETup 27,88,1,255,27,51,24 + GRAPHICS 27,76,LOWCOUNT,HIGHCOUNT + PRINTBOX STD,4,1,ROTATE + + DISPLAYMODE 15,16 ;; 640x350 > 11.7"x17.8" rotated + SETup 27,88,1,255,27,51,24 + GRAPHICS 27,76,LOWCOUNT,HIGHCOUNT + PRINTBOX STD,4,2,ROTATE + + DISPLAYMODE 17,18 ;; 640x480 > 12"x17.8" rotated + SETup 27,88,1,255,27,51,24 + GRAPHICS 27,76,LOWCOUNT,HIGHCOUNT + PRINTBOX STD,3,2,ROTATE + +;--------------------------------------------------------------------------- +PRINTER COLOR1 ;; 5182 with black ribbon + + ; Maximum Print width: 8" + ; Horizontal BPI: 168 in 1:1 aspect ratio, 140 in 5:6 aspect ratio + ; Vertical BPI: 84 + ; SETUP Statements contain the following escape sequences: + ; 27,51,14 = set line spacing to 14/144 + ; 27,110,[0|1] = 0 sets aspect ratio to 5:6, 1 sets it to 1:1 + ; GRAPHICS Statements use ESC "L" with the last two bytes being + ; the data count (low,high) + + DARKADJUST 0 ; Code a positive number to lighten + ; printing. Suggested value = 10 + + DISPLAYMODE 4,5,13,19 ;; 320x200 + SETUP 27,51,14,27,110,0 ;; aspect ratio = 5:6 + GRAPHICS 32,32,32,32,32,32,27,76,LOWCOUNT,HIGHCOUNT + PRINTBOX STD,4,2,ROTATE + PRINTBOX LCD,2,2,ROTATE + + DISPLAYMODE 6,14 ;; 640x200 + SETUP 27,51,14,27,110,0 ;; aspect ratio = 5:6 + GRAPHICS 32,32,32,32,32,32,27,76,LOWCOUNT,HIGHCOUNT + PRINTBOX STD,4,1,ROTATE + PRINTBOX LCD,2,1,ROTATE + + DISPLAYMODE 15,16 ;; 640x350 + SETUP 27,51,14,27,110,1 ;; aspect ratio = 1:1 + GRAPHICS 32,32,32,32,32,27,76,LOWCOUNT,HIGHCOUNT + PRINTBOX STD,3,1,ROTATE + PRINTBOX LCD ;; PC/Convertible doesn't support these modes + + DISPLAYMODE 17,18 ;; 640x480 + SETUP 27,51,14,27,110,1 ;; aspect ratio = 1:1 + GRAPHICS 32,32,32,32,27,76,LOWCOUNT,HIGHCOUNT + PRINTBOX STD,2,1 + PRINTBOX LCD ;; PC/Convertible doesn't support these modes + + +;=========================================================================== +; End of Profile +;=========================================================================== diff --git a/v4.0/src/CMD/GRAPHICS/GRAPHICS.SKL b/v4.0/src/CMD/GRAPHICS/GRAPHICS.SKL new file mode 100644 index 0000000..8e6dd15 --- /dev/null +++ b/v4.0/src/CMD/GRAPHICS/GRAPHICS.SKL @@ -0,0 +1,66 @@ +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;AN000; +;; MS DOS - GRAPHICS Command +;; (c) Copyright 1988 Microsoft +;; ;AN000; +;; File Name: GRAPHICS.MSG ;AN000; +;; ---------- ;AN000; +;; ;AN000; +;; DOS GRAPHICS Command - Message skeleton file +;; ;AN000; +;; Description: ;AN000; +;; ------------ ;AN000; +;; This file contains the skeleton file for using the DOS message ;AN000; +;; retriever with GRAPHICS.COM ;AN000; +;; ;AN000; +;; This skeleton file is processed by "FASTBLD" in order to create ;AN000; +;; the following message files wich are included from GRINST.ASM: ;AN000; +;; ;AN000; +;; GRAPHICS.CL1 ; Class 1 messages ;AN000; +;; GRAPHICS.CL2 ; Class 2 messages ;AN000; +;; GRAPHICS.CLA ; Class A messages ;AN000; +;; ;AN000; +;; Documentation Reference: ;AN000; +;; ------------------------ ;AN000; +;; DOS 3.3 Message Retriever Interface Supplement. ;AN000; +;; DOS 3.3 Approved Functional Specification Message Supplement. ;AN000; +;; ;AN000; +;; External Procedure References: ;AN000; +;; ------------------------------ ;AN000; +;; FROM FILE GRINST.ASM: ;AN000; +;; GRAPHICS_INSTALL - Main module for GRAPHICS install. ;AN000; +;; (NOTE: Reference is made to the include file generated from this ;AN000; +;; skeleton file). ;AN000; +;; ;AN000; +;; Change History: ;AN000; +;; --------------- ;AN000; +;; ;AC001 - Changed message 15 to match D307 request ;AN000; +;; ;AN000; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;AN000; +:util GRAPHICS ; Utility name ;AN000; + ;AN000; + ;AN000; +:class A ; Class A messages (General messages) ;AN000; +:use 1 COMMON1 ; 'Incorrect DOS version' ;AN000; +:use 2 EXTEND8 ; 'Insufficient memory' ;AN000; + ;AN000; + ;AN000; +:class B ; Class B messages: (Profile loading) ;AN000; +:def 9 'Cannot find GRAPHICS profile',CR,LF ;AN000; +:def 10 'Required profile statement missing before line %1',CR,LF ;AN000; +:def 11 'Invalid profile statement on line %1',CR,LF ;AN000; +:def 12 'Profile statement out of sequence on line %1',CR,LF ;AN000; +:def 13 'Error reading GRAPHICS profile',CR,LF ;AN000; +:def 14 'Syntax errors in GRAPHICS profile',CR,LF ;AN000; +:def 15 'Printbox ID not in GRAPHICS profile',CR,LF ;AC001; +:def 16 'Printer type not in GRAPHICS profile',CR,LF ;AN000; + ;AN000; +:class C ; Class C messages: (Command line parsing) ;AN000; +:use 3 PARSE1 ; 'Too many parameters' ;AN000; +:use 4 PARSE6 ; 'Parameter value not allowed' ;AN000; +:def 5 'Invalid parameter: %1',CR,LF ;AN000; +:use 6 PARSE11 ; 'Invalid parameter combination' ;AN000; +:def 7 'Duplicate parameters not allowed',CR,LF ;AN000; +:use 8 PARSE8 ; 'Parameter format not correct' ;AN000; +:def 17 '/B invalid with a black and white printer',CR,LF ;AN000; +:def 18 'Unable to reload with profile supplied',CR,LF ;AN000; +:end ;AN000; diff --git a/v4.0/src/CMD/GRAPHICS/GRBWPRT.ASM b/v4.0/src/CMD/GRAPHICS/GRBWPRT.ASM new file mode 100644 index 0000000..7b09ffd --- /dev/null +++ b/v4.0/src/CMD/GRAPHICS/GRBWPRT.ASM @@ -0,0 +1,631 @@ + PAGE ,132 ;AN000; + TITLE DOS GRAPHICS Command - Black and White printing modules +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;AN000; +;; DOS - GRAPHICS Command +;; (c) Copyright 1988 Microsoft +;; ;AN000; +;; File Name: GRBWPRT.ASM ;AN000; +;; ---------- ;AN000; +;; ;AN000; +;; Description: ;AN000; +;; ------------ ;AN000; +;; This file contains the code for printing a GRAPHICS screen on a ;AN000; +;; BLACK and WHITE printer. ;AN000; +;; ;AN000; +;; Documentation Reference: ;AN000; +;; ------------------------ ;AN000; +;; OASIS High Level Design ;AN000; +;; OASIS GRAPHICS I1 Overview ;AN000; +;; ;AN000; +;; Procedures Contained in This File: ;AN000; +;; ---------------------------------- ;AN000; +;; ;AN000; +;; PRINT_BW_APA ;AN000; +;; FILL_BUFFER ;AN000; +;; INT2PAT ;AN000; +;; PAT2BOX ;AN000; +;; ;AN000; +;; ;AN000; +;; Include Files Required: ;AN000; +;; ----------------------- ;AN000; +;; GRCTRL.EXT - Externals for print screen control ;AN000; +;; GRCTRL.STR - Structures and equates for print screen control ;AN000; +;; GRPATTRN.STR - Structures for the printer patterns. ;AN000; +;; ;AN000; +;; GRSHAR.STR - Shared Data Area Structure ;AN000; +;; ;AN000; +;; STRUC.INC - Macros for using structured assembly language ;AN000; +;; ;AN000; +;; ;AN000; +;; External Procedure References: ;AN000; +;; ------------------------------ ;AN000; +;; FROM FILE GRCTRL.ASM: ;AN000; +;; PRT_SCR - Main module for printing the screen. ;AN000; +;; TO FILE GRCOMMON.ASM ;AN000; +;; Common modules - tools for printing a screen. ;AN000; +;; ;AN000; +;; Linkage Instructions: ;AN000; +;; -------------------- ;AN000; +;; This file is included by GRCTRL.ASM ;AN000; +;; ;AN000; +;; Change History: ;AN000; +;; --------------- ;AN000; +;; ;AN000; +;; ;AN000; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;AN000; +PAGE ;AN000; +CODE SEGMENT PUBLIC 'CODE' ;AN000; + ASSUME CS:CODE,DS:CODE ;AN000; + ;AN000; + PUBLIC PRINT_BW_APA ;AN000; + PUBLIC LEN_OF_BW_MODULES ;AN000; + ;AN000; +.XLIST ;AN000; +INCLUDE GRCTRL.STR ; Stuctures needed ;AN000; +INCLUDE GRSHAR.STR ; for both set of print modules ;AN000; +INCLUDE GRPATTRN.STR ; ;AN000; +INCLUDE GRCTRL.EXT ; Externals from PRT_SCR control module ;AN000; +INCLUDE STRUC.INC ; ;AN000; + ;AN000; + PUBLIC PRINT_BW_APA ; Black and white modules, ;AN000; +.LIST ;AN000; +;===============================================================================;AN000; +; ;AN000; +; PRINT_BW_APA : PRINT A GRAPHIC MODE SCREEN ON A BLACK AND WHITE PRINTER ;AN000; +; ;AN000; +;-------------------------------------------------------------------------------;AN000; +; ;AN000; +; INPUT: BP = Offset of the shared data area ;AN000; +; XLT_TAB = Color translation table ;AN000; +; BIOS_INT_5H = Pointer to BIOS int 5h ;AN000; +; ;AN000; +; OUTPUT: PRINTER ;AN000; +; ;AN000; +;-------------------------------------------------------------------------------;AN000; +; ;AN000; +; DESCRIPTION: This procedure maps each pixel of the screen to a box ;AN000; +; of dots on the printer. The box size depends on the screen resolution ;AN000; +; and the number of bytes per printer line. It is chosen in order to ;AN000; +; respect the screen ratio and is documented in each printer profile. ;AN000; +; ;AN000; +; For efficiency and space considerations, the print buffer does not ;AN000; +; hold a full print line. Bytes representing pixels are printed as soon ;AN000; +; as they are ready to be printed. However, the print buffer is wide ;AN000; +; enough to hold complete boxes. ;AN000; +; ;AN000; +; The order for reading pixels off the screen is driven by the ;AN000; +; order bytes are expected by the printer. To print the screen in its ;AN000; +; original orientation we must begin reading it from the top left corner ;AN000; +; and send the pixels line by line; to print it sideways, reading will ;AN000; +; start from the bottom left corner and a "LINE" will now be a vertical ;AN000; +; screen column read from bottom to top. ;AN000; +; ;AN000; +; There is more to it however, the printer head is printing a ;AN000; +; vertical column of 8 dots at a time and each pixel read is mapped to ;AN000; +; a box of dots that is less than 8 dots high (e.g., 2 cols x 1 row) ;AN000; +; therefore, many boxes must be stored in the bytes sent to the printer. ;AN000; +; ;AN000; +; These boxes represent pixels that are one above each other on the ;AN000; +; screen. We must read enough pixels on one column of the screen to use ;AN000; +; all 8 bits of the vertical printer head (e.g., if the box size is 2x1 ;AN000; +; then 8 pixels must be read and 2 bytes of the print buffer will be ;AN000; +; filled). ;AN000; +; ;AN000; +; The PRINT BUFFER for any box size will be 8 bits high by "BOX ;AN000; +; WIDTH" bits wide. ;AN000; +; ;AN000; +; After the buffer is filled, it is printed and the next "column" ;AN000; +; of 8 pixels is read. Therefore, the screen is read "line by line" ;AN000; +; where a line is 8 pixels high for a 2x1 box (4 pixels high for a 3x2 ;AN000; +; box). ONE SUCH LINE IS CALLED A SCAN LINE. ;AN000; +; ;AN000; +PAGE ;AN000; +; ;AN000; +; A 350X200 screen mapping to a 3x2 box is read in the following order: ;AN000; +; ;AN000; +; SCREEN: ;AN000; +; ;AN000; +; column column . . . column ;AN000; +; no. 0 no. 1 no. 349 ;AN000; +; ͻ ;AN000; +; scan 1(0,0) 5(0,1) 1397(0,349) ;AN000; +; line 2(1,0) 6(1,1) . . . . . . . 1398(1,349) ;AN000; +; no. 1 3(2,0) 7(2,1) 1399(2,349) ;AN000; +; 4(3,0) 8(3,1) 1400(3,349) ;AN000; +; ;AN000; +; scan 1401(4,0) 1405(4,1) LEGEND: n(X,Y) ;AN000; +; line 1402(5,0) etc, ;AN000; +; no. 2 1403(6,0) . . . . . n = READ RANK ;AN000; +; 1404(7,0) X = ROW NUMBER ;AN000; +; . Y = COLUMN NUMBER ;AN000; +; etc, . ;AN000; +; . 70000(199,349) ;AN000; +; ͼ ;AN000; +; ;AN000; +; ;AN000; +; LOGIC : ;AN000; +; ;AN000; +; Initialize printer and local variables. ;AN000; +; CALL LOC_MODE_PRT_INFO ; Get printer info related to current mode. ;AN000; +; CALL GET_SCREEN_INFO ; Get info. about how to read the screen ;AN000; +; CALL SETUP_PRT ; Set up the printer (Line spacing, etc) ;AN000; +; ;AN000; +; FOR each scan line on the screen (NB_SCAN_LINES) ;AN000; +; (Note: One scan line maps to one print line) ;AN000; +; BEGIN ;AN000; +; CALL DET_CUR_SCAN_LNE_LENGTH ; Determine length in pels of the current ;AN000; +; ; scan line. ;AN000; +; IF CUR_SCAN_LNE_LENGTH NE 0 THEN ;AN000; +; CALL NEW_PRT_LINE ; Initialize a new printer line ;AN000; +; DO CUR_SCAN_LNE_LENGTH times ; For each column ;AN000; +; BEGIN ;AN000; +; CALL FILL_BUFFER ; Read top-down enough pels to fill the buffer ;AN000; +; CALL PRINT_BUFFER ; Print the buffer ;AN000; +; IF printing sideways THEN INC CUR_ROW ; Get coordinates of next ;AN000; +; ELSE INC CUR_COLUMN ; "column" (vertical chunk of ;AN000; +; END (for each column) ; a scan line). ;AN000; +; PRINT_BYTE CR ; Print a CR and a LF ;AN000; +; PRINT_BYTE LF ;AN000; +; ; Get coordinates of next scan line: ;AN000; +; IF printing sideways THEN ;AN000; +; ADD CUR_COLUMN,NB_BOXES_PER_PRT_BUF ;AN000; +; MOV CUR_ROW,SCREEN_HEIGHT - 1 ;AN000; +; ELSE ;AN000; +; ADD CUR_ROW,NB_BOXES_PER_PRT_BUF ;AN000; +; MOV CUR_COLUMN,0 ;AN000; +; END (for each scan line) ;AN000; +; ;AN000; +PRINT_BW_APA PROC NEAR ;AN000; + PUSH AX ;AN000; + PUSH BX ;AN000; + PUSH CX ;AN000; + ;AN000; +;-------------------------------------------------------------------------------;AN000; +; ;AN000; +; INITIALIZATION: ;AN000; +; ;AN000; +; 1) Locate and extract printer DISPLAYMODE information from ;AN000; +; the shared data area, calculate the number of boxes fitting ;AN000; +; in the printer buffer. ;AN000; +; 2) Determine where to start reading the screen: ;AN000; +; If printing sideways, start in LOW LEFT corner. ;AN000; +; If normal printing, start in TOP LEFT corner. ;AN000; +; Determine the maximum length for a scan line: ;AN000; +; If printing sideways, it is the height of the screen. ;AN000; +; For normal printing, it is the width of the screen. ;AN000; +; Determine the number of scan lines on the screen. ;AN000; +; 3) Set up the Printer for printing Graphics. ;AN000; +; ;AN000; +;-------------------------------------------------------------------------------;AN000; + CALL LOC_MODE_PRT_INFO ; Get printer info related to curr. mode;AN000; +; ;AN000; +;-------Test if DISPLAYMODE info record was found: ;AN000; + .IF ;AN000; + .THEN ;AN000; + MOV ERROR_CODE,UNABLE_TO_PRINT ; IF no record found, ;AN000; + JMP PRINT_BW_APA_END ; then, return error code ;AN000; + .ENDIF ; and quit procedure ;AN000; +; ;AN000; +;-------Get the box size from the DISPLAYMODE info record: ;AN000; + MOV BX,CUR_MODE_PTR ; BX := Offset current DISPLAYMODE info.;AN000; + MOV AH,[BX].BOX_WIDTH ; Take local copy of the box size. ;AN000; + MOV BOX_W,AH ; in BOX_W and BOX_H ;AN000; + MOV AL,[BX].BOX_HEIGHT ;AN000; + MOV BOX_H,AL ;AN000; +; ;AN000; +;-------Verify if the box size obtained from DISPLAYMODE info. is valid ;AN000; + .IF OR ; IF height of the box is 0 ;AN000; + .IF ; OR width of the box is 0 ;AN000; + .THEN ; THEN we can't print: ;AN000; + MOV ERROR_CODE,UNABLE_TO_PRINT ; return error code ;AN000; + JMP PRINT_BW_APA_END ; and quit ;AN000; + .ENDIF ;AN000; +; ;AN000; +;-------Get the Print Orientation from the DISPLAYMODE info record ;AN000; + .IF <[BX].PRINT_OPTIONS EQ ROTATE>; If printing sideways ;AN000; + .THEN ; then: ;AN000; + MOV ROTATE_SW,ON ; Rotate switch := "ON" ;AN000; + .ENDIF ;AN000; + ;AN000; +; ;AN000; +;-------Initialize print variables and the printer: ;AN000; + CALL GET_SCREEN_INFO ; Get info. about how to read the screen;AN000; + CALL SETUP_PRT ; Set up the printer (Line spacing, etc);AN000; + .IF ;AN000; + .THEN ; A printer error occurred: quit ;AN000; + JMP PRINT_BW_APA_END ; ;AN000; + .ENDIF ;AN000; + ;AN000; + MOV CX,NB_SCAN_LINES ;AN000; +;-------------------------------------------------------------------------------;AN000; +; ;AN000; +; FOR EACH SCAN LINE ON THE SCREEN: ;AN000; +; ;AN000; +;-------------------------------------------------------------------------------;AN000; +PRINT_1_SCAN_LINE: ;AN000; + CALL DET_CUR_SCAN_LNE_LENGTH ; Determine how many non-blanks on line ;AN000; +.IF ; If line is not empty ;AN000; +.THEN ; then, ;AN000; + CALL NEW_PRT_LINE ; Send escape sequence to the printer ;AN000; + .IF ; for starting a new line. ;AN000; + .THEN ; If a printer error occurred: ;AN000; + JMP PRINT_BW_APA_END ; Quit ! ;AN000; + .ENDIF ;AN000; + ;AN000; + PUSH CX ; Save scan line counter ;AN000; + MOV CX,CUR_SCAN_LNE_LENGTH ;AN000; +;-------------------------------------------------------------------------------;AN000; +; ;AN000; +; FOR each column on the current scan line (up to the last non-blank): ;AN000; +; ;AN000; +;-------------------------------------------------------------------------------;AN000; +PRINT_1_SCAN_COLUMN: ;AN000; + CALL FILL_BUFFER ; Read all pixels on this column, ;AN000; + ; convert each to a printer box, ;AN000; + ; store boxes in the print buffer ;AN000; + ; (a buffer contains one "column" ;AN000; + ; of pixels). ;AN000; + CALL PRINT_BUFFER ; Print the buffer. ;AN000; + .IF ;AN000; + .THEN ; A printer error occurred: ;AN000; + POP CX ; Restore scan line counter and quit ;AN000; + JMP PRINT_BW_APA_END ; ;AN000; + .ENDIF ;AN000; + ;AN000; + ;AN000; +;-------Get coordinates of next "column": ;AN000; + .IF ; If printing sideways ;AN000; + .THEN ; ;AN000; + DEC CUR_ROW ; then, get row above on screen ;AN000; + .ELSE ; ;AN000; + INC CUR_COLUMN ; else, get column next right ;AN000; + .ENDIF ; ;AN000; + ;AN000; + LOOP PRINT_1_SCAN_COLUMN ; Print next column ;AN000; + ;AN000; + POP CX ; Restore scan line counter ;AN000; +.ENDIF ; Endif line is not empty ;AN000; +;-------------------------------------------------------------------------------;AN000; +; ;AN000; +; Print a carriage return and a line feed: ;AN000; +; ;AN000; +;-------------------------------------------------------------------------------;AN000; + MOV AL,CR ;AN000; + CALL PRINT_BYTE ; Send CR ;AN000; + JC PRINT_BW_APA_END ; If printer error, leave ;AN000; + MOV AL,LF ;AN000; + CALL PRINT_BYTE ; Send LF ;AN000; + JC PRINT_BW_APA_END ; If printer error, leave ;AN000; +;-------------------------------------------------------------------------------;AN000; +; ;AN000; +; Get coordinates of next scan line: ;AN000; +; ;AN000; +;-------------------------------------------------------------------------------;AN000; + .IF ; If printing sideways ;AN000; + .THEN ; then: ;AN000; + MOV AL,NB_BOXES_PER_PRT_BUF ; AX := Numbers of pels read on row ;AN000; + CBW ; ;AN000; + ADD CUR_COLUMN,AX ; CUR_COLUMN + Number of pels read ;AN000; + MOV AX,SCREEN_HEIGHT ; CUR_ROW := SCREEN_HEIGHT - 1 ;AN000; + DEC AX ; ;AN000; + MOV CUR_ROW,AX ; ;AN000; + .ELSE ; else, printing NOT rotated: ;AN000; + MOV AL,NB_BOXES_PER_PRT_BUF ; AX := Number of pels read on colum;AN000; + CBW ; ;AN000; + ADD CUR_ROW,AX ; CUR_ROW + Number of pels read ;AN000; + MOV CUR_COLUMN,0 ; CUR_COLUMN := 0 ;AN000; + .ENDIF ; ;AN000; + LOOP PRINT_1_SCAN_LINE ; ;AN000; + ;AN000; +;-------------------------------------------------------------------------------;AN000; +; ;AN000; +; Restore the printer. ;AN000; +; ;AN000; +;-------------------------------------------------------------------------------;AN000; + CALL RESTORE_PRT ;AN000; +PRINT_BW_APA_END: ;AN000; + POP CX ;AN000; + POP BX ;AN000; + POP AX ;AN000; + RET ;AN000; +PRINT_BW_APA ENDP ;AN000; +PAGE ;AN000; +;===============================================================================;AN000; +; ;AN000; +; FILL_BUFFER : READS ENOUGH PIXELS TO FILL UP THE PRINT BUFFER. ;AN000; +; THESE PIXELS ARE MAPPED TO A PRINTER DOT BOX. ;AN000; +; ;AN000; +;-------------------------------------------------------------------------------;AN000; +; ;AN000; +; INPUT: CUR_COLUMN, ;AN000; +; CUR_ROW = Coordinates of the first pixel to be read ;AN000; +; BOXES_PER_PRT_BUF = Number of boxes fitting in the print ;AN000; +; buffer ;AN000; +; XLT_TAB = Color translation table ;AN000; +; ;AN000; +; OUTPUT: PRT_BUF = PRINT BUFFER ;AN000; +; ;AN000; +;-------------------------------------------------------------------------------;AN000; +; ;AN000; +; DESCRIPTION: ;AN000; +; ;AN000; +; 1) Pixels are read one by one vertically from top to bottom in ;AN000; +; the current column of the screen scan line. ;AN000; +; NOTE: What is called here a 'column' can actually be a line ;AN000; +; on the physical display. ;AN000; +; 2) Each pixel is mapped to a printer dot box. ;AN000; +; 3) Each Dot box is stored in the printer buffer. ;AN000; +; 4) The coordinates in input are those of the "top" pixel ;AN000; +; and restored when leaving this procedure. ;AN000; +; ;AN000; +; ;AN000; +; LOGIC: ;AN000; +; ;AN000; +; Save coordinates of the current "column" (slice of a screen scan line) ;AN000; +; DO for BOXES_PER_PRT_BUF (8 / BOX_H) ;AN000; +; BEGIN ;AN000; +; CALL READ_DOT ; Read a pixel, get index in XLT_TAB ;AN000; +; Get pixel intensity from XLT_TAB ;AN000; +; CALL INT2PAT ; Locate pattern corresponding to int. ;AN000; +; CALL PAT2BOX ; Extract box from pattern ;AN000; +; CALL STORE_BOX ; Store the box in the printer buffer ;AN000; +; ; Get coordinates of next pixel below: ;AN000; +; IF printing is sideways THEN INC CUR_COLUMN ;AN000; +; ELSE INC CUR_ROW ;AN000; +; END ;AN000; +; Restore initial coordinates. ;AN000; +; ;AN000; +FILL_BUFFER PROC NEAR ;AN000; + PUSH AX ;AN000; + PUSH BX ;AN000; + PUSH CX ;AN000; + PUSH SI ;AN000; + PUSH DI ;AN000; + ;AN000; +;-------------------------------------------------------------------------------;AN000; +; ;AN000; +; Save initial coordinates: ;AN000; +; ;AN000; +;-------------------------------------------------------------------------------;AN000; + PUSH CUR_ROW ;AN000; + PUSH CUR_COLUMN ;AN000; + ;AN000; +;-------Clear the print buffer: ;AN000; + XOR BX,BX ; For each byte in the PRT_BUF: ;AN000; +CLEAR_PRT_BUF: ;AN000; + MOV PRT_BUF[BX],0 ; Initialize byte to blanks ;AN000; + INC BX ; Get next byte ;AN000; + CMP BL,BOX_W ; All bytes cleared ? ;AN000; + JL CLEAR_PRT_BUF ; No, clear next one. ;AN000; + ;AN000; + MOV BX,OFFSET XLT_TAB ; BX := Offset of XLT_TAB ;AN000; + ;AN000; +;-------Fill the print buffer with one box for each pixel read: ;AN000; + XOR CX,CX ; CL := Number of pixels to read ;AN000; + MOV CL,NB_BOXES_PER_PRT_BUF ;AN000; +;-------------------------------------------------------------------------------;AN000; +; ;AN000; +; For each pixel within the current column of the scan line: ;AN000; +; ;AN000; +;-------------------------------------------------------------------------------;AN000; +READ_AND_STORE_1_PIXEL: ;AN000; + CALL READ_DOT ; AL := Index into translation table ;AN000; + XLAT XLT_TAB ; AL := Intensity ;AN000; + CALL INT2PAT ; SI := Offset of matching Pattern ;AN000; + CALL PAT2BOX ; Extract CUR_BOX from the pattern. ;AN000; + MOV SI,OFFSET CUR_BOX ; Store it in the PRT_BUF ;AN000; + CALL STORE_BOX ;AN000; + ;AN000; +;-------Get coordinates of next pixel: ;AN000; + .IF ; If printing sideways ;AN000; + .THEN ; ;AN000; + INC CUR_COLUMN ; then, increment column number ;AN000; + .ELSE ; ;AN000; + INC CUR_ROW ; else, increment row number ;AN000; + .ENDIF ; ;AN000; + LOOP READ_AND_STORE_1_PIXEL ;AN000; + ;AN000; +;-------------------------------------------------------------------------------;AN000; +; ;AN000; +; Restore initial coordinates: ;AN000; +; ;AN000; +;-------------------------------------------------------------------------------;AN000; + POP CUR_COLUMN ;AN000; + POP CUR_ROW ;AN000; + ;AN000; + POP DI ;AN000; + POP SI ;AN000; + POP CX ;AN000; + POP BX ;AN000; + POP AX ;AN000; + RET ;AN000; +FILL_BUFFER ENDP ;AN000; +PAGE ;AN000; +;===============================================================================;AN000; +; ;AN000; +; INT2PAT : MAP AN INTENSITY TO A PATTERN. ;AN000; +; ;AN000; +;-------------------------------------------------------------------------------;AN000; +; ;AN000; +; INPUT: AL = GREY INTENSITY (0 - 63 = BLACK to WHITE) ;AN000; +; BOX_W = Number of columns in a box ;AN000; +; CUR_MODE_PTR = Offset of current DISPLAYMODE info record ;AN000; +; ;AN000; +; OUTPUT: SI = OFFSET OF THE PATTERN MATCHING THE INTENSITY ;AN000; +; ;AN000; +;-------------------------------------------------------------------------------;AN000; +; ;AN000; +; DESCRIPTION: Performs a sequential search in the table of patterns ;AN000; +; until the proper pattern is found. ;AN000; +; ;AN000; +; ;AN000; +; SI = 0 ; FOUND = FALSE ;AN000; +; DO UNTIL FOUND = TRUE ;AN000; +; BEGIN ;AN000; +; IF AL <= Maximum intensity of the current pattern in the table ;AN000; +; THEN ;AN000; +; FOUND = TRUE ;AN000; +; ELSE ;AN000; +; SI = SI + (BOX_W * 2) ;AN000; +; END ;AN000; +; ;AN000; +INT2PAT PROC NEAR ;AN000; + PUSH AX ;AN000; + PUSH BX ;AN000; + PUSH DX ;AN000; + ;AN000; +;-------Calculate the size in bytes of one pattern STRUCTURE: (see GRPATTRN.STR);AN000; + MOV DL,BOX_W ; DX := Number of columns in the box ;AN000; + XOR DH,DH ;AN000; + SHL DL,1 ; (DX * 2) = Number of columns in the pattern ;AN000; + INC DL ; DL := Size in bytes of one pattern ;AN000; + ; (includes intensity field) ;AN000; + MOV BX,CUR_MODE_PTR ; BX := Offset of current mode ;AN000; + ; SI := Offset of the first pattern ;AN000; + MOV SI,[BX].PATTERN_TAB_PTR ;AN000; + ADD SI,BP ;AN000; + ;AN000; +COMPARE_INTENSITY: ;AN000; + CMP AL,[SI] ; Within the range of this pattern ? ;AN000; + JLE FOUND_PATTERN ; Yes, use this pattern. ;AN000; + ; No, look at next pattern: ;AN000; + ADD SI,DX ; SI := SI + Number columns in pattern) ;AN000; + JMP SHORT COMPARE_INTENSITY ;AN000; + ;AN000; +FOUND_PATTERN: ;AN000; + ;AN000; + POP DX ;AN000; + POP BX ;AN000; + POP AX ;AN000; + RET ;AN000; + ;AN000; +INT2PAT ENDP ;AN000; +PAGE ;AN000; +;===============================================================================;AN000; +; ;AN000; +; PAT2BOX : SELECT AND EXTRACT THE PROPER BOX FROM THE PATTERN ACCORDING ;AN000; +; TO THE COORDINATES OF THE PIXEL. ;AN000; +; ;AN000; +;-------------------------------------------------------------------------------;AN000; +; ;AN000; +; INPUT: SI = OFFSET OF CURRENT PATTERN ;AN000; +; CUR_COLUMN, ;AN000; +; CUR_ROW = COORDINATES OF THE CURRENT PIXEL ;AN000; +; ;AN000; +; OUTPUT: CUR_BOX = PORTION OF THE PATTERN TO BE PRINTED ;AN000; +; ;AN000; +;-------------------------------------------------------------------------------;AN000; +; ;AN000; +; DESCRIPTION: If the pixel is on even-even coordinates, then the ;AN000; +; top-left box of the pattern is extracted. ;AN000; +; If its Even-odd --> extract the top-right box. ;AN000; +; Odd-even --> low-left box, and Odd-odd --> low-right box. ;AN000; +; ;AN000; +PAGE ;AN000; +; For example., (with a 3x2 box): ;AN000; +; ;AN000; +; PATTERN (over 6 bytes): ;AN000; +; ;AN000; +; ;AN000; +; byte1 byte2 byte3 byte4 byte5 byte6 ;AN000; +; ;AN000; +; 0 0 0 0 0 0 ;AN000; +; 0 0 0 0 0 0 ;AN000; +; 0 0 0 0 0 0 ;AN000; +; 0 0 0 0 0 0 ;AN000; +; even-even --> dot1 dot2 dot3 | dot1 dot2 dot3 <-- even-odd ;AN000; +; (row-column) dot4 dot5 dot6 | dot4 dot5 dot6 box ;AN000; +; box. ------------------------------------------------ ;AN000; +; odd-even --> dot1 dot2 dot3 | dot1 dot2 dot3 <-- odd-odd ;AN000; +; box dot4 dot5 dot6 | dot4 dot5 dot6 box ;AN000; +; ;AN000; +; ;AN000; +; The selected box is then stored as follow: ;AN000; +; ;AN000; +; CUR_BOX: ;AN000; +; byte1 byte2 byte3 ;AN000; +; MSB ------> 0 0 0 ;AN000; +; (bit7) 0 0 0 ;AN000; +; 0 0 0 ;AN000; +; 0 0 0 ;AN000; +; 0 0 0 ;AN000; +; 0 0 0 ;AN000; +; dot1 dot2 dot3 <-- box ;AN000; +; LSB ------>dot4 dot5 dot6 ;AN000; +; ;AN000; +; LOGIC: ;AN000; +; IF CUR_ROW is odd ;AN000; +; THEN SI := SI + BOX_W ; Access right portion of pattern ;AN000; +; Build a bit mask in BL of BOX_H bits, right justified. ;AN000; +; FOR each column in the box (BOX_W) ;AN000; +; Get the pattern column in AL ;AN000; +; IF CUR_COLUMN is even ;AN000; +; THEN ;AN000; +; Move down the column of the top box. ;AN000; +; AND BL,AL ; BL <-- Column of the desired box ;AN000; +; ;AN000; +; ;AN000; +PAT2BOX PROC NEAR ;AN000; + PUSH AX ;AN000; + PUSH BX ;AN000; + PUSH CX ;AN000; + PUSH SI ;AN000; + ;AN000; + ; SI := Offset of current pattern ;AN000; + INC SI ; Skip the MAX INTENSITY field ;AN000; +;-------------------------------------------------------------------------------;AN000; +; ;AN000; +; Set SI to either the left or right set of 2 boxes in the pattern: ;AN000; +; ;AN000; +;-------------------------------------------------------------------------------;AN000; + TEST CUR_ROW,1 ; Odd row ? ;AN000; + JZ EXTRACT_BOX ; No, access left portion of pattern ;AN000; + MOV AL,BOX_W ; ;AN000; + CBW ; ;AN000; + ADD SI,AX ; Yes, access right portion of pattern;AN000; + ;AN000; +;-------------------------------------------------------------------------------;AN000; +; ;AN000; +; Extract the box: ;AN000; +; ;AN000; +;-------------------------------------------------------------------------------;AN000; +EXTRACT_BOX: ;AN000; +;-------Build a bit mask that will be used to keep only BOX_H bits ;AN000; +;-------of the bytes where CUR_BOX is stored. ;AN000; + XOR AH,AH ; AH := Box column bit mask ;AN000; + MOV AL,BOX_H ; For each row of the box: ;AN000; +INIT_MASK: ; ;AN000; + SHL AH,1 ; ;AN000; + OR AH,1 ; Insert one bit in the mask. ;AN000; + DEC AL ; ;AN000; + CMP AL,0 ; ;AN000; + JG INIT_MASK ;AN000; + ;AN000; + XOR BX,BX ; BL := Column number within the box ;AN000; +; ;AN000; +;-------For each column of the box: ;AN000; +EXTRACT_1_BOX_COLUMN: ;AN000; + MOV AL,[SI] ; AL := Current column of pattern ;AN000; + TEST CUR_COLUMN,1 ; If the pixel is on ODD column ;AN000; + JNZ BOTTOM_BOX ; Then, need bottom box portion ;AN000; + MOV CL,BOX_H ; Else, need top box portion ;AN000; +TOP_BOX: ; Need top box: ;AN000; + SHR AL,CL ; Shift top box over bottom box ;AN000; +BOTTOM_BOX: ; The box we want is now at bottom ;AN000; + AND AL,AH ; Keep only bits from the box ;AN000; + MOV CUR_BOX[BX],AL ; Store this box column ;AN000; + INC SI ; Access next column of the pattern ;AN000; + INC BX ; One more column stored. ;AN000; + CMP BL,BOX_W ; All stored ? ;AN000; + JL EXTRACT_1_BOX_COLUMN ; No, continue ;AN000; + ;AN000; + POP SI ;AN000; + POP CX ;AN000; + POP BX ;AN000; + POP AX ;AN000; + RET ;AN000; +PAT2BOX ENDP ;AN000; +INCLUDE GRCOMMON.ASM ;AN000; +LEN_OF_BW_MODULES EQU $-PRINT_BW_APA ;AN000; +CODE ENDS ;AN000; + END ;AN000; diff --git a/v4.0/src/CMD/GRAPHICS/GRBWPRT.EXT b/v4.0/src/CMD/GRAPHICS/GRBWPRT.EXT new file mode 100644 index 0000000..4d7526c --- /dev/null +++ b/v4.0/src/CMD/GRAPHICS/GRBWPRT.EXT @@ -0,0 +1,24 @@ +.XLIST ;AN000; +PAGE ;AN000; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;AN000; +;; DOS - GRAPHICS Command +;; (C) Copyright 1988 Microsoft +;; ;AN000; +;; File Name: GRBWPRT.EXT ;AN000; +;; ---------- ;AN000; +;; ;AN000; +;; Description: ;AN000; +;; ------------ ;AN000; +;; Include file containing external declarations for ;AN000; +;; the code and data defined in GRBWPRT.ASM. ;AN000; +;; ;AN000; +;; Change History: ;AN000; +;; --------------- ;AN000; +;; ;AN000; +;; ;AN000; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;AN000; + ;; ;AN000; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;AN000; +.LIST ;AN000; + EXTRN PRINT_BW_APA:NEAR ;AN000; + EXTRN LEN_OF_BW_MODULES:ABS ;; ;AN000; diff --git a/v4.0/src/CMD/GRAPHICS/GRCOLPRT.ASM b/v4.0/src/CMD/GRAPHICS/GRCOLPRT.ASM new file mode 100644 index 0000000..0c1d0a2 --- /dev/null +++ b/v4.0/src/CMD/GRAPHICS/GRCOLPRT.ASM @@ -0,0 +1,1122 @@ + PAGE ,132 ;AN000; + TITLE DOS GRAPHICS Command - Color printing modules +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;AN000; +;; DOS - GRAPHICS Command +;; (c) Copyright 1988 Microsoft +;; ;AN000; +;; File Name: GRCOLPRT.ASM ;AN000; +;; ---------- ;AN000; +;; ;AN000; +;; Description: ;AN000; +;; ------------ ;AN000; +;; This file contains the code for printing a screen (text and graphics) ;AN000; +;; on a COLOR printer. ;AN000; +;; ;AN000; +;; Documentation Reference: ;AN000; +;; ------------------------ ;AN000; +;; OASIS High Level Design ;AN000; +;; OASIS GRAPHICS I1 Overview ;AN000; +;; ;AN000; +;; Procedures Contained in This File: ;AN000; +;; ---------------------------------- ;AN000; +;; ;AN000; +;; PRINT_COLOR ;AN000; +;; SCAN_FOR_BANDS_APA ;AN000; +;; SCAN_FOR_BANDS_TXT ;AN000; +;; PRINT_BAND_APA ;AN000; +;; PRINT_BAND_TXT ;AN000; +;; SET_CURSOR ;AN000; +;; SET_COLOR_BAND ;AN000; +;; INIT_BLACK_BOX ;AN000; +;; ;AN000; +;; ;AN000; +;; Include Files Required: ;AN000; +;; ----------------------- ;AN000; +;; ;AN000; +;; GRCTRL.EXT - Externals for print screen control ;AN000; +;; GRCTRL.STR - Structures and equates for print screen control ;AN000; +;; GRPATTRN.STR - Structures for the printer patterns. ;AN000; +;; ;AN000; +;; GRSHAR.STR - Shared Data Area Structure ;AN000; +;; ;AN000; +;; STRUC.INC - Macros for using structured assembly language ;AN000; +;; ;AN000; +;; External Procedure References: ;AN000; +;; ------------------------------ ;AN000; +;; FROM FILE GRCTRL.ASM: ;AN000; +;; PRT_SCR - Main module for printing the screen. ;AN000; +;; TO FILE GRCOMMON.ASM ;AN000; +;; Common modules - tools for printing a screen. ;AN000; +;; ;AN000; +;; Linkage Instructions: ;AN000; +;; -------------------- ;AN000; +;; Refer to GRAPHICS.ASM ;AN000; +;; ;AN000; +;; Change History: ;AN000; +;; --------------- ;AN000; +;; Date last updated 5/26/87. ;AN000; +;; ;AN000; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;AN000; +PAGE ;AN000; +CODE SEGMENT PUBLIC 'CODE' ;AN000; + ASSUME CS:CODE,DS:CODE ;AN000; + ;AN000; + PUBLIC PRINT_MODULE_START ;; Color modules public ;AN000; + PUBLIC PRINT_COLOR ;; procedures ;AN000; + PUBLIC LEN_OF_COLOR_MODULES ;; ;AN000; + ;; ;AN000; +.XLIST ; ;AN000; +INCLUDE GRCTRL.STR ; Stuctures needed ;AN000; +INCLUDE GRSHAR.STR ; for both set of print modules ;AN000; +INCLUDE GRPATTRN.STR ; ;AN000; + ; ;AN000; +INCLUDE GRCTRL.EXT ; Externals from PRT_SCR control module ;AN000; +INCLUDE STRUC.INC ; ;AN000; +.LIST ; ;AN000; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AN000; +;; ;AN000; +;; ;AN000; +;; PRINT_COLOR : PRINT TEXT AND APA MODE SCREEN ON A COLOR PRINTER ;AN000; +;; ;AN000; +;-------------------------------------------------------------------------------;AN000; +; ;AN000; +; INPUT: BP = Offset of the shared data area ;AN000; +; XLT_TAB = Color translation table ;AN000; +; ;AN000; +; OUTPUT: PRINTER ;AN000; +; ;AN000; +;-------------------------------------------------------------------------------;AN000; +;; ;AN000; +;; Description: ;AN000; +;; Main control module for printing of text and graphics ;AN000; +;; on color printers. ;AN000; +;; ;AN000; +;; Calls either the text or graphics mode routine. ;AN000; +;; ;AN000; +;; Called By: ;AN000; +;; PRINT_SCREEN ;AN000; +;; ;AN000; +;; External Calls: ;AN000; +;; LOC_MODE_PRT_INFO, PRINT_COLOR_APA, PRINT_COLOR_TXT ;AN000; +;; ;AN000; +;; Logic: ;AN000; +;; IF MODE_TYPE = TXT ;AN000; +;; THEN CALL PRINT_COLOR_TXT ;AN000; +;; ELSE (MODE_TYPE = APA) ;AN000; +;; CALL LOC_MODE_PRT_INFO ; Get DISPLAYMODE record from the SHARED AREA ;AN000; +;; CALL PRINT_COLOR_APA ;AN000; +;; RETURN ;AN000; +;; ;AN000; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;AN000; +PRINT_MODULE_START LABEL BYTE ;AN000; +PRINT_COLOR PROC NEAR ;AN000; + JMP SHORT PRINT_COLOR_BEGIN ;AN000; +WHITE_BOX DB 0,0,0,0 ; Print boxes for APA mode ;AN000; +BLACK_BOX DB ?,?,?,? ; NOTE: 1 print box = 1 screen pixel ;AN000; + ; only BOX_W bytes are used out of these 2 ;AN000; + ; boxes. ;AN000; + ;AN000; +REQ_BAND_MASK DB ? ; Mask = "All color bands needed for the current;AN000; + ; print line". ;AN000; + ;AN000; +PRINT_COLOR_BEGIN: ;AN000; +.IF ;AN000; +.THEN ;AN000; +;-------------------------------------------------------------------------------;AN000; +; The screen is in a text mode: ;AN000; +;-------------------------------------------------------------------------------;AN000; + CALL PRINT_COLOR_TXT ; Print a text screen on a color printer;AN000; +.ELSE ;AN000; +;-------------------------------------------------------------------------------;AN000; +; The screen is in All Points Addressable mode: ;AN000; +; Locate and extract printer DISPLAYMODE information from ;AN000; +; the shared data area. ;AN000; +;-------------------------------------------------------------------------------;AN000; + CALL LOC_MODE_PRT_INFO ; Get printer info related to curr. mode;AN000; +; ;AN000; +;-------Test if DISPLAYMODE info record was found: ;AN000; + .IF ;AN000; + .THEN ;AN000; + MOV ERROR_CODE,UNABLE_TO_PRINT ; IF no record found, ;AN000; + JMP SHORT PRINT_COLOR_END ; then, return error code ;AN000; + .ENDIF ; and quit procedure ;AN000; +; ;AN000; +;-------Get the box size from the DISPLAYMODE info record: ;AN000; + MOV BX,CUR_MODE_PTR ; BX := Offset current DISPLAYMODE info.;AN000; + MOV AH,[BX].BOX_WIDTH ; Take local copy of the box size. ;AN000; + MOV BOX_W,AH ; in BOX_W and BOX_H ;AN000; + MOV AL,[BX].BOX_HEIGHT ;AN000; + MOV BOX_H,AL ;AN000; +; ;AN000; +;-------Verify if the box size obtained from DISPLAYMODE info. is valid ;AN000; + .IF OR ; IF height of the box is 0 ;AN000; + .IF ; OR width of the box is 0 ;AN000; + .THEN ; THEN we can't print: ;AN000; + MOV ERROR_CODE,UNABLE_TO_PRINT ; return error code ;AN000; + JMP SHORT PRINT_COLOR_END ; and quit ;AN000; + .ENDIF ;AN000; +; ;AN000; +;-------Get the Print Orientation from the DISPLAYMODE info record ;AN000; + .IF <[BX].PRINT_OPTIONS EQ ROTATE>; If printing sideways ;AN000; + .THEN ; then: ;AN000; + MOV ROTATE_SW,ON ; Rotate switch := "ON" ;AN000; + .ENDIF ;AN000; + CALL PRINT_COLOR_APA ; Print APA screen on a color printer ;AN000; +.ENDIF ;AN000; +PRINT_COLOR_END: ;AN000; + RET ;AN000; +PRINT_COLOR ENDP ;AN000; +PAGE ;AN000; +;===============================================================================;AN000; +; ;AN000; +; PRINT_COLOR_TXT: PRINT A TEXT MODE SCREEN ON A COLOR PRINTER ;AN000; +; ;AN000; +;-------------------------------------------------------------------------------;AN000; +; ;AN000; +; INPUT: BP = Offset of the shared data area ;AN000; +; XLT_TAB = Color translation table ;AN000; +; SCREEN_WIDTH = Maximum length of Screen scan line. ;AN000; +; SCREEN_HEIGHT = Number of SCAN LINES on the screen ;AN000; +; ;AN000; +; OUTPUT: PRINTER ;AN000; +; ;AN000; +;-------------------------------------------------------------------------------;AN000; +; ;AN000; +; DESCRIPTION: The screen is read and printed line by line; character by ;AN000; +; character. ;AN000; +; Each line is first scanned in order to determine what colors are present on ;AN000; +; it and what printer bands will be needed to approximate these colors. ;AN000; +; ;AN000; +; For each printer color band needed for the current line, this screen line ;AN000; +; is READ AGAIN character by character; If the color of the ;AN000; +; current character must use the current color band to be ;AN000; +; approximated; then, the character is printed. ;AN000; +; ;AN000; +; ;AN000; +; LOGIC : ;AN000; +; ;AN000; +; Save current coordinates of the cursor. ;AN000; +; Initialize the cursor to the first character to be read (Top-left of screen) ;AN000; +; FOR each row on the screen (SCREEN_HEIGHT) ;AN000; +; BEGIN ;AN000; +; CALL SCAN_FOR_BANDS_TXT(CUR_ROW,CUR_COLUMN,REQ_BAND_MASK) ;AN000; +; CUR_BAND_MASK := 01H ;AN000; +; IF REQ_BAND_MASK <> 0 THEN ;AN000; +; DO 8 TIMES ;AN000; +; IF (REQ_BAND_MASK AND CUR_BAND_MASK)=1 THEN ;AN000; +; CALL PRINT_BAND_TXT(CUR_ROW,CUR_COLUMN,CUR_BAND_MASK) ;AN000; +; CALL PRINT_BYTE(CARRIAGE_RETURN) ;AN000; +; ENDIF ;AN000; +; Shift CUR_BAND_MASK one bit left ;AN000; +; ENDDO ;AN000; +; CALL PRINT_BYTE(LINE_FEED) ;AN000; +; ENDIF ;AN000; +; CUR_COLUMN := 0 ; Get next row coordinates ;AN000; +; CUR_ROW := CUR_ROW + 1 ;AN000; +; END ; FOR each row on the screen ;AN000; +; Restore initial coordinates of the cursor ;AN000; +; ;AN000; +PRINT_COLOR_TXT PROC ;AN000; + PUSH BX ;AN000; + PUSH CX ;AN000; + PUSH DX ;AN000; +; ;AN000; +;-------Save coordinates of the cursor on the stack: ;AN000; + MOV AH,READ_CURSOR_CALL ; Read position of the cursor on the screen;AN000; + MOV BH,CUR_PAGE ; for the current page ;AN000; + INT 10H ; Call BIOS ;AN000; + PUSH DX ; DH := Row number, DL := Column number ;AN000; + ; CX := Top line and bottom line for cursor;AN000; + ; (not needed) ;AN000; +; ;AN000; +;-------Initialize the cursor to the first character to be read ;AN000; + MOV CUR_ROW,0 ; cursor = position (0,0) on the screen ;AN000; + MOV CUR_COLUMN,0 ; (top-left corner) ;AN000; + CALL SET_CURSOR ;AN000; + ;AN000; + MOV CX,SCREEN_HEIGHT ; CX := Number of rows on the screen ;AN000; +;-------------------------------------------------------------------------------;AN000; +; ;AN000; +; FOR EACH ROW ON THE SCREEN: ;AN000; +; ;AN000; +;-------------------------------------------------------------------------------;AN000; +PRINT_1_TEXT_LINE: ;AN000; + CALL SCAN_FOR_BANDS_TXT ; REQ_BAND_MASK := Print bands needed ;AN000; + ; for this line ;AN000; + MOV DL,01H ; DL :="Current Band printed" mask ;AN000; + ;AN000; + ; NOTE: The COLORSELECT records are stored sequentially in the ;AN000; + ; Shared Data area. The band mask 00000001 corresponds to the first ;AN000; + ; record, 00000010 to the second, etc. ;AN000; + ; The COLORSELECT record indicates: "How to select the color band" ;AN000; + ; on the printer (It contains the bytes that must be sent to the printer;AN000; + ;AN000; + MOV BX,DS:[BP].COLORSELECT_PTR; BX := relative offset of COLORSELECT;AN000; + ADD BX,BP ; BX := absolute offset of COLORSELECT ;AN000; + PUSH CX ; Save row counter ;AN000; + MOV CX,8 ; For up to the maximum number of print ;AN000; + ; bands with this printer ;AN000; + ;-----------------------------------------------------------------------;AN000; + ; ;AN000; + ; FOR each Color Band available with the ribbon installed on the printer;AN000; + ; ;AN000; + ;-----------------------------------------------------------------------;AN000; + PRINT_1_COLOR_BAND_TXT: ; Do one pass of the printer head: ;AN000; + .IF ; IF this color band is needed ;AN000; + .THEN ; by any character on the line ;AN000; + CALL SET_COLOR_BAND ; then, select the color band ;AN000; + CALL PRINT_BAND_TXT ; and do one Print Pass for it. ;AN000; + .IF ;AN000; + .THEN ; A printer error occurred: ;AN000; + POP CX ; Restore the line counter ;AN000; + JMP PRINT_COLOR_TXT_END ; and quit. ;AN000; + .ENDIF ;AN000; + MOV AL,CR ; Print a carriage return ;AN000; + CALL PRINT_BYTE ;AN000; + .IF C ;AN000; + .THEN ; A printer error occurred: ;AN000; + POP CX ; Restore the line counter ;AN000; + JMP PRINT_COLOR_TXT_END ; and quit. ;AN000; + .ENDIF ; ENDIF printer error ;AN000; + .ENDIF ; ENDIF this color band is needed ;AN000; + SHL DL,1 ; Get next Color Band mask ;AN000; + ; [BX] := Next COLORSELECT record: ;AN000; + MOV AL,[BX].NUM_SELECT_ESC ; skip the escape bytes ;AN000; + XOR AH,AH ; ;AN000; + ADD BX,AX ; ;AN000; + INC BX ; skip the NUM_SELECT_ESC field ;AN000; + LOOP PRINT_1_COLOR_BAND_TXT ;AN000; + POP CX ; Restore row counter ;AN000; +; ;AN000; +;-----Print a line feed: ;AN000; + MOV AL,LF ;AN000; + CALL PRINT_BYTE ; Send the LF ;AN000; + JC PRINT_COLOR_TXT_END ; If printer error, quit ;AN000; +; ;AN000; +;-------Get coordinates of the first character in the next scan line: ;AN000; + INC CUR_ROW ; CUR_ROW + 1 ;AN000; + MOV CUR_COLUMN,0 ; CUR_COLUMN := 0 ;AN000; +; ;AN000; +;-------Point CURSOR to first character in the next scan line: ;AN000; + CALL SET_CURSOR ;AN000; + ;AN000; + LOOP PRINT_1_TEXT_LINE ; Print next scan line ;AN000; + ;AN000; +; ;AN000; +;-------Restore CURSOR to its original location (saved on the stack) ;AN000; +PRINT_COLOR_TXT_END: ;AN000; + POP DX ; DH := Row number, DL := Column number ;AN000; + MOV CL,DH ;AN000; + MOV CUR_ROW,CX ; CUR_ROW := Original row number ;AN000; + MOV CL,DL ;AN000; + MOV CUR_COLUMN,CX ; CUR_COLUMN := Original column number ;AN000; + CALL SET_CURSOR ; Set the cursor back there ;AN000; + ;AN000; + POP DX ;AN000; + POP CX ;AN000; + POP BX ;AN000; + RET ;AN000; +PRINT_COLOR_TXT ENDP ;AN000; +PAGE ;AN000; +;===============================================================================;AN000; +; ;AN000; +; SCAN_FOR_BANDS_TEXT: DETERMINE WHAT PRINTER COLOR BANDS ARE NEEDED FOR ;AN000; +; PRINTING THE COLORS ON THE CURRENT SCREEN LINE. ;AN000; +; ;AN000; +;-------------------------------------------------------------------------------;AN000; +; ;AN000; +; INPUT: CUR_ROW = row to start scanning ;AN000; +; CUR_COLUMN = column to start scanning ;AN000; +; ROTATE_SW = ON if printing is sideways ;AN000; +; ;AN000; +; OUTPUT: REQ_BAND_MASK ;AN000; +; ;AN000; +; ;AN000; +; DATA STRUCTURE REFERENCED: ;AN000; +; XLT_TAB = Color translation table ;AN000; +; ;AN000; +;-------------------------------------------------------------------------------;AN000; +; ;AN000; +; DESCRIPTION: Read all characters on the current line from left to right. ;AN000; +; For each character, extract its band mask from the color translation table. ;AN000; +; Add the band mask required for this character to the "Required Bands" mask. ;AN000; +; ;AN000; +; LOGIC : ;AN000; +; Save current coordinates ;AN000; +; DO (SCREEN_WIDTH) TIMES ;AN000; +; Read a character ;AN000; +; Get its Band Mask from the color translation table in AL ;AN000; +; OR REQ_BAND_MASK,AL ; Add its band mask to the "Required bands" mask;AN000; +; ; Get coordinates of the next character: ;AN000; +; INC CUR_COLUMN ;AN000; +; Restore initial coordinates ;AN000; +; ;AN000; +SCAN_FOR_BANDS_TXT PROC NEAR ;AN000; + PUSH CUR_ROW ; Save coordinates ;AN000; + PUSH CUR_COLUMN ;AN000; + PUSH AX ;AN000; + PUSH BX ;AN000; + PUSH CX ;AN000; + ;AN000; + MOV REQ_BAND_MASK,0 ; No Color bands needed so far... ;AN000; + MOV CX,SCREEN_WIDTH ; For each character on the screen row ;AN000; +;-------------------------------------------------------------------------------;AN000; +; ;AN000; +; FOR each character on the current scan line: ;AN000; +; ;AN000; +;-------------------------------------------------------------------------------;AN000; +SCAN_1_CHAR: ;AN000; +; ;AN000; +;-------Read the character at the current cursor position ;AN000; + CALL SET_CURSOR ; Set cursor at character to be read ;AN000; + MOV AH,READ_CHAR_CALL ; Read one character ;AN000; + MOV BH,CUR_PAGE ; at CUR_PAGE, CUR_COLUMN and CUR_ROW ;AN000; + INT 10H ; Call BIOS ;AN000; + ; AL:=Character read, AH:=Byte attribute;AN000; + AND AH,00001111B ; AH := Foreground color attribute ;AN000; + XCHG AL,AH ; AL := AH, used as index in the XLT_TAB;AN000; + MOV BX,OFFSET XLT_TAB ; BX := Offset of translation table ;AN000; + XLAT XLT_TAB ; AL = Band mask ;AN000; +; ;AN000; +;-------Obtain what Print bands are required to print the color of this char: ;AN000; + OR REQ_BAND_MASK,AL ;AN000; + ;AN000; + INC CUR_COLUMN ; Get coordinates of next character ;AN000; + LOOP SCAN_1_CHAR ; Scan next character ;AN000; + ;AN000; + POP CX ;AN000; + POP BX ;AN000; + POP AX ;AN000; + POP CUR_COLUMN ; Restore initial coordinates ;AN000; + POP CUR_ROW ;AN000; + RET ;AN000; +SCAN_FOR_BANDS_TXT ENDP ;AN000; +PAGE ;AN000; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AN000; +;; ;AN000; +;; PRINT_BAND_TXT: PRINT ALL CHARACTERS ON THE CURRENT LINE THAT ARE THE SAME ;AN000; +;; COLOR AS THE CURRENT PRINT BAND. ;AN000; +;; ;AN000; +;-------------------------------------------------------------------------------;AN000; +; ;AN000; +; INPUT: CUR_ROW, ;AN000; +; CUR_COLUMN : Coordinates of the first character to be read in ;AN000; +; the current scan line. ;AN000; +; DL : Band mask indicating what print band to use ;AN000; +; for this print pass. ;AN000; +; SCAN_LINE_LENGTH: Length of the current scan line. ;AN000; +; ;AN000; +; OUTPUT: PRINTER ;AN000; +; ;AN000; +;-------------------------------------------------------------------------------;AN000; +; LOGIC: ;AN000; +; DO (SCAN_LINE_LENGTH) TIMES ;AN000; +; CALL BIOS INT 10H Read Character - returns CHAR, COLOR_NUM ;AN000; +; IF (CUR_BAND_MASK AND XLAT_TAB[COLOR_NUM])=1 ;AN000; +; THEN IF Background color is same as Foreground color ;AN000; +; THEN ;AN000; +; CALL PRINT_BYTE(SOLID_BOX) ;AN000; +; ELSE ;AN000; +; CALL PRINT_BYTE(CHAR) ;AN000; +; ELSE ;AN000; +; CALL PRINT_BYTE(blank) ;AN000; +; Get coordinates of the next character ;AN000; +; ;AN000; +PRINT_BAND_TXT PROC ;AN000; +SOLID_BOX EQU 219 ; ASCII Code for printing a solid box ;AN000; +BLANK EQU 32 ; ASCII code for printing a space ;AN000; + PUSH CUR_COLUMN ; Save column number ;AN000; + PUSH AX ;AN000; + PUSH BX ;AN000; + PUSH CX ;AN000; + MOV CX,SCREEN_WIDTH ; CX := Number of character on one screen row ;AN000; +;===============================================================================;AN000; +; ;AN000; +; FOR each character on the current row: ;AN000; +; ;AN000; +;===============================================================================;AN000; +PRINT_1_CHAR: ;AN000; +; ;AN000; +;-------Read the character at the current cursor position ;AN000; + CALL SET_CURSOR ; Set cursor at character to be read ;AN000; + MOV AH,READ_CHAR_CALL ; Read one character ;AN000; + MOV BH,CUR_PAGE ; at CUR_PAGE, CUR_COLUMN and CUR_ROW ;AN000; + INT 10H ; Call BIOS ;AN000; + ; AL:=Character read, AH:=Byte attribute;AN000; + MOV CUR_CHAR,AL ;AN000; + MOV DH,AH ; DH := Byte attribute ;AN000; + AND DH,11110000B ; DH := Background color ;AN000; + SHR DH,1 ; DH := Background color right justified;AN000; + SHR DH,1 ;AN000; + SHR DH,1 ;AN000; + SHR DH,1 ;AN000; + AND AH,00001111B ; AH := Foreground color right justified;AN000; +; ;AN000; +;-------Test if this character should be printed (need color of the current band;AN000; + MOV AL,AH ; AL:=color used as index in the XLT_TAB;AN000; + MOV BX,OFFSET XLT_TAB ; BX := Offset of translation table ;AN000; + XLAT XLT_TAB ; AL := Band mask (DL=current band mask);AN000; + .IF ;If needs this band to print the color ;AN000; + .THEN ; of this character ;AN000; + .IF ; then: when foreground = background ;AN000; + .THEN ; send a solid box ;AN000; + MOV AL,SOLID_BOX ; ;AN000; + .ELSE ; when foreground <> background ;AN000; + MOV AL,CUR_CHAR ; send the character ;AN000; + .ENDIF ; Endif foreground = background ;AN000; + .ELSE ; else: send a blank ;AN000; + MOV AL,BLANK ; ;AN000; + .ENDIF ; Endif color band needed ;AN000; + CALL PRINT_BYTE ; Print the byte ;AN000; + JC PRINT_BAND_TXT_END ; If printer error occurred: QUIT ;AN000; + INC CUR_COLUMN ; Else, Get next column; keep going ;AN000; + LOOP PRINT_1_CHAR ;AN000; + ;AN000; +PRINT_BAND_TXT_END: ;AN000; + POP CX ;AN000; + POP BX ;AN000; + POP AX ;AN000; + POP CUR_COLUMN ; Restore column number ;AN000; + RET ;AN000; +CUR_CHAR DB ? ;AN000; +PRINT_BAND_TXT ENDP ;AN000; +PAGE ;AN000; +;===============================================================================;AN000; +; ;AN000; +; PRINT_COLOR_APA: PRINT AN APA MODE SCREEN ON A COLOR PRINTER ;AN000; +; ;AN000; +;-------------------------------------------------------------------------------;AN000; +; ;AN000; +; INPUT: BP = Offset of the shared data area ;AN000; +; XLT_TAB = Color translation table ;AN000; +; CUR_MODE_PTR = Coordinates of current DISPLAYMODE info. ;AN000; +; ;AN000; +; OUTPUT: PRINTER ;AN000; +; ;AN000; +;-------------------------------------------------------------------------------;AN000; +; ;AN000; +; DESCRIPTION: Each pixel on the screen is printed as a "box" of dots on the ;AN000; +; printer. For a screen pixel of a given color, the best color approximation ;AN000; +; is chosen among the color available on the printer. ;AN000; +; ;AN000; +; The printer colors are obtained by selecting a print band. A few more printer ;AN000; +; color are obtained by printing twice (or more times) with different color ;AN000; +; bands. ;AN000; +; ;AN000; +; For example, let's say we have a ribbon on the printer with a YELLOW CYAN ;AN000; +; MAGENTA ribbon and we read a GREEN pixel on the screen. ;AN000; +; ;AN000; +; We first determine what "box" size will be used to represent this pixel. ;AN000; +; Let's say it's a 3x2 box (this is obtained from the DISPLAYMODE record) ;AN000; +; In all cases, we will print this pixel as a 3x2 box of printer dots. ;AN000; +; That is, we will print 6 dots on the printer for one on the screen. ;AN000; +; We do not use any kind of patterns (e,g,. printing only 2 dots out of 6) ;AN000; +; for printing on the color printer. A screen pixel is either printed ;AN000; +; as a "full" box of printer dots or not printed at all (e,g,. if it's white).;AN000; +; ;AN000; +; Now, from the COLORPRINT records, we know all the colors availables on the ;AN000; +; printer, and what print bands must be used (or overlaid) in order to ;AN000; +; obtain them. ;AN000; +; ;AN000; +; So, we consult these COLORPRINT records one by one comparing how close ;AN000; +; the color of each of them is to our GREEN pixel. (the colors for our pixel ;AN000; +; AND for the printer color are both indicated in terms of RGB values) ;AN000; +; WE PICK THE CLOSEST PRINTER COLOR. ;AN000; +; ;AN000; +; To conclude, our GREEN pixel will be printed by first selecting the YELLOW ;AN000; +; band, then sending to the printer a "box". Then, the BLUE band is selected ;AN000; +; and the "box" is sent again. ;AN000; +; ;AN000; +; This process is carried line by line. ;AN000; +; ;AN000; +; For each line, we first read each pixel to see what color bands are going ;AN000; +; to be needed for this line. ;AN000; +; ;AN000; +; Then, we loop for each band available on the printer. ;AN000; +; ;AN000; +; IF the current line needs the current printer band (i.e.,if any pixel on ;AN000; +; the line needs this color band in order to achieve its color. ;AN000; +; THEN, we select this color band (we know how to do it from the COLORSELECT ;AN000; +; record in the Shared Data area) ;AN000; +; AND we must read the line again; for each pixel that needs the current ;AN000; +; band a "box" is sent to the printer. ;AN000; +; ;AN000; +; LOGIC : ;AN000; +; CALL INIT_BLACK_BOX ; Initialize a print box ;AN000; +; CALL GET_SCREEN_INFO ;AN000; +; CALL SETUP_PRT ;AN000; +; DO (NB_SCAN_LINES) TIMES ;AN000; +; CALL DET_CUR_SCAN_LNE_LENGTH ;AN000; +; IF CUR_SCAN_LNE_LENGTH NE 0 THEN ;AN000; +; CALL SCAN_FOR_BANDS_APA(CUR_ROW,CUR_COLUMN,REQ_BAND_MASK) ;AN000; +; CUR_BAND_MASK := 01H ;AN000; +; IF REQ_BAND_MASK <> 0 THEN ;AN000; +; DO 8 TIMES ;AN000; +; IF (REQ_BAND_MASK AND CUR_BAND_MASK)=1 THEN ;AN000; +; CALL NEW_PRT_LINE ;AN000; +; CALL PRINT_BAND_APA(CUR_ROW,CUR_COLUMN,CUR_BAND_MASK) ;AN000; +; CALL PRINT_BYTE(CARRIAGE_RETURN) ;AN000; +; ENDIF ;AN000; +; Shift CUR_BAND_MASK one bit left ;AN000; +; ENDDO ;AN000; +; ENDIF ; Should make a print pass for this color band ;AN000; +; CALL PRINT_BYTE(LINE_FEED) ;AN000; +; ENDIF ; Current scan line is not empty ;AN000; +; IF rotated print THEN ;AN000; +; CUR_COLUMN := CUR_COLUMN - BOXES_PER_PRT_BUF ;AN000; +; CUR_ROW := SAVE_START_ROW ;AN000; +; ELSE ;AN000; +; CUR_ROW := CUR_ROW + BOXES_PER_PRT_BUF ;AN000; +; CUR_COLUMN := SAVE_START_COLUMN ;AN000; +; ENDIF ;AN000; +; ENDDO ; Number of Scan lines ;AN000; +; CALL RESTORE_PRT ;AN000; +; ;AN000; +PRINT_COLOR_APA PROC ;AN000; + PUSH AX ;AN000; + PUSH BX ;AN000; + PUSH CX ;AN000; + PUSH DX ;AN000; + ;AN000; + ;AN000; +;-------Initialize print box (A "box" represents one screen pel on the printer) ;AN000; + CALL INIT_BLACK_BOX ;AN000; +;-------------------------------------------------------------------------------;AN000; +; ;AN000; +; Determine where to start reading the screen: ;AN000; +; If printing sideways, start in LOW LEFT corner. ;AN000; +; If normal printing, start in TOP LEFT corner. ;AN000; +; Determine the maximum length for a scan line: ;AN000; +; If printing sideways, it is the height of the screen. ;AN000; +; For normal printing, it is the width of the screen. ;AN000; +; Determine the number of scan lines on the screen. ;AN000; +; ;AN000; +;-------------------------------------------------------------------------------;AN000; + CALL GET_SCREEN_INFO ; Get info. about how to read the screen;AN000; + CALL SETUP_PRT ; Set up the printer (Line spacing, etc);AN000; + .IF ;AN000; + .THEN ; A printer error occurred: quit ;AN000; + JMP PRINT_COLOR_APA_END ; ;AN000; + .ENDIF ;AN000; + ;AN000; + MOV CX,NB_SCAN_LINES ;AN000; +;---------------------------------------------------------------------------- ;AN000; +; ;AN000; +; FOR EACH SCAN LINE ON THE SCREEN (and each print line): ;AN000; +; ;AN000; +;---------------------------------------------------------------------------- ;AN000; +PRINT_SCAN_LINE: ;AN000; + CALL DET_CUR_SCAN_LNE_LENGTH ; Determine length of the scan line ;AN000; + .IF ; If line is not empty ;AN000; + .THEN ;AN000; + CALL SCAN_FOR_BANDS_APA ; REQ_BAND_MASK := Mask for what print;AN000; + ; bands are needed. ;AN000; + MOV DL,01H ; DL := "Current Band to be printed" ;AN000; + MOV BX,DS:[BP].COLORSELECT_PTR; BX := Offset of COLORSELECT record;AN000; + ADD BX,BP ; ("How to select the color band");AN000; + PUSH CX ; Save scan line counter ;AN000; + MOV CX,8 ; For up to the maximum number of prin;AN000; + ; bands with this printer ;AN000; + ;---------------------------------------------------------------------;AN000; + ; ;AN000; + ; FOR each Color Band needed: ;AN000; + ; ;AN000; + ;---------------------------------------------------------------------;AN000; + PRINT_1_COLOR_BAND_APA: ; Only if this color band is needed: ;AN000; + .IF ; Do one pass of the printer head ;AN000; + .THEN ; ;AN000; + CALL SET_COLOR_BAND ; Select the color band on the printer;AN000; + CALL NEW_PRT_LINE ; Send escape sequence to the printer ;AN000; + ; for starting a new graphics line ;AN000; + .IF ;AN000; + .THEN ; A printer error occurred: ;AN000; + POP CX ; Restore the line counter and ;AN000; + JMP PRINT_COLOR_APA_END ; return ;AN000; + .ENDIF ; Endif printer error occurred ;AN000; + ;AN000; + CALL PRINT_BAND_APA ; Do one Print Pass for current band ;AN000; + MOV AL,CR ; Print a carriage return ;AN000; + CALL PRINT_BYTE ;AN000; + .IF C ; If a printer error occurred ;AN000; + .THEN ;AN000; + POP CX ; Restore the line counter and ;AN000; + JMP PRINT_COLOR_APA_END ; return ;AN000; + .ENDIF ; End if printer error occurred ;AN000; + .ENDIF ; End if this color band is needed ;AN000; + SHL DL,1 ; Get next Color Band mask ;AN000; + ; Locate next COLORSELECT record: ;AN000; + MOV AL,[BX].NUM_SELECT_ESC; skip the escape bytes ;AN000; + XOR AH,AH ;AN000; + ADD BX,AX ;AN000; + INC BX ; skip the NUM_SELECT_ESC field ;AN000; + LOOP PRINT_1_COLOR_BAND_APA ;AN000; + POP CX ; Restore scan line counter ;AN000; + .ENDIF ; Scan line length <> 0 ;AN000; +; ;AN000; +;-----Print a line feed: ;AN000; + MOV AL,LF ;AN000; + CALL PRINT_BYTE ;AN000; + JC PRINT_COLOR_APA_END ; If a printer error occurred: quit ;AN000; +; ;AN000; +;-------Get coordinates of next scan line: ;AN000; + .IF ; If printing sideways ;AN000; + .THEN ; then: ;AN000; + MOV AL,NB_BOXES_PER_PRT_BUF; AX := Numbers of pels read on row ;AN000; + CBW ; ;AN000; + ADD CUR_COLUMN,AX ; CUR_COLUMN + Number of pels read ;AN000; + MOV AX,SCREEN_HEIGHT ; CUR_ROW := SCREEN_HEIGHT - 1 ;AN000; + DEC AX ; ;AN000; + MOV CUR_ROW,AX ; ;AN000; + .ELSE ; else, printing NOT rotated: ;AN000; + MOV AL,NB_BOXES_PER_PRT_BUF ; AX := Number of pels read on column ;AN000; + CBW ; ;AN000; + ADD CUR_ROW,AX ; CUR_ROW + Number of pels read ;AN000; + MOV CUR_COLUMN,0 ; CUR_COLUMN := 0 ;AN000; + .ENDIF ; End if printing sideways ;AN000; + LOOP PRINT_SCAN_LINE ; ;AN000; + ;AN000; +;-------------------------------------------------------------------------------;AN000; +; ;AN000; +; Restore the printer (send a Page Eject, etc.) ;AN000; +; ;AN000; +;-------------------------------------------------------------------------------;AN000; + CALL RESTORE_PRT ;AN000; +PRINT_COLOR_APA_END: ;AN000; + POP DX ;AN000; + POP CX ;AN000; + POP BX ;AN000; + POP AX ;AN000; + RET ;AN000; +PRINT_COLOR_APA ENDP ;AN000; +PAGE ;AN000; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AN000; +;; ;AN000; +;; ;AN000; +;; SCAN_FOR_BANDS_APA : DETERMINE WHAT PRINT BANDS ARE NEEDED FOR THE CURRENT ;AN000; +;; PRINT PASS. ;AN000; +;; ;AN000; +;;------------------------------------------------------------------------------;AN000; +; ;AN000; +; INPUT: CUR_ROW : row to start scanning (word) ;AN000; +; CUR_COLUMN : column to start scanning (word) ;AN000; +; CUR_SCAN_LNE_LENGTH : length of the current scan line (word) ;AN000; +; ROTATE_SW = ON if printing is sideways ;AN000; +; ;AN000; +; OUTPUT: REQ_BAND_MASK : band mask for required bands (byte) ;AN000; +; ;AN000; +;;------------------------------------------------------------------------------;AN000; +;; ;AN000; +;; Data Structures Referenced: ;AN000; +;; Shared Data Area ;AN000; +;; Print Info ;AN000; +;; Color Translate Table ;AN000; +;; ;AN000; +;; ;AN000; +;; Description: ;AN000; +;; Read all the dots required for one print line to determine ;AN000; +;; the print bands required. The print line corresponds to several ;AN000; +;; screen rows (or columns if rotated printing). The number of ;AN000; +;; rows / columns per print line is stored in NB_BOXES_PER_PRT_BUF. ;AN000; +;; The band information is obtained from the Color Translate Table. ;AN000; +;; ;AN000; +;; Called By: ;AN000; +;; PRINT_COLOR_APA ;AN000; +;; ;AN000; +;; External Calls: ;AN000; +;; READ_DOT, BIOS INT 10H ;AN000; +;; ;AN000; +;; Logic: ;AN000; +;; Save initial coordinates ;AN000; +;; SAVE_START_COLUMN := CUR_COLUMN ;AN000; +;; REQ_BAND_MASK := 00H ;AN000; +;; DO (SCAN_LINE_LENGTH) TIMES ;AN000; +;; Save coordinates of the "column" ;AN000; +;; DO (BOXES_PER_PRT_BUF) TIMES ;AN000; +;; CALL READ_DOT(IN CUR_ROW,CUR_COLUMN; OUT COLOR_NUM) ;AN000; +;; REQ_BAND_MASK := REQ_BAND_MASK OR COLOR_XLAT_TAB[BX] ;AN000; +;; IF rotated print THEN ;AN000; +;; Increment CUR_COLUMN ;AN000; +;; ELSE ;AN000; +;; Increment CUR_ROW ;AN000; +;; ENDIF ;AN000; +;; Restore coordinates of the "column" ;AN000; +;; ENDDO ;AN000; +;; IF rotated print THEN ;AN000; +;; Decrement CUR_ROW ;AN000; +;; ELSE ;AN000; +;; Increment CUR_COLUMN ;AN000; +;; ENDIF ;AN000; +;; ENDDO ;AN000; +;; Restore initial coordinates ;AN000; +;; RETURN ;AN000; +;; ;AN000; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;AN000; +SCAN_FOR_BANDS_APA PROC NEAR ;AN000; + PUSH CUR_ROW ;AN000; + PUSH CUR_COLUMN ;AN000; + PUSH AX ;AN000; + PUSH BX ;AN000; + PUSH CX ;AN000; + ;AN000; + MOV REQ_BAND_MASK,0 ; No Color bands needed so far... ;AN000; + MOV BX,OFFSET XLT_TAB ; BX := Offset of translation table ;AN000; + MOV CX,CUR_SCAN_LNE_LENGTH ;AN000; +;===============================================================================;AN000; +; ;AN000; +; FOR each column on the current scan line (up to the last non=blank): ;AN000; +; ;AN000; +;===============================================================================;AN000; +SCAN_1_COLUMN: ;AN000; + PUSH CX ; Save column counter ;AN000; + PUSH CUR_ROW ; Save coordinates of the "column" ;AN000; + PUSH CUR_COLUMN ;AN000; +;-------------------------------------------------------------------------------;AN000; +; ;AN000; +; For each pixel within the current column of the scan line: ;AN000; +; ;AN000; +;-------------------------------------------------------------------------------;AN000; + XOR CX,CX ; CX := Number of pixels to read ;AN000; + MOV CL,NB_BOXES_PER_PRT_BUF ; within the current "column" ;AN000; +SCAN_1_PIXEL: ;AN000; + CALL READ_DOT ; AL := Index into translation table ;AN000; + XLAT XLT_TAB ; AL := Band mask ;AN000; + OR REQ_BAND_MASK,AL ; Add bands required for this pixel ;AN000; + ;AN000; +;-------Get coordinates of next pixel: ;AN000; + .IF ; If printing sideways ;AN000; + .THEN ; ;AN000; + INC CUR_COLUMN ; then, increment column number ;AN000; + .ELSE ; ;AN000; + INC CUR_ROW ; else, increment row number ;AN000; + .ENDIF ; ;AN000; + LOOP SCAN_1_PIXEL ;AN000; + POP CUR_COLUMN ; Restore coordinates of the "column" ;AN000; + POP CUR_ROW ; ;AN000; + POP CX ; Restore column counter ;AN000; + ;AN000; + ;AN000; +;-------Get coordinates of next "column": ;AN000; + .IF ; If printing sideways ;AN000; + .THEN ; ;AN000; + DEC CUR_ROW ; then, get row above on screen ;AN000; + .ELSE ; ;AN000; + INC CUR_COLUMN ; else, get column next right ;AN000; + .ENDIF ; ;AN000; + LOOP SCAN_1_COLUMN ;AN000; + ;AN000; + POP CX ;AN000; + POP BX ;AN000; + POP AX ;AN000; + POP CUR_COLUMN ;AN000; + POP CUR_ROW ;AN000; + RET ;AN000; +SCAN_FOR_BANDS_APA ENDP ;AN000; +PAGE ;AN000; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AN000; +;; ;AN000; +;; PRINT_BAND_APA : PRINT ALL DOTS ON CURRENT LINE THAT NEED THE CURRENT BAND ;AN000; +;; TO APPROXIMATE THEIR COLOR. ;AN000; +;; ;AN000; +;-------------------------------------------------------------------------------;AN000; +; ;AN000; +; INPUT: CUR_ROW, ;AN000; +; CUR_COLUMN : Coordinates of the first pixel to be read in the ;AN000; +; current scan line. ;AN000; +; DL : Band mask indicating what print band to use ;AN000; +; for this print pass. ;AN000; +; CUR_SCAN_LNE_LENGTH: Length of the current scan line. ;AN000; +; ROTATE_SW = ON if printing is sideways ;AN000; +; ;AN000; +; OUTPUT: PRINTER ;AN000; +; ;AN000; +;-------------------------------------------------------------------------------;AN000; +;; ;AN000; +;; Data Structures Referenced: ;AN000; +;; Shared Data Area ;AN000; +;; Print Info ;AN000; +;; Color Translate Table ;AN000; +;; ;AN000; +;; Description: ;AN000; +;; Print all dots on this print line which need the current ;AN000; +;; band. The print line corresponds to several ;AN000; +;; screen rows (or columns if rotated printing). The number of ;AN000; +;; rows / columns per print line is stored in NB_BOXES_PER_PRT_BUF. ;AN000; +;; The band information is obtained from the Color Translate Table. ;AN000; +;; ;AN000; +;; Called By: ;AN000; +;; PRINT_COLOR_APA ;AN000; +;; ;AN000; +;; External Calls: ;AN000; +;; READ_DOT, BIOS INT 10H, STORE_BOX, PRT_BUFFER, PRINT_BYTE ;AN000; +;; ;AN000; +;; Logic: ;AN000; +;; SAVE_START_ROW := CUR_ROW ;AN000; +;; SAVE_START_COLUMN := CUR_COLUMN ;AN000; +;; ;AN000; +;; CALL SET_COLOR_BAND ; Select the color for this print pass ;AN000; +;; DO (SCAN_LINE_LENGTH) TIMES ;AN000; +;; Save coordinates of the "column" ;AN000; +;; Clear the print buffer ;AN000; +;; DO (BOXES_PER_PRT_BUF) TIMES ;AN000; +;; CALL READ_DOT(CUR_ROW,CUR_COLUMN,COLOR_NUM) ;AN000; +;; IF (CUR_BAND_MASK AND XLAT_TAB[COLOR_NUM])=1 THEN ;AN000; +;; CALL STORE_BOX(black box) ;AN000; +;; ELSE ;AN000; +;; CALL STORE_BOX(white box) ;AN000; +;; ENDIF ;AN000; +;; IF rotated print THEN ;AN000; +;; Decrement CUR_COLUMN ;AN000; +;; ELSE ;AN000; +;; Increment CUR_ROW ;AN000; +;; ENDIF ;AN000; +;; ENDDO ;AN000; +;; CALL PRINT_BUFFER ;AN000; +;; Restore coordinates of the "column" ;AN000; +;; ; Get coordinates of the next "column"; ;AN000; +;; IF rotated print THEN ;AN000; +;; Decrement CUR_ROW ;AN000; +;; CUR_COLUMN := SAVE_START_COLUMN ;AN000; +;; ELSE ;AN000; +;; Increment CUR_COLUMN ;AN000; +;; CUR_ROW := SAVE_START_ROW ;AN000; +;; ENDIF ;AN000; +;; ENDDO ;AN000; +;; RETURN ;AN000; +;; ;AN000; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AN000; +PRINT_BAND_APA PROC NEAR ;AN000; + PUSH CUR_ROW ; Save coordinates ;AN000; + PUSH CUR_COLUMN ;AN000; + PUSH AX ;AN000; + PUSH BX ;AN000; + PUSH CX ;AN000; + PUSH SI ;AN000; + PUSH DI ;AN000; + ;AN000; + MOV BX,OFFSET XLT_TAB ; BX := Offset of translation table ;AN000; + MOV CX,CUR_SCAN_LNE_LENGTH ;AN000; +;===============================================================================;AN000; +; ;AN000; +; FOR each column on the current scan line (up to the last non=blank): ;AN000; +; (One "column" contains the number of pixels required to fill the Print buffer);AN000; +; ;AN000; +;===============================================================================;AN000; +PRINT_1_COLUMN: ;AN000; +;-------------------------------------------------------------------------------;AN000; +; ;AN000; +; Clear the print buffer "PRT_BUF" ;AN000; +; ;AN000; +;-------------------------------------------------------------------------------;AN000; + XOR DI,DI ; DI := Number of bytes cleared in the buffer ;AN000; + XOR AX,AX ;AN000; + MOV AL,BOX_W ; AX := Number of bytes in the print buffer ;AN000; +CLEAR_BUF: ; For each byte in the PRT_BUF: ;AN000; + MOV PRT_BUF[DI],0 ; Initialize byte to blanks ;AN000; + INC DI ; One more has been cleared ;AN000; + CMP DI,AX ; All bytes cleared ? ;AN000; + JL CLEAR_BUF ; No, clear next one. ;AN000; + ;AN000; +;-------------------------------------------------------------------------------;AN000; +; ;AN000; +; Fill up the print buffer "PRT_BUF" ;AN000; +; ;AN000; +;-------------------------------------------------------------------------------;AN000; + PUSH CX ; Save column counter ;AN000; + XOR CX,CX ; CX := Number of pixels to read ;AN000; + MOV CL,NB_BOXES_PER_PRT_BUF ; within the current "column" ;AN000; + ; of the scan line ;AN000; + PUSH CUR_ROW ; Save coordinates of the "column" ;AN000; + PUSH CUR_COLUMN ;AN000; +; ;AN000; +; For each pixel within the current column of the scan line: ;AN000; +STORE_1_PIXEL: ;AN000; + CALL READ_DOT ; AL := Index into translation table ;AN000; + XLAT XLT_TAB ; AL := Band mask ;AN000; + .IF ; If color of the current pixel needs ;AN000; + .THEN ; the current printer band ;AN000; + MOV SI,OFFSET BLACK_BOX ; then, store a box in the ;AN000; + CALL STORE_BOX ; PRT_BUF ;AN000; + .ELSE ; ;AN000; + MOV SI,OFFSET WHITE_BOX ; else, store an empty box ;AN000; + CALL STORE_BOX ; in the PRT_BUF ;AN000; + .ENDIF ;AN000; +; ;AN000; +;-------Get coordinates of next pixel: ;AN000; + .IF ; If printing sideways ;AN000; + .THEN ; ;AN000; + INC CUR_COLUMN ; then, increment column number ;AN000; + .ELSE ; ;AN000; + INC CUR_ROW ; else, increment row number ;AN000; + .ENDIF ; ;AN000; + LOOP STORE_1_PIXEL ;AN000; + ;AN000; + POP CUR_COLUMN ; Restore coordinates of the "column" ;AN000; + POP CUR_ROW ; ;AN000; + POP CX ; Restore column counter ;AN000; +;-------------------------------------------------------------------------------;AN000; +; ;AN000; +; Print the PRT_BUF: ;AN000; +; ;AN000; +;-------------------------------------------------------------------------------;AN000; + CALL PRINT_BUFFER ;AN000; + .IF ;AN000; + .THEN ; A printer error occurred: QUIT ;AN000; + JMP SHORT PRINT_BAND_APA_END ; ;AN000; + .ENDIF ;AN000; + ;AN000; +;-------------------------------------------------------------------------------;AN000; +; ;AN000; +; Get coordinates of next "column": ;AN000; +; ;AN000; +;-------------------------------------------------------------------------------;AN000; + .IF ; If printing sideways ;AN000; + .THEN ; ;AN000; + DEC CUR_ROW ; then, get row above on screen ;AN000; + .ELSE ; ;AN000; + INC CUR_COLUMN ; else, get column next right ;AN000; + .ENDIF ; ;AN000; + LOOP PRINT_1_COLUMN ;AN000; + ;AN000; +PRINT_BAND_APA_END: ;AN000; + POP DI ;AN000; + POP SI ;AN000; + POP CX ;AN000; + POP BX ;AN000; + POP AX ;AN000; + POP CUR_COLUMN ; Restore initial coordinates ;AN000; + POP CUR_ROW ;AN000; + RET ;AN000; +PRINT_BAND_APA ENDP ;AN000; +PAGE ;AN000; +;===============================================================================;AN000; +; ;AN000; +; SET_CURSOR : SET THE CURSOR TO CUR_ROW, CUR_COLUMN AND CUR_PAGE ;AN000; +; ;AN000; +;-------------------------------------------------------------------------------;AN000; +; ;AN000; +; INPUT: CUR_ROW, ;AN000; +; CUR_COLUMN = Coordinates for the cursor (word) ;AN000; +; CUR_PAGE = Page for which to set the cursor (byte) ;AN000; +; ;AN000; +; OUTPUT: SCREEN ;AN000; +; ;AN000; +;-------------------------------------------------------------------------------;AN000; +SET_CURSOR PROC NEAR ;AN000; + PUSH AX ;AN000; + PUSH BX ;AN000; + PUSH DX ;AN000; + MOV DH,BYTE PTR CUR_ROW ;AN000; + MOV DL,BYTE PTR CUR_COLUMN ;AN000; + MOV BH,CUR_PAGE ;AN000; + MOV AH,SET_CURSOR_CALL ; Set cursor request ;AN000; + INT 10H ; Call BIOS ;AN000; + POP DX ;AN000; + POP BX ;AN000; + POP AX ;AN000; + RET ;AN000; +SET_CURSOR ENDP ;AN000; +PAGE ;AN000; +;===============================================================================;AN000; +; ;AN000; +; SET_COLOR_BAND : SET THE PRINTER TO THE CURRENT COLOR BAND ;AN000; +; ;AN000; +;-------------------------------------------------------------------------------;AN000; +; ;AN000; +; INPUT: BX = Offset of current COLORSELECT record in the ;AN000; +; Shared data area. ;AN000; +; DS:[BP] = Offset of shared data area ;AN000; +; ;AN000; +; OUTPUT: PRINTER ;AN000; +; ;AN000; +;-------------------------------------------------------------------------------;AN000; +SET_COLOR_BAND PROC NEAR ;AN000; + PUSH AX ;AN000; + PUSH BX ;AN000; + PUSH CX ;AN000; + ;AN000; +;-------Send the escape sequence for selecting this color band to the printer: ;AN000; + XOR CX,CX ;AN000; + MOV CL,[BX].NUM_SELECT_ESC ; CX := Number of bytes to send ;AN000; + ADD BX,OFFSET SELECT_ESC ; BX := Offset of bytes to send ;AN000; +SEND_1_COLORSELECT_BYTE: ;AN000; + MOV AL,[BX] ; AL := Byte to send to printer ;AN000; + CALL PRINT_BYTE ; Send it ;AN000; + JC SET_COLOR_BAND_END ; If printer error: return ;AN000; + INC BX ; Get next byte ;AN000; + LOOP SEND_1_COLORSELECT_BYTE ;AN000; + ;AN000; +SET_COLOR_BAND_END: ;AN000; + POP CX ;AN000; + POP BX ;AN000; + POP AX ;AN000; + RET ;AN000; +SET_COLOR_BAND ENDP ;AN000; +PAGE ;AN000; +;===============================================================================;AN000; +; ;AN000; +; INIT_BLACK_BOX: INIT. THE BOX FOR PRINTING APA MODE DOTS ON A COLOR PRINTER. ;AN000; +; ;AN000; +;-------------------------------------------------------------------------------;AN000; +; ;AN000; +; INPUT: BOX_W, ;AN000; +; BOX_H = Size of the print box for one pixel. ;AN000; +; ;AN000; +; OUTPUT: BLACK_BOX = A box for which all dots are on. ;AN000; +; ;AN000; +;-------------------------------------------------------------------------------;AN000; +; ;AN000; +; DESCRIPTION: Initialize the print box used to print a screen pixel. ;AN000; +; ;AN000; +; For example, ;AN000; +; with a size of 3x2 the BLACK_BOX will use 3 bytes: ;AN000; +; ;AN000; +; ;AN000; +; byte1 byte2 byte3 ;AN000; +; (column1) (column2) (column3) ;AN000; +; bit 7 -->0 0 0 ;AN000; +; 0 0 0 ;AN000; +; 0 0 0 ;AN000; +; 0 0 0 ;AN000; +; 0 0 0 ;AN000; +; 0 0 0 ;AN000; +; 1 1 1 ;AN000; +; bit 0 -->1 1 1 ;AN000; +; ;AN000; +;-------------------------------------------------------------------------------;AN000; +INIT_BLACK_BOX PROC NEAR ;AN000; + PUSH AX ;AN000; + PUSH BX ;AN000; + PUSH CX ;AN000; + ;AN000; +;-------Build one box column: ;AN000; + XOR CX,CX ;AN000; + MOV CL,BOX_H ; CX := Height in bits of the print box ;AN000; + XOR AL,AL ; AX := Bit mask for creating box column ;AN000; + .REPEAT ; For height of the box: ;AN000; + SHL AL,1 ; ;AN000; + OR AL,1 ; Insert one bit in the box column ;AN000; + .LOOP ;AN000; + ;AN000; +;-------------------------------------------------------------------------------;AN000; +; ;AN000; +; AL now contains one box column. ;AN000; +; ;AN000; +;-------------------------------------------------------------------------------;AN000; + ;AN000; +;-------Replicate this column over all columns of the box. ;AN000; + XOR BX,BX ; BX := Index into the BOX ;AN000; +INIT_1_BLACK_COLUMN: ;AN000; + MOV BLACK_BOX[BX],AL; Init current column to black box column ;AN000; + INC BX ; Get next column ;AN000; + CMP BL,BOX_W ;AN000; + JL INIT_1_BLACK_COLUMN ;AN000; + ;AN000; + POP CX ;AN000; + POP BX ;AN000; + POP AX ;AN000; + RET ;AN000; +INIT_BLACK_BOX ENDP ;AN000; +INCLUDE GRCOMMON.ASM ;AN000; +LEN_OF_COLOR_MODULES EQU $-PRINT_COLOR ;AN000; +CODE ENDS ;AN000; + END ;AN000; diff --git a/v4.0/src/CMD/GRAPHICS/GRCOLPRT.EXT b/v4.0/src/CMD/GRAPHICS/GRCOLPRT.EXT new file mode 100644 index 0000000..5e07eaa --- /dev/null +++ b/v4.0/src/CMD/GRAPHICS/GRCOLPRT.EXT @@ -0,0 +1,25 @@ +.XLIST +PAGE ,132 ;AN000; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;AN000; +;; DOS - GRAPHICS Command +;; (C) Copyright 1988 Microsoft +;; ;AN000; +;; File Name: GRCOLPRT.EXT ;AN000; +;; ---------- ;AN000; +;; ;AN000; +;; Description: ;AN000; +;; ------------ ;AN000; +;; Include file containing external declarations for ;AN000; +;; the code and data defined in GRCOLPRT.ASM ;AN000; +;; ;AN000; +;; Change History: ;AN000; +;; --------------- ;AN000; +;; ;AN000; +;; ;AN000; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;AN000; + ;; ;AN000; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;AN000; +.LIST ;AN000; + EXTRN PRINT_MODULE_START:NEAR ;; ;AN000; + EXTRN PRINT_COLOR:NEAR ;AN000; + EXTRN LEN_OF_COLOR_MODULES:ABS ;; ;AN000; diff --git a/v4.0/src/CMD/GRAPHICS/GRCOMMON.ASM b/v4.0/src/CMD/GRAPHICS/GRCOMMON.ASM new file mode 100644 index 0000000..56d1b08 --- /dev/null +++ b/v4.0/src/CMD/GRAPHICS/GRCOMMON.ASM @@ -0,0 +1,858 @@ + PAGE ,132 ;AN000; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;AN000; +;; DOS - GRAPHICS Command +;; (c) Copyright 1988 Microsoft +;; ;AN000; +;; File Name: GRCOMMON.ASM ;AN000; +;; ---------- ;AN000; +;; ;AN000; +;; Description: ;AN000; +;; ------------ ;AN000; +;; ;AN000; +;; This file contains the modules common to the Print Screen ;AN000; +;; process of GRAPHICS.COM. ;AN000; +;; This file is included by both set of Print modules. ;AN000; +;; ;AN000; +;; This file MUST BE COMPILED WITH EACH SET OF MODULES since, ;AN000; +;; one set is relocated in memory at installation time; all ;AN000; +;; references to the common procedures must be resolved from ;AN000; +;; within each set of print modules. ;AN000; +;; ;AN000; +;; The set of common modules is relocated in memory along with ;AN000; +;; the selected set of print modules. ;AN000; +;; ;AN000; +;; Documentation Reference: ;AN000; +;; ------------------------ ;AN000; +;; OASIS High Level Design ;AN000; +;; OASIS GRAPHICS I1 Overview ;AN000; +;; ;AN000; +;; Procedures Contained in This File: ;AN000; +;; ---------------------------------- ;AN000; +;; READ_DOT ;AN000; +;; LOC_MODE_PRT_INFO ;AN000; +;; STORE_BOX ;AN000; +;; PRINT_BUFFER ;AN000; +;; GET_SCREEN_INFO ;AN000; +;; SETUP_PRT ;AN000; +;; RESTORE_PRT ;AN000; +;; NEW_PRT_LINE ;AN000; +;; PRINT_BYTE ;AN000; +;; DET_CUR_SCAN_LNE_LENGTH ;AN000; +;; ;AN000; +;; Include Files Required: ;AN000; +;; ----------------------- ;AN000; +;; none ;AN000; +;; ;AN000; +;; External Procedure References: ;AN000; +;; ------------------------------ ;AN000; +;; FROM FILE GRCTRL.ASM: ;AN000; +;; PRT_SCR - Main module for printing the screen. ;AN000; +;; FROM FILE GRBWPRT.ASM: ;AN000; +;; PRT_BW_APA - Main module for printing on BW printer. ;AN000; +;; FROM FILE GRCOLPRT.ASM: ;AN000; +;; PRINT_COLOR - Main module for printing on COLOR printer. ;AN000; +;; ;AN000; +;; Linkage Instructions: ;AN000; +;; -------------------- ;AN000; +;; ;AN000; +;; This file is included by both GRBWPRT.ASM and GRCOLPRT.ASM and is ;AN000; +;; compiled with each of them. However, only one copy is made resident. ;AN000; +;; ;AN000; +;; Change History: ;AN000; +;; --------------- ;AN000; +;; ;AN000; +;; ;AN000; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;AN000; + ;AN000; +PAGE ;AN000; +;===============================================================================;AN000; +; ;AN000; +; LOC_MODE_PRT_INFO: LOCATE DISPLAYMODE PRINTER INFO. FOR THE CURRENT ;AN000; +; MODE ;AN000; +; ;AN000; +;-------------------------------------------------------------------------------;AN000; +; ;AN000; +; INPUT: BP = Offset of the shared data area ;AN000; +; CUR_MODE = Current video mode ;AN000; +; ;AN000; +; OUTPUT: CUR_MODE_PTR = Absolute Offset of the ;AN000; +; current DISPLAYMODE INFO record. ;AN000; +; ;AN000; +; ERROR_CODE = DISPLAYMODE_INFO_NOT_FOUND if not found. ;AN000; +; ;AN000; +; CALLED BY: PRINT_COLOR ;AN000; +; PRINT_BW_APA ;AN000; +; ;AN000; +; ;AN000; +;-------------------------------------------------------------------------------;AN000; +; ;AN000; +; DESCRIPTION: DISPLAYMODE_PTR is pointing to the first DISPLAYMODE ;AN000; +; INFO record within the Shared Data Area. ;AN000; +; ;AN000; +; This (chained) list of DISPLAYMODE records is scanned until the record ;AN000; +; for the current mode is found. ;AN000; +; ;AN000; +; Note: All pointers in the DISPLAYMODE records are relative to the beginning ;AN000; +; of the shared data area. Therefore, we must add the offset of the ;AN000; +; shared data area (in BP) in order to access the data these pointers ;AN000; +; are referencing. ;AN000; +; ;AN000; +; The CUR_MODE_PTR is relative to the segment and references the ;AN000; +; DISPLAYMODE record for the video mode currently set at print screen ;AN000; +; time. ;AN000; +; ;AN000; +; LOGIC: ;AN000; +; ;AN000; +; FOUND := FALSE ;AN000; +; DO UNTIL FOUND OR END_OF_LIST ;AN000; +; Get a display mode information record ;AN000; +; IF record.DISP_MODE = CUR_MODE ;AN000; +; THEN FOUND := TRUE ;AN000; +; ELSE ;AN000; +; CUR_MODE_PTR := record.NEXT_DISP_MODE ;AN000; +; ;AN000; +; ;AN000; + ;AN000; +LOC_MODE_PRT_INFO PROC NEAR ;AN000; + PUSH BX ;AN000; + PUSH CX ;AN000; + PUSH DX ;AN000; + PUSH SI ;AN000; + ;AN000; + MOV BX,DS:[BP].DISPLAYMODE_PTR ; [BX] := Current DISPLAYMODE ;AN000; + ADD BX,BP ; record ;AN000; + MOV DL,CUR_MODE ; DL := Current mode ;AN000; + ;AN000; +SCAN_1_DISPLAYMODE_RECORD: ;AN000; + MOV SI,[BX].DISP_MODE_LIST_PTR ; [SI] : First mode covered ;AN000; + ADD SI,BP ; by this DISPLAYMODE record ;AN000; + MOV CL,[BX].NUM_DISP_MODE ; Scan each mode in the list ;AN000; + XOR CH,CH ;AN000; +SCAN_LIST_OF_MODES: ;AN000; + CMP CS:[SI],DL ; FOUND ? ;AN000; + JE FOUND ;AN000; + INC SI ; NO, get next mode in ;AN000; + LOOP SCAN_LIST_OF_MODES ; DISPLAYMODE record ;AN000; + ;AN000; + CMP [BX].NEXT_DISP_MODE,-1 ; END OF DISPLAYMODE LIST ? ;AN000; + JE NOT_FOUND ; Yes, this mode not supported ;AN000; +NEXT_RECORD: ; No, ;AN000; + MOV BX,[BX].NEXT_DISP_MODE ; [BX] := Next record ;AN000; + ADD BX,BP ; ;AN000; + JMP SHORT SCAN_1_DISPLAYMODE_RECORD ;AN000; + ;AN000; +FOUND: ; Found: ;AN000; + MOV CUR_MODE_PTR,BX ; Update pointer to current ;AN000; + JMP SHORT LOC_MODE_PRT_INFO_END ; DISPLAYMODE record. ;AN000; + ;AN000; +NOT_FOUND: ; Not found: ;AN000; + MOV ERROR_CODE,DISPLAYMODE_INFO_NOT_FOUND ; Return error condition ;AN000; + ;AN000; +LOC_MODE_PRT_INFO_END: ;AN000; + POP SI ;AN000; + POP DX ;AN000; + POP CX ;AN000; + POP BX ;AN000; + RET ;AN000; +LOC_MODE_PRT_INFO ENDP ;AN000; +PAGE ;AN000; +;===============================================================================;AN000; +; ;AN000; +; STORE_BOX : STORE ONE BOX IN THE PRINT BUFFER. ;AN000; +; ;AN000; +;-------------------------------------------------------------------------------;AN000; +; ;AN000; +; INPUT: SI = OFFSET OF THE BOX TO BE PRINTED ;AN000; +; BOX_W = BOX WIDTH IN BITS ;AN000; +; BOX_H = BOX HEIGHT IN BITS ;AN000; +; ;AN000; +; OUTPUT: PRT_BUF = THE PRINT BUFFER ;AN000; +; ;AN000; +;-------------------------------------------------------------------------------;AN000; +; ;AN000; +; DESCRIPTION: The print buffer is first shifted left in order to make ;AN000; +; room for the new box (Note: the MSB's are lost; they are assumed to ;AN000; +; have been printed), then the box is inserted in the low-order bits of ;AN000; +; the printer buffer. ;AN000; +; ;AN000; +PAGE ;AN000; +; EXAMPLE ;AN000; +; ------- ;AN000; +; BEFORE: AFTER: ;AN000; +; ;AN000; +; BOX: 0 0 0 ;AN000; +; 0 0 0 ;AN000; +; 0 0 0 ;AN000; +; 0 0 0 ;AN000; +; 0 0 0 ;AN000; +; 0 0 0 ;AN000; +; b1 b2 b3 ;AN000; +; b4 b5 b6 ;AN000; +; ;AN000; +; PRT_BUF: byte1 byte2 byte3 PRT_BUF: byte1 byte2 byte3 ;AN000; +; 0 1 0 1 1 1 ;AN000; +; 1 0 1 1 1 1 ;AN000; +; 1 1 1 1 1 1 ;AN000; +; 1 1 1 1 1 1 ;AN000; +; 1 1 1 1 1 1 ;AN000; +; 1 1 1 1 1 1 ;AN000; +; 1 1 1 b1 b2 b3 ;AN000; +; LSB --> 1 1 1 b4 b5 b6 ;AN000; +; ;AN000; +; ;AN000; +; LOGIC: ;AN000; +; ;AN000; +; FOR each byte of the buffer (BOX_W) ;AN000; +; BEGIN ;AN000; +; Make room for the box to be inserted ;AN000; +; Insert the box ;AN000; +; END ;AN000; +; ;AN000; +STORE_BOX PROC NEAR ;AN000; + PUSH BX ;AN000; + PUSH CX ;AN000; + PUSH DI ;AN000; + ;AN000; + MOV DI,OFFSET PRT_BUF ; DI := Offset of the Print buffer ;AN000; + XOR BX,BX ; BX := Byte index number ;AN000; + ;AN000; + MOV CL,BOX_H ; CL := Number of BITS to be shifted ;AN000; +; FOR each column (byte) of the box to be stored in the buffer: ;AN000; +STORE_1_BYTE: ;AN000; + SHL BYTE PTR [BX][DI],CL ; Make room for the bits to be inserted ;AN000; + MOV CH,[BX][SI] ; CH := column of the box to be inserted;AN000; + OR [BX][DI],CH ; Insert the box column in the buffer ;AN000; + INC BL ; Get next column (byte) of the box ;AN000; + CMP BL,BOX_W ; All columns (bytes) of box stored ? ;AN000; + JL STORE_1_BYTE ; No, store next one. ;AN000; + ;AN000; +STORE_BOX_END: ;AN000; + POP DI ;AN000; + POP CX ;AN000; + POP BX ;AN000; + RET ;AN000; +STORE_BOX ENDP ;AN000; +PAGE ;AN000; +;===============================================================================;AN000; +; ;AN000; +; PRINT_BUFFER : PRINT THE BUFFER ;AN000; +; ;AN000; +;-------------------------------------------------------------------------------;AN000; +; ;AN000; +; INPUT: PRT_BUF = BYTES TO BE PRINTED ;AN000; +; BOW_W = BOX WIDTH ;AN000; +; ;AN000; +; OUTPUT: PRINTER ;AN000; +; ;AN000; +;-------------------------------------------------------------------------------;AN000; +; ;AN000; +; DESCRIPTION: Prints BOX_W bytes. ;AN000; +; ;AN000; +; LOGIC: ;AN000; +; ;AN000; +; DO for each column in one pattern ;AN000; +; BEGIN ;AN000; +; Print one byte from the buffer ;AN000; +; END ;AN000; +; ;AN000; +PRINT_BUFFER PROC NEAR ;AN000; + PUSH AX ;AN000; + PUSH BX ;AN000; + PUSH CX ;AN000; + ;AN000; + MOV BX,OFFSET PRT_BUF ;AN000; + XOR CX,CX ;AN000; + MOV CL,BOX_W ;AN000; +PRINT_1_BUF_COLUMN: ;AN000; + MOV AL,[BX] ; Print one byte ;AN000; + CALL PRINT_BYTE ;AN000; + JC PRINT_BUFFER_END; If printer error, quit the loop ;AN000; + INC BX ; Get next byte ;AN000; + LOOP PRINT_1_BUF_COLUMN ;AN000; +PRINT_BUFFER_END: ;AN000; + POP CX ;AN000; + POP BX ;AN000; + POP AX ;AN000; + RET ;AN000; +PRINT_BUFFER ENDP ;AN000; +PAGE ;AN000; +;===============================================================================;AN000; +; ;AN000; +; GET_SCREEN_INFO : GET INFORMATION ABOUT HOW TO READ THE SCREEN. ;AN000; +; ;AN000; +;-------------------------------------------------------------------------------;AN000; +; ;AN000; +; INPUT: SCREEN_HEIGHT = Number of pixel rows on the screen ;AN000; +; SCREEN_WIDTH = Number of pixel columns on screen ;AN000; +; CUR_MODE_PTR = Offset of the current DISPLAYMODE info rec. ;AN000; +; ;AN000; +; OUTPUT: PRINTER ;AN000; +; SCAN_LINE_MAX_LENGTH = Maximum length of Screen scan line. ;AN000; +; NB_SCAN_LINES = Number of SCAN LINES on the screen ;AN000; +; CUR_ROW,CUR_COLUMN = Coordinates of the first pixel to be ;AN000; +; read on the screen ;AN000; +; NB_BOXES_PER_PRT_BUF = Number of boxes fitting in the Print ;AN000; +; buffer ;AN000; +; ;AN000; +; CALLED BY: PRINT_COLOR ;AN000; +; PRT_BW_APA ;AN000; +; ;AN000; +;-------------------------------------------------------------------------------;AN000; +; ;AN000; +; DESCRIPTION: ;AN000; +; ;AN000; +; 1) Determine where to start reading the screen. ;AN000; +; For non-rotated printing, it should start with the top-left ;AN000; +; corner pixel. ;AN000; +; For rotated printing, it should start with the low-left corner ;AN000; +; pixel. ;AN000; +; ;AN000; +; 2) Determine the length of a scan line. ;AN000; +; For non-rotated printing, it is the WIDTH of the screen. ;AN000; +; For rotated printing, it is the HEIGHT of the screen. ;AN000; +; ;AN000; +; 3) Determine the number of scan lines on the screen. ;AN000; +; For non-rotated printing, it is the HEIGHT of the screen divided ;AN000; +; by the number of boxes fitting in the print buffer. ;AN000; +; For rotated printing, it is the WIDTH of the screen divided by ;AN000; +; the number of boxes fitting in the print buffer. ;AN000; +; ;AN000; +; LOGIC: ;AN000; +; ;AN000; +; CUR_COLUMN := 0 ;AN000; +; IF printing is sideways ;AN000; +; THEN ;AN000; +; CUR_ROW := SCREEN_HEIGHT - 1 ; Low-left pixel ;AN000; +; SCAN_LINE_MAX_LENGTH := SCREEN_HEIGHT ;AN000; +; NB_SCAN_LINES := SCREEN_WIDTH / NB_BOXES_PER_PRT_BUF ;AN000; +; ELSE ;AN000; +; CUR_ROW := 0 ; Top-left pixel ;AN000; +; SCAN_LINE_MAX_LENGTH := SCREEN_WIDTH ;AN000; +; NB_SCAN_LINES := SCREEN_HEIGHT / NB_BOXES_PER_PRT_BUF ;AN000; +; ;AN000; +; ;AN000; +GET_SCREEN_INFO PROC NEAR ;AN000; + PUSH AX ;AN000; + PUSH BX ; Used for DIV ;AN000; + PUSH DX ; Used for DIV ;AN000; + ;AN000; + MOV BX,CUR_MODE_PTR ; BX := Offset DISPLAYMODE info record ;AN000; +;-------------------------------------------------------------------------------;AN000; +; ;AN000; +; Calculate how many printer boxes fit in the print buffer: ;AN000; +; ;AN000; +;-------------------------------------------------------------------------------;AN000; + MOV AX,8 ; Num := 8 bits / Box heigth ;AN000; + MOV DL,[BX].BOX_HEIGHT ;AN000; + DIV DL ;AN000; + MOV NB_BOXES_PER_PRT_BUF,AL ;AN000; +;-------------------------------------------------------------------------------;AN000; +; ;AN000; +; Determine where to start reading the screen: ;AN000; +; ;AN000; +;-------------------------------------------------------------------------------;AN000; + MOV CUR_COLUMN,0 ; Reading always start from left of scr ;AN000; +.IF <[BX].PRINT_OPTIONS EQ ROTATE> ;AN000; +.THEN ;AN000; +;-------------------------------------------------------------------------------;AN000; +; ;AN000; +; Printing is sideways; screen must be read starting in low-left corner. ;AN000; +; ;AN000; +;-------------------------------------------------------------------------------;AN000; + MOV AX,SCREEN_HEIGHT ;AN000; + MOV SCAN_LINE_MAX_LENGTH,AX ; Scan line length := screen height ;AN000; + DEC AX ;AN000; + MOV CUR_ROW,AX ; First row := screen height - 1 ;AN000; + ;AN000; +;-------Calculate the number of scan lines: ;AN000; + MOV AX,SCREEN_WIDTH ; DX AX = Screen width ;AN000; + CWD ; ;AN000; + XOR BX,BX ; BX = Number of boxes per print buf ;AN000; + MOV BL,NB_BOXES_PER_PRT_BUF ; ;AN000; + DIV BX ; Screen width / number boxes per buff ;AN000; + MOV NB_SCAN_LINES,AX ; Number of scan lines := result ;AN000; +.ELSE ;AN000; +;-------------------------------------------------------------------------------;AN000; +; ;AN000; +; Printing is not sideways; screen must be read starting in top-left corner ;AN000; +; ;AN000; +;-------------------------------------------------------------------------------;AN000; + MOV AX,SCREEN_WIDTH ;AN000; + MOV SCAN_LINE_MAX_LENGTH,AX ; Scan line length := screen width ;AN000; + MOV CUR_ROW,0 ; First row := 0 ;AN000; + ;AN000; +;-------Calculate the number of scan lines: ;AN000; + MOV AX,SCREEN_HEIGHT ; DX AX = Screen height ;AN000; + CWD ; ;AN000; + XOR BX,BX ; BX = Number of boxes per print buff ;AN000; + MOV BL,NB_BOXES_PER_PRT_BUF ; ;AN000; + DIV BX ; Screen height/number boxes per buff. ;AN000; + MOV NB_SCAN_LINES,AX ; Number of scan lines := result ;AN000; +.ENDIF ;AN000; + POP DX ;AN000; + POP BX ;AN000; + POP AX ;AN000; + RET ;AN000; +GET_SCREEN_INFO ENDP ;AN000; +PAGE ;AN000; +;===============================================================================;AN000; +; ;AN000; +; DET_CUR_SCAN_LNE_LENGTH : Determine where is the last non-blank "scan line ;AN000; +; column" on the current scan line. ;AN000; +; ;AN000; +;-------------------------------------------------------------------------------;AN000; +; ;AN000; +; INPUT: CUR_ROW, ;AN000; +; CUR_COLUMN = Coordinates of the top pixel of the current ;AN000; +; scan line. ;AN000; +; XLT_TAB = Color translation table ;AN000; +; ;AN000; +; OUTPUT: CUR_SCAN_LNE_LENGTH = Number of "columns" of pixels from the ;AN000; +; beginning of the scan line up to ;AN000; +; the last non-blank pixel. ;AN000; +; ;AN000; +; DATA SCREEN_WIDTH, ;AN000; +; REFERENCED: SCREEN_HEIGHT = Dimensions of the screen in pels ;AN000; +; SCAN_LINE_MAX_LENGTH= Maximum length of the scan line ;AN000; +; ROTATE_SW = ON if printing is sideways ;AN000; +; ;AN000; +;-------------------------------------------------------------------------------;AN000; +; ;AN000; +; DESCRIPTION: Determine where is the last non-blank "column" by reading ;AN000; +; the scan line backwards, one column at a time. ;AN000; +; ;AN000; +; ;AN000; +; LOGIC: ;AN000; +; ;AN000; +; ; Obtain coordinates for the top pixel of the last column on the current ;AN000; +; ; scan line: ;AN000; +; IF printing is sideways ;AN000; +; THEN ;AN000; +; CUR_ROW := 0 ;AN000; +; ELSE ;AN000; +; CUR_COLUMN := SCREEN_WIDTH - 1 ;AN000; +; ;AN000; +; CUR_SCAN_LNE_LENGTH := SCAN_LINE_MAX_LENGTH ;AN000; +; ; Read a column of pixels on the scan line until a non-blank is found: ;AN000; +; For each column on the screen ;AN000; +; CALL FILL_BUFF ;AN000; +; ; Check if PRT_BUF is empty ;AN000; +; IF buffer is empty ;AN000; +; THEN DEC CUR_SCAN_LNE_LENGTH ;AN000; +; ; Get next column ;AN000; +; IF printing sideways THEN DEC CUR_ROW ;AN000; +; ELSE DEC CUR_COLUMN ;AN000; +; ELSE quit the loop ;AN000; +; ;AN000; +DET_CUR_SCAN_LNE_LENGTH PROC NEAR ;AN000; + PUSH AX ;AN000; + PUSH BX ;AN000; + PUSH CX ;AN000; + PUSH DX ;AN000; + PUSH SI ;AN000; + PUSH DI ;AN000; + PUSH CUR_COLUMN ;AN000; + PUSH CUR_ROW ;AN000; + ;AN000; + MOV BX,OFFSET XLT_TAB ; BX := Offset of XLT_TAB ;AN000; +;-------------------------------------------------------------------------------;AN000; +; ;AN000; +; Obtain coordinates of the top pixel for the last column of the current ;AN000; +; scan line: ;AN000; +; ;AN000; +;-------------------------------------------------------------------------------;AN000; + .IF ; If printing sideways ;AN000; + .THEN ; then, ;AN000; + MOV CUR_ROW,0 ; CUR_ROW := 0 ;AN000; + .ELSE ; else, ;AN000; + MOV CX,SCREEN_WIDTH ; CUR_COLUMN := SCREEN_WIDTH - 1 ;AN000; + DEC CX ; ;AN000; + MOV CUR_COLUMN,CX ; ;AN000; + .ENDIF ;AN000; +;-------------------------------------------------------------------------------;AN000; +; ;AN000; +; Read the scan line backwards "column" by "column" until a non-blank is found: ;AN000; +; ;AN000; +;-------------------------------------------------------------------------------;AN000; + MOV CX,SCAN_LINE_MAX_LENGTH ; CX := current length ;AN000; +; ;AN000; +;-------For each "column" ;AN000; +CHECK_1_COLUMN: ;AN000; + MOV SI,CUR_ROW ; Save coordinates of the column ;AN000; + MOV DI,CUR_COLUMN ; in SI, DI ;AN000; + XOR DL,DL ; DL := Number of pixels verified in ;AN000; + ; one "column" ;AN000; +; ;AN000; +;-------For each pixel within that "column" ;AN000; +CHECK_1_PIXEL: ;AN000; + CALL READ_DOT ; AL := Index into translation table ;AN000; + XLAT XLT_TAB ; AL := Band mask or Intensity ;AN000; + ;AN000; +;-------Check if pixel will map to an empty box: ;AN000; + .IF ; If BLACK AND WHITE printer ;AN000; + .THEN ; then, check for intensity of white ;AN000; + CMP AL,WHITE_INT ; If curent pixel not blank ;AN000; + JNE DET_LENGTH_END ; THEN, LEAVE THE LOOP ;AN000; + .ELSE ; else, COLOR printer ;AN000; + OR AL,AL ; IF Band mask not blank ;AN000; + JNZ DET_LENGTH_END ; THEN, LEAVE THE LOOP ;AN000; + .ENDIF ;AN000; + ;AN000; +;-------All pixels so far on this "column" are blank, get next pixel: ;AN000; + .IF ; If printing sideways ;AN000; + .THEN ; ;AN000; + INC CUR_COLUMN ; then, increment column number ;AN000; + .ELSE ; ;AN000; + INC CUR_ROW ; else, increment row number ;AN000; + .ENDIF ; ;AN000; + INC DL ; One more pixel checked ;AN000; + CMP DL,NB_BOXES_PER_PRT_BUF ; All pixels for that column done ? ;AN000; + JL CHECK_1_PIXEL ; No, check next one. ;AN000; + ;AN000; +;-------Nothing to print for this column, get next column ;AN000; + .IF ; If printing sideways ;AN000; + .THEN ; then, ;AN000; + MOV CUR_COLUMN,DI ; Restore column number ;AN000; + INC CUR_ROW ; Get next row ;AN000; + .ELSE ; else, ;AN000; + MOV CUR_ROW,SI ; Restore row number ;AN000; + DEC CUR_COLUMN ; Get next column ;AN000; + .ENDIF ; ;AN000; + LOOP CHECK_1_COLUMN ; CX (length) := CX - 1 ;AN000; + ;AN000; +DET_LENGTH_END: ;AN000; + MOV CUR_SCAN_LNE_LENGTH,CX ; Get current length ;AN000; + ;AN000; + POP CUR_ROW ;AN000; + POP CUR_COLUMN ;AN000; + POP DI ;AN000; + POP SI ;AN000; + POP DX ;AN000; + POP CX ;AN000; + POP BX ;AN000; + POP AX ;AN000; + RET ;AN000; +DET_CUR_SCAN_LNE_LENGTH ENDP ;AN000; +PAGE ;AN000; +;===============================================================================;AN000; +; ;AN000; +; SETUP_PRT : SET UP THE PRINTER FOR PRINTING IN GRAPHIC MODE ;AN000; +; ;AN000; +;-------------------------------------------------------------------------------;AN000; +; ;AN000; +; INPUT: CUR_MODE_PTR = Offset of the DISPLAYMODE information ;AN000; +; record for the current mode ;AN000; +; ;AN000; +; OUTPUT: PRINTER ;AN000; +; ;AN000; +; CALLED BY: PRINT_COLOR ;AN000; +; PRT_BW_APA ;AN000; +; ;AN000; +;-------------------------------------------------------------------------------;AN000; +; ;AN000; +; DESCRIPTION: Extract the SETUP escape sequence from the DISPLAYMODE ;AN000; +; information record; Send this escape sequence to the printer. ;AN000; +; ;AN000; +; LOGIC: ;AN000; +; ;AN000; +; Number of bytes to print := CUR_MODE_PTR.NUM_SETUP_ESC ;AN000; +; ;AN000; +; Get the escape sequence: ;AN000; +; SI := CUR_MODE_PTR.SETUP_ESC_PTR ;AN000; +; ;AN000; +; FOR each byte to be printed ;AN000; +; PRINT_BYTE [SI] ; Send the byte to the printer ;AN000; +; INC SI ; Get the next byte ;AN000; +; ;AN000; +SETUP_PRT PROC NEAR ;AN000; + PUSH AX ;AN000; + PUSH BX ;AN000; + PUSH CX ;AN000; + ;AN000; + MOV BX,CUR_MODE_PTR ; BX := Displaymode info record. ;AN000; + ;AN000; + XOR CX,CX ; CX := Number of bytes to print ;AN000; + MOV CL,[BX].NUM_SETUP_ESC ; ;AN000; +.IF ; If there is at least one ;AN000; +.THEN ; byte to be printed: ;AN000; + MOV BX,[BX].SETUP_ESC_PTR ; BX := Offset sequence to send ;AN000; + ADD BX,BP ;AN000; + ;AN000; +SEND_1_SETUP_BYTE: ;AN000; + MOV AL,[BX] ; AL := byte to print ;AN000; + CALL PRINT_BYTE ; Send it to the printer ;AN000; + JC SETUP_PRT_END ; If printer error, quit the loop ;AN000; + INC BX ; Get next byte ;AN000; + LOOP SEND_1_SETUP_BYTE ;AN000; +.ENDIF ;AN000; +SETUP_PRT_END: ;AN000; + POP CX ;AN000; + POP BX ;AN000; + POP AX ;AN000; + RET ;AN000; +SETUP_PRT ENDP ;AN000; +PAGE ;AN000; +;===============================================================================;AN000; +; ;AN000; +; RESTORE_PRT : RESTORE THE PRINTER TO ITS INITIAL STATUS ;AN000; +; ;AN000; +;-------------------------------------------------------------------------------;AN000; +; ;AN000; +; INPUT: CUR_MODE_PTR = Offset of the DISPLAYMODE information ;AN000; +; record for the current mode ;AN000; +; ;AN000; +; OUTPUT: PRINTER ;AN000; +; ;AN000; +; CALLED BY: PRINT_COLOR ;AN000; +; PRT_BW_APA ;AN000; +;-------------------------------------------------------------------------------;AN000; +; ;AN000; +; DESCRIPTION: Extract the RESTORE escape sequence from the DISPLAYMODE ;AN000; +; information record; Send this escape sequence to the printer. ;AN000; +; ;AN000; +; LOGIC: ;AN000; +; ;AN000; +; Number of bytes to print := CUR_MODE_PTR.NUM_RESTORE_ESC ;AN000; +; ;AN000; +; Get the escape sequence: ;AN000; +; SI := CUR_MODE_PTR.RESTORE_ESC_PTR ;AN000; +; FOR each byte to be printed ;AN000; +; PRINT_BYTE [SI] ; Send the byte to the printer ;AN000; +; INC SI ; Get the next byte ;AN000; +; ;AN000; +RESTORE_PRT PROC NEAR ;AN000; + PUSH AX ;AN000; + PUSH BX ;AN000; + PUSH CX ;AN000; + ;AN000; + MOV BX,CUR_MODE_PTR ; BX := Displaymode info record. ;AN000; + ;AN000; + XOR CX,CX ; CX := Number of bytes to print ;AN000; + MOV CL,[BX].NUM_RESTORE_ESC ;AN000; +.IF ; If there is at least one ;AN000; +.THEN ; byte to be printed: ;AN000; + MOV BX,[BX].RESTORE_ESC_PTR ; BX := Offset sequence to send ;AN000; + ADD BX,BP ;AN000; + ;AN000; +SEND_1_RESTORE_BYTE: ;AN000; + MOV AL,[BX] ; AL := byte to print ;AN000; + CALL PRINT_BYTE ; Send it to the printer ;AN000; + JC RESTORE_PRT_END ; If printer error, quit the loop ;AN000; + INC BX ; Get next byte ;AN000; + LOOP SEND_1_RESTORE_BYTE ;AN000; +.ENDIF ;AN000; +RESTORE_PRT_END: ;AN000; + POP CX ;AN000; + POP BX ;AN000; + POP AX ;AN000; + RET ;AN000; +RESTORE_PRT ENDP ;AN000; +PAGE ;AN000; +;===============================================================================;AN000; +; ;AN000; +; NEW_PRT_LINE : INITIALIZE THE PRINTER FOR A GRAPHIC LINE ;AN000; +; ;AN000; +;-------------------------------------------------------------------------------;AN000; +; ;AN000; +; INPUT: CUR_MODE_PTR = Offset of the DISPLAYMODE information ;AN000; +; record for the current mode ;AN000; +; CUR_SCAN_LNE_LENGTH = Number of bytes to send to the printer. ;AN000; +; ;AN000; +; OUTPUT: PRINTER ;AN000; +; ;AN000; +; CALLED BY: PRINT_BAND ;AN000; +; PRT_BW_APA ;AN000; +; ;AN000; +;-------------------------------------------------------------------------------;AN000; +; ;AN000; +; DESCRIPTION: Extract the GRAPHICS escape sequence from the DISPLAYMODE ;AN000; +; information record; Send this escape sequence to the printer. ;AN000; +; Then, send the number of bytes that will follow. ;AN000; +; ;AN000; +; LOGIC: ;AN000; +; ;AN000; +; Number of bytes to print := CUR_MODE_PTR.NUM_GRAPHICS_ESC ;AN000; +; ;AN000; +; Get the escape sequence: ;AN000; +; Set up the 2 bytes containing the number of bytes to send in this sequence. ;AN000; +; SI := CUR_MODE_PTR.GRAPHICS_ESC_PTR ;AN000; +; ;AN000; +; FOR each byte to be printed ;AN000; +; PRINT_BYTE [SI] ; Send the byte to the printer ;AN000; +; INC SI ; Get the next byte ;AN000; +; ;AN000; +; Send the byte count ;AN000; +; ;AN000; + ;AN000; +NEW_PRT_LINE PROC NEAR ;AN000; + PUSH AX ;AN000; + PUSH BX ;AN000; + PUSH CX ;AN000; + PUSH DX ;AN000; + PUSH DI ;AN000; + ;AN000; + MOV BX,CUR_MODE_PTR ; BX := Displaymode info record. ;AN000; + ;AN000; +;-------------------------------------------------------------------------------;AN000; +; Set up the 2 bytes containing the number of bytes to send in the GRAPHICS seq.;AN000; +; NOTE: number of bytes to send is "CUR_SCAN_LNE_LENGTH * BOX_W" ;AN000; +;-------------------------------------------------------------------------------;AN000; + MOV AL,BOX_W ; cur_scan_lne_length * ;AN000; + CBW ; printer box width = nb bytes to send;AN000; + MUL CUR_SCAN_LNE_LENGTH ; (result in DX AX) ;AN000; + ; ;AN000; +;-------AX := Number of bytes to print ;AN000; + MOV DI,[BX].LOW_BYT_COUNT_PTR; DI := Offset of LOW byte of ;AN000; + ADD DI,BP ; byte count ;AN000; + MOV [DI],AL ; Store low byte ;AN000; + MOV DI,[BX].HGH_BYT_COUNT_PTR; DI := Offset of HIGH byte of ;AN000; + ADD DI,BP ; byte count ;AN000; + MOV [DI],AH ; Store high byte ;AN000; + ;AN000; +;-------------------------------------------------------------------------------;AN000; +; Send the GRAPHICS escape sequence to the printer: ;AN000; +;-------------------------------------------------------------------------------;AN000; + XOR CX,CX ; CX := Length of the escape seq;AN000; + MOV CL,[BX].NUM_GRAPHICS_ESC ;AN000; + MOV BX,[BX].GRAPHICS_ESC_PTR ; BX := Offset sequence to send ;AN000; + ADD BX,BP ;AN000; + ;AN000; +SEND_1_GRAPHICS_BYTE: ;AN000; + MOV AL,[BX] ; AL := byte to print ;AN000; + CALL PRINT_BYTE ; Send it to the printer ;AN000; + JC NEW_PRT_LINE_ENDP ; If printer error, quit the loop ;AN000; + INC BX ; Get next byte ;AN000; + LOOP SEND_1_GRAPHICS_BYTE ;AN000; + ;AN000; +NEW_PRT_LINE_ENDP: ;AN000; + POP DI ;AN000; + POP DX ;AN000; + POP CX ;AN000; + POP BX ;AN000; + POP AX ;AN000; + RET ;AN000; +NEW_PRT_LINE ENDP ;AN000; +PAGE ;AN000; +;===============================================================================;AN000; +; ;AN000; +; PRINT_BYTE : SEND A BYTE TO THE PRINTER AT LPT1 ;AN000; +; ;AN000; +;-------------------------------------------------------------------------------;AN000; +; ;AN000; +; INPUT: AL = Byte to be printed ;AN000; +; ;AN000; +; OUTPUT: PRINTER ;AN000; +; ERROR_CODE = PRINTER_ERROR if an error is detected. ;AN000; +; Carry flag is set in case of error. ;AN000; +; ;AN000; +;-------------------------------------------------------------------------------;AN000; +PRINT_BYTE PROC NEAR ;AN000; + PUSH AX ;AN000; + PUSH DX ;AN000; + ;AN000; + MOV DX,0000 ; PRINTER NUMBER ;AN000; + MOV AH,00 ; REQUEST PRINT ;AN000; + INT 17H ; CALL BIOS : SEND THE CHARACTER ;AN000; + ;AN000; + AND AH,00101001B ; Test error code returned in AH for ;AN000; + ; "Out of paper", "I/O error" and "Time-out". ;AN000; + JNZ PRINT_BYTE_ERROR; Set the error code if error ;AN000; + JMP SHORT PRINT_BYTE_END ; else, return normally ;AN000; +PRINT_BYTE_ERROR: ;AN000; + MOV ERROR_CODE,PRINTER_ERROR ;AN000; + STC ; Set the carry flag to indicate ERROR ;AN000; +PRINT_BYTE_END: ;AN000; + POP DX ;AN000; + POP AX ;AN000; + RET ;AN000; +PRINT_BYTE ENDP ;AN000; +PAGE ;AN000; +;===============================================================================;AN000; +; ;AN000; +; READ_DOT: READ A PIXEL - RETURN A COLOR TRANSLATION TABLE INDEX ;AN000; +; ;AN000; +;-------------------------------------------------------------------------------;AN000; +; ;AN000; +; INPUT: CUR_MODE = Current video mode. ;AN000; +; CUR_ROW, ;AN000; +; CUR_COLUMN = Coordinates of the pixel to be read. ;AN000; +; CUR_PAGE = Active page number ;AN000; +; ;AN000; +; OUTPUT: AL = Index into COLOR TRANSLATION TABLE. ;AN000; +; ;AN000; +; DEPENDENCIES : COLOR TRANSLATION TABLE entries must be bytes ;AN000; +; ;AN000; +; ;AN000; +;-------------------------------------------------------------------------------;AN000; +; ;AN000; +; DESCRIPTION: Use VIDEO BIOS INTERRUPT 10H "READ DOT CALL". ;AN000; +; ;AN000; +; Depending on the video hardware, the dot returned by BIOS has ;AN000; +; different meanings. ;AN000; +; With an EGA it is an index into the Palette registers, ;AN000; +; With a CGA it is a number from 0 to 3, mapping to a specific color ;AN000; +; depending on the background color and the color palette currently ;AN000; +; selected. ;AN000; +; ;AN000; +; The Color Translation table has been set up to hold the correct color ;AN000; +; mapping for any "dot" in any mode. Therefore, the dot number returned ;AN000; +; by INT 10H can be used with any mode as a direct index within that ;AN000; +; table. ;AN000; +; ;AN000; +; With APA Monochrome mode 0FH there are 4 different dots: white, ;AN000; +; blinking white, high-intensity white, and black. ;AN000; +; ;AN000; +; For mode 0FH, the dot returned by interrupt 10 "read dot" call is a byte ;AN000; +; where only bits 0 and 2 are significant. These 2 bits must be appended ;AN000; +; together in order to obtain a binary number (from 0 to 3) that will be used ;AN000; +; as an index in the Color Translation table. ;AN000; +; ;AN000; +; For mode 11H, the dot is either 0 (for background color) or 7 (for the ;AN000; +; foreground color) only the LSB is returned. That is, we return either ;AN000; +; 0 or 1. ;AN000; +; ;AN000; +; LOGIC: ;AN000; +; ;AN000; +; Call VIDEO BIOS "READ DOT" ;AN000; +; IF CUR_MODE = 0FH ;AN000; +; THEN ;AN000; +; Append bits 1 and 3. ;AN000; +; IF CUR_MODE = 11H ;AN000; +; THEN ;AN000; +; Wipe out bits 1 and 2. ;AN000; +; ;AN000; +READ_DOT PROC NEAR ;AN000; + PUSH BX ; Save registers ;AN000; + PUSH CX ;AN000; + PUSH DX ;AN000; + ;AN000; + MOV BH,CUR_PAGE ;AN000; + MOV DX,CUR_ROW ;AN000; + MOV CX,CUR_COLUMN ;AN000; + MOV AH,READ_DOT_CALL ;AN000; + INT 10H ; Call BIOS: AL <-- Dot read ;AN000; + ;AN000; + CMP CUR_MODE,0FH ; Is it Mode 0fH ? ;AN000; + JNE MODE_11H? ; No, look for mode 11h. ;AN000; +;-------Mode 0Fh is the current mode: ;AN000; +;-------Convert bits 2 and 0 into a 2 bit number: ;AN000; + MOV BL,AL ; BL := AL = "Pixel read" ;AN000; + AND BL,00000100B ; Wipe off all bits but bit 2 in BL ;AN000; + AND AL,00000001B ; Wipe off all bits but bit 0 in AL ;AN000; + SHR BL,1 ; Move bit 2 to bit 1 in BL ;AN000; + OR AL,BL ; Append bit 1 and bit 0 ;AN000; + JMP SHORT READ_DOT_END ; Quit. ;AN000; + ;AN000; +MODE_11H?: ;AN000; + CMP CUR_MODE,11H ; Is it Mode 0fH ? ;AN000; + JNE READ_DOT_END ; No, quit ;AN000; + ;AN000; +;-------Mode 11H is the current mode: ;AN000; + AND AL,00000001B ; Keep only the Least significant bit ;AN000; + ;AN000; +READ_DOT_END: ;AN000; + POP DX ; Restore registers ;AN000; + POP CX ;AN000; + POP BX ;AN000; + RET ;AN000; +READ_DOT ENDP ;AN000; diff --git a/v4.0/src/CMD/GRAPHICS/GRCOMMON.EXT b/v4.0/src/CMD/GRAPHICS/GRCOMMON.EXT new file mode 100644 index 0000000..8414070 --- /dev/null +++ b/v4.0/src/CMD/GRAPHICS/GRCOMMON.EXT @@ -0,0 +1,32 @@ +.XLIST ;AN000; +PAGE ,132 ;AN000; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;AN000; +;; DOS - GRAPHICS Command +;; (C) Copyright 1988 Microsoft +;; ;AN000; +;; File Name: GRCOMMON.EXT ;AN000; +;; ---------- ;AN000; +;; ;AN000; +;; Description: ;AN000; +;; ------------ ;AN000; +;; Include file containing external declarations for ;AN000; +;; the code and data defined in GRCOMMON.ASM ;AN000; +;; ;AN000; +;; Change History: ;AN000; +;; --------------- ;AN000; +;; ;AN000; +;; ;AN000; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;AN000; + ;; ;AN000; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;AN000; +.LIST ;AN000; +EXTRN READ_DOT:NEAR ;AN000; +EXTRN LOC_MODE_PRT_INFO:NEAR ;AN000; +EXTRN STORE_BOX:NEAR ;AN000; +EXTRN PRINT_BUFFER:NEAR ;AN000; +EXTRN GET_SCREEN_INFO:NEAR ;AN000; +EXTRN SETUP_PRT:NEAR ;AN000; +EXTRN RESTORE_PRT:NEAR ;AN000; +EXTRN NEW_PRT_LINE:NEAR ;AN000; +EXTRN PRINT_BYTE:NEAR ;AN000; +EXTRN DET_CUR_SCAN_LNE_LENGTH:NEAR ;AN000; diff --git a/v4.0/src/CMD/GRAPHICS/GRCPSD.ASM b/v4.0/src/CMD/GRAPHICS/GRCPSD.ASM new file mode 100644 index 0000000..28c2d10 --- /dev/null +++ b/v4.0/src/CMD/GRAPHICS/GRCPSD.ASM @@ -0,0 +1,109 @@ + PAGE ,132 ;AN000; + TITLE DOS GRAPHICS Command - Copy Shared Data + ;AN000; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;AN000; +;; DOS - GRAPHICS Command +;; (C) Copyright 1988 Microsoft +;; ;AN000; +;; File Name: GRCPSD.ASM ;AN000; +;; ---------- ;AN000; +;; ;AN000; +;; Description: ;AN000; +;; ------------ ;AN000; +;; This file contains the COPY_SHARED_DATA module. ;AN000; +;; ;AN000; +;; ;AN000; +;; Documentation Reference: ;AN000; +;; ------------------------ ;AN000; +;; PLACID Functional Specifications ;AN000; +;; OASIS High Level Design ;AN000; +;; OASIS GRAPHICS I1 Overview ;AN000; +;; ;AN000; +;; Procedures Contained in This File: ;AN000; +;; ---------------------------------- ;AN000; +;; COPY_SHARED_DATA - Copy the Shared Data Area from temporary ;AN000; +;; build area to resident memory & exit to DOS ;AN000; +;; ;AN000; +;; Include Files Required: ;AN000; +;; ----------------------- ;AN000; +;; None ;AN000; +;; ;AN000; +;; External Procedure References: ;AN000; +;; ------------------------------ ;AN000; +;; None ;AN000; +;; ;AN000; +;; Linkage Instructions: ;AN000; +;; --------------------- ;AN000; +;; Refer to GRAPHICS.ASM ;AN000; +;; ;AN000; +;; Change History: ;AN000; +;; --------------- ;AN000; +;; ;AN000; +;; ;AN000; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;AN000; + ;; ;AN000; + ;; ;AN000; +CODE SEGMENT PUBLIC 'CODE' ;; ;AN000; + ASSUME CS:CODE,DS:CODE ;; ;AN000; + INCLUDE GRCTRL.EXT ;; Bring in external declarations ;AN000; + INCLUDE GRCTRL.STR ;; for transient command processing ;AN000; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;AN000; +;; ;AN000; +;; Public Symbols ;AN000; +;; ;AN000; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;AN000; + ;; ;AN000; + PUBLIC COPY_SHARED_DATA ;; ;AN000; + ;; ;AN000; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;AN000; +;; ;AN000; +;; Module Name: ;AN000; +;; COPY_SHARED_DATA ;AN000; +;; ;AN000; +;; Input Parameters: ;AN000; +;; DS : SI - points to the Temporary Shared Data Area ;AN000; +;; ES : DI - destination for resident Shared Data Area ;AN000; +;; BP - offset for new Shared Data Area (same as DI) ;AN000; +;; AH - Function code for exiting to DOS: ;AN000; +;; 31H : Terminate & Stay Resident - if first time ;AN000; +;; 4CH : Terminate - if already installed ;AN000; +;; DX - resident data segment size in paragraphs ;AN000; +;; ;AN000; +;; Output Parameters: ;AN000; +;; NONE ;AN000; +;; ;AN000; +;; Data Structures Referenced: ;AN000; +;; Control Variables ;AN000; +;; ;AN000; +;; Description: ;AN000; +;; Copy the Temporary Shared Data area over the installation modules ;AN000; +;; and terminate (stay resident). The data is copied immediately ;AN000; +;; following this module. ;AN000; +;; ;AN000; +;; Called By: ;AN000; +;; GRAPHICS_INSTALL ;AN000; +;; ;AN000; +;; External Calls: ;AN000; +;; NONE ;AN000; +;; ;AN000; +;; Logic: ;AN000; +;; Copy Temporary Shared Data Area ;AN000; +;; Set PRINT_SCREEN_ALLOWED to YES ;AN000; +;; Exit to DOS (Function Code 31 or 4C setup by caller) ;AN000; +;; ;AN000; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;AN000; + ;; ;AN000; +COPY_SHARED_DATA PROC NEAR ;; ;AN000; + ;; ;AN000; + REP MOVSB ;; Copy Shared Data from temporary ;AN000; + ;; build area to resident memory ;AN000; + ;; Allow print screens now ;AN000; + MOV ES:PRINT_SCREEN_ALLOWED,YES ;AN000; + ;; ;AN000; + INT 21H ;; Exit ;AN000; + ;; ;AN000; +COPY_SHARED_DATA ENDP ;; ;AN000; + ;; ;AN000; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;AN000; +CODE ENDS ;AN000; + END COPY_SHARED_DATA ;AN000; diff --git a/v4.0/src/CMD/GRAPHICS/GRCPSD.EXT b/v4.0/src/CMD/GRAPHICS/GRCPSD.EXT new file mode 100644 index 0000000..fb3857f --- /dev/null +++ b/v4.0/src/CMD/GRAPHICS/GRCPSD.EXT @@ -0,0 +1,24 @@ +.XLIST ;AN000; +PAGE ,132 ;AN000; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;AN000; +;; DOS - GRAPHICS Command +;; (C) Copyright 1988 Microsoft +;; ;AN000; +;; File Name: GRCPSD.EXT ;AN000; +;; ---------- ;AN000; +;; ;AN000; +;; Description: ;AN000; +;; ------------ ;AN000; +;; External declarations for code and data defined in ;AN000; +;; GRCPSD.ASM ;AN000; +;; ;AN000; +;; Change History: ;AN000; +;; --------------- ;AN000; +;; ;AN000; +;; ;AN000; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;AN000; + ;; ;AN000; + EXTRN COPY_SHARED_DATA:NEAR ;; ;AN000; + ;; ;AN000; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;AN000; +.LIST ;AN000; diff --git a/v4.0/src/CMD/GRAPHICS/GRCTRL.ASM b/v4.0/src/CMD/GRAPHICS/GRCTRL.ASM new file mode 100644 index 0000000..1deff0a --- /dev/null +++ b/v4.0/src/CMD/GRAPHICS/GRCTRL.ASM @@ -0,0 +1,2162 @@ + PAGE ,132 ;AN000; + ;AN000; + TITLE DOS GRAPHICS Command - Print screen Control module +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;AN000; +;; DOS - GRAPHICS Command +;; (c) Copyright 1988 Microsoft +;; ;AN000; +;; File Name: GRCTRL.ASM ;AN000; +;; ---------- ;AN000; +;; ;AN000; +;; Description: ;AN000; +;; ------------ ;AN000; +;; This file contains the code for the Print Screen control module. ;AN000; +;; ;AN000; +;; Documentation Reference: ;AN000; +;; ------------------------ ;AN000; +;; OASIS High Level Design ;AN000; +;; OASIS GRAPHICS I1 Overview ;AN000; +;; ;AN000; +;; Procedures Contained in This File: ;AN000; +;; ---------------------------------- ;AN000; +;; PRT_SCR ;AN000; +;; DET_HW_CONFIG ;AN000; +;; DET_MODE_STATE ;AN000; +;; GET_MODE_ATTR ;AN000; +;; SET_UP_XLT_TAB ;AN000; +;; SET_CGA_XLT_TAB ;AN000; +;; CGA_COL2RGB ;AN000; +;; RGB2XLT_TAB ;AN000; +;; SET_EGA_XLT_TAB ;AN000; +;; EGA_COL2RGB ;AN000; +;; SET_MODE_F_XLT_TAB ;AN000; +;; SET_MODE_13H_XLT_TAB ;AN000; +;; SET_ROUNDUP_XLT_TAB ;AN000; +;; SET_BACKG_IN_XLT_TAB ;AN000; +;; RGB2BAND ;AN000; +;; RGB2INT ;AN000; +;; ;AN000; +;; ;AN000; +;; Include Files Required: ;AN000; +;; ----------------------- ;AN000; +;; GRINST.EXT - Externals for GRINST.ASM ;AN000; +;; ;AN000; +;; ;AN000; +;; External Procedure References: ;AN000; +;; ------------------------------ ;AN000; +;; FROM FILE GRINST.ASM: ;AN000; +;; GRAPHICS_INSTALL - Main module for installation. ;AN000; +;; ;AN000; +;; Linkage Instructions: ;AN000; +;; -------------------- ;AN000; +;; Refer to GRAPHICS.ASM ;AN000; +;; ;AN000; +;; Change History: ;AN000; +;; --------------- ;AN000; +;; ;AN000; +;; ;AN000; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;AN000; +CODE SEGMENT PUBLIC 'CODE' ;AN000; + ASSUME CS:CODE,DS:CODE ;AN000; + ;AN000; +.XLIST ;AN000; +INCLUDE GRINT2FH.EXT ;AN000; +INCLUDE GRBWPRT.EXT ;AN000; +INCLUDE GRCOLPRT.EXT ;AN000; +INCLUDE GRSHAR.STR ;AN000; +INCLUDE GRPATTRN.STR ;AN000; +INCLUDE GRPATTRN.EXT ;AN000; +INCLUDE STRUC.INC ;AN000; +.LIST ;AN000; +PRT_SCR PROC NEAR ;AN000; + JMP PRT_SCR_BEGIN ;AN000; +PAGE ;AN000; +;===============================================================================;AN000; +; ;AN000; +; GRAPHICS INTERRUPT DRIVER'S DATA: ;AN000; +; ;AN000; +;===============================================================================;AN000; +.xlist ;AN000; +PUBLIC PRT_SCR,ERROR_CODE,XLT_TAB,MODE_TYPE ;AN000; +PUBLIC CUR_MODE_PTR,CUR_MODE,NB_COLORS,SCREEN_HEIGHT,SCREEN_WIDTH ;AN000; +PUBLIC CUR_PAGE,CUR_COLUMN,CUR_ROW,NB_SCAN_LINES,SCAN_LINE_MAX_LENGTH ;AN000; +PUBLIC CUR_SCAN_LNE_LENGTH ;AN000; +PUBLIC PRT_BUF,NB_BOXES_PER_PRT_BUF,CUR_BOX,BOX_H,BOX_W ;AN000; +PUBLIC PRINT_SCREEN_ALLOWED,RGB ;AN000; +PUBLIC BIOS_INT_5H ;AN000; +PUBLIC ROTATE_SW ;AN000; +PUBLIC DET_HW_CONFIG ;AN000; +PUBLIC NB_CHAR_COLUMNS ;AN000; +PUBLIC RGB2INT ;AN000; +PUBLIC RGB2BAND ;AN000; +.list ;AN000; +INCLUDE GRCTRL.STR ;AN000; +;-------------------------------------------------------------------------------;AN000; +; ;AN000; +; ENTRY POINT TO BIOS HARDWARE INTERRUPT 5 HANDLER ;AN000; +; ;AN000; +;-------------------------------------------------------------------------------;AN000; +BIOS_INT_5H DW ? ; Pointer to BIOS int 5h ;AN000; + DW ? ;AN000; + ;AN000; +;-------------------------------------------------------------------------------;AN000; +; ;AN000; +; PRINT SCREEN ERROR CODE (Used at print screen time, see GRCTRL.STR for ;AN000; +; error codes allowed) ;AN000; +; ;AN000; +;-------------------------------------------------------------------------------;AN000; +ERROR_CODE DB 0 ; ERROR CODE 0 = NO ERROR ;AN000; + ;AN000; +;-------------------------------------------------------------------------------;AN000; +; ;AN000; +; SCREEN PIXEL: INTERNAL REPRESENTATION ;AN000; +; ;AN000; +;-------------------------------------------------------------------------------;AN000; +RGB PIXEL_STR < , , > ; PIXEL := RED, GREEN, BLUE Values ;AN000; + ;AN000; +;-------------------------------------------------------------------------------;AN000; +; ;AN000; +; COLOR TRANSLATION TABLE: ;AN000; +; ;AN000; +; This table is used to translate the color numbers returned by ;AN000; +; Interrupt 10H Read Dot and Read Character calls into print ;AN000; +; information. The table consists of 256 entries, one byte each, ;AN000; +; indexed by color number. ;AN000; +; In the case of black and white printing, the table ;AN000; +; entries are grey scale intensities from 0 to 63. In the case ;AN000; +; of color printing each table entry contains a "band mask" indicating ;AN000; +; which color print bands are required to generate the required color. ;AN000; +; The band masks are simply bit masks where each bit corresponds to one ;AN000; +; of the printer bands. ;AN000; +; ;AN000; +; The table is set up at the beginning of the print screen processing, ;AN000; +; before any data is read from the screen. From then on, translating ;AN000; +; from screen information into print information is done quickly by ;AN000; +; accessing this table. Not all 256 entries are initialized for each ;AN000; +; screen print. The number of entries used is equal to the number ;AN000; +; of colors available concurrently with the given display mode. ;AN000; +;-------------------------------------------------------------------------------;AN000; +XLT_TAB DB 256 DUP(32) ; COLOR TRANSLATION TABLE ;AN000; + ; This table is used to translate the Color Dot ;AN000; + ; or Byte Attribute to a Band Mask for color ;AN000; + ; printing or to a Grey Intensity for Mono- ;AN000; + ; chrome printing. ;AN000; + ;AN000; +;-------------------------------------------------------------------------------;AN000; +; ;AN000; +; CURRENT VIDEO MODE ATTRIBUTES ;AN000; +; ;AN000; +;-------------------------------------------------------------------------------;AN000; +MODE_TYPE DB ? ; Mode types (bit mask) APA or TXT ;AN000; + ;AN000; +CUR_MODE_PTR DW ? ; DISPLAYMODE INFO RECORD for the current ;AN000; + ; mode (defined in the shared data area). ;AN000; +CUR_MODE DB ? ; Current video mode number ;AN000; +NB_COLORS DW ? ; Number of colors supported by this mode ;AN000; +SCREEN_HEIGHT DW ? ; Number of rows on the screen (chars or pixels);AN000; +SCREEN_WIDTH DW ? ; Number of columns on the screen (chars/pixels);AN000; + ; (for text modes is equal to NB_CHAR_COLUMNS) ;AN000; +NB_CHAR_COLUMNS DB ? ; Number of columns on the screen if in txt mode;AN000; +CUR_PAGE DB ? ; Active page number ;AN000; +ROTATE_SW DB ? ; Switch: if "ON" then, must print sideways ;AN000; + ;AN000; +;-------------------------------------------------------------------------------;AN000; +; ;AN000; +; ACTIVE SCREEN ATTRIBUTES ;AN000; +; ;AN000; +;-------------------------------------------------------------------------------;AN000; +CUR_COLUMN DW ? ; Current pixel/char column number ;AN000; +CUR_ROW DW ? ; Current pixel/char row number ;AN000; +NB_SCAN_LINES DW ? ; Number of screen scan lines ;AN000; +SCAN_LINE_MAX_LENGTH DW ? ; Maximum number of dots/chars per scan line ;AN000; +CUR_SCAN_LNE_LENGTH DW ? ; Length in pels/chars of the current scan line ;AN000; + ;AN000; +;-------------------------------------------------------------------------------;AN000; +; ;AN000; +; PRINTER VARIABLES ;AN000; +; ;AN000; +;-------------------------------------------------------------------------------;AN000; +PRT_BUF DB ?,?,?,? ; PRINT BUFFER ;AN000; +NB_BOXES_PER_PRT_BUF DB ? ; Number of boxes fitting in the print buffer ;AN000; +CUR_BOX DB ?,?,?,? ; BOX = PRINTER REPRESENTATION OF 1 PIXEL ;AN000; +BOX_H DB ? ; HEIGHT OF THE BOX ;AN000; +BOX_W DB ? ; WIDTH OF THE BOX ;AN000; + ;AN000; +;-------------------------------------------------------------------------------;AN000; +; ;AN000; +; CONTROL VARIABLES: ;AN000; +; ;AN000; +; This data is used to communicate between the Installation Modules ;AN000; +; and the Resident Print Screen Modules. ;AN000; +;-------------------------------------------------------------------------------;AN000; +PRINT_SCREEN_ALLOWED DB YES; Used to avoid print screens ;AN000; + ; while the GRAPHICS installation ;AN000; + ; (or re-install) is in progress ;AN000; + ; Set by GRAPHICS_INSTALL module. ;AN000; + ;AN000; + ;AN000; +PAGE ;AN000; +;===============================================================================;AN000; +; ;AN000; +; INTERRUPT 5 DRIVER'S CODE: ;AN000; +; ;AN000; +;-------------------------------------------------------------------------------;AN000; +;===============================================================================;AN000; +; ;AN000; +; PRT_SCR : PRINT THE ACTIVE SCREEN ;AN000; +; ;AN000; +;-------------------------------------------------------------------------------;AN000; +; ;AN000; +; INPUT: SHARED_DATA_AREA_PTR = Offset of the data area used for ;AN000; +; passing data between the ;AN000; +; Installation process and the Print ;AN000; +; Screen process. ;AN000; +; PRINT_SCREEN_ALLOWED = Switch. Set to "No" if currently ;AN000; +; installing GRAPHICS.COM ;AN000; +; ;AN000; +; NOTE: These 2 variables are declared within ;AN000; +; PRT_SCR but initialized by the ;AN000; +; Installation process GRAPHICS_INIT ;AN000; +; OUTPUT: PRINTER ;AN000; +; ;AN000; +; CALLED BY: INTERRUPT 5 ;AN000; +; ;AN000; +; ;AN000; +;-------------------------------------------------------------------------------;AN000; +; ;AN000; +; DESCRIPTION: ;AN000; +; ;AN000; +; PRINT THE ACTIVE SCREEN for all TEXT and All Points Addressable (APA) ;AN000; +; display modes available with either a MONO, CGA, EGA, or VGA video ;AN000; +; adapter on a Black and White or Color printer. ;AN000; +; ;AN000; +; INITIALIZATION: ;AN000; +; ;AN000; +; Each pixel or character on the screen has a color attribute. These ;AN000; +; colors must be translated into different internal representations: ;AN000; +; ;AN000; +; For printing in colors, each color is translated to a BAND MASK. ;AN000; +; The Band Mask indicates how to obtain this color on the printer. ;AN000; +; ;AN000; +; For printing in Black and White, each color is translated to a ;AN000; +; GREY INTENSITY number between 0 (black) and 63 (white). ;AN000; +; ;AN000; +; The BAND MASK or the GREY INTENSITIES are found in the COLOR ;AN000; +; TRANSLATION TABLE. This table is initialized before calling any of ;AN000; +; the print screen modules. ;AN000; +; ;AN000; +; PRINT SCREEN TIME: ;AN000; +; ;AN000; +; When a pixel or character is read off the screen by one of the print ;AN000; +; screen modules, its color is used as an index into the translation ;AN000; +; table. ;AN000; +; ;AN000; +; ;AN000; +; LOGIC: ;AN000; +; ;AN000; +; IF SCREEN_PRINTS_ALLOWED=NO ; Block print screens until Installation ;AN000; +; THEN IRET ; Process (or re-install!) is finished. ;AN000; +; ELSE ;AN000; +; ;AN000; +; CALL DET_HW_CONFIG ; Determine hardware configuration ;AN000; +; CALL DET_MODE_STATE ; Determine video mode and active page ;AN000; +; CALL GET_MODE_ATTR ; Get video attributes (TXT or APA, etc) ;AN000; +; ;AN000; +; IF MODE_TYPE = TXT AND Number of colors = 0 ;AN000; +; THEN Invoke BIOS INTERRUPT 5 ;AN000; +; ELSE ;AN000; +; IF PRINTER_TYPE = BLACK_WHITE ;AN000; +; THEN ;AN000; +; IF MODE_TYPE = TXT ;AN000; +; THEN Invoke BIOS INTERRUPT 5 ;AN000; +; ELSE ; Mode is APA ;AN000; +; CALL SET_UP_XLT_TAB ; Set up the color translation table ;AN000; +; CALL PRINT_BW_APA ; Print the active screen on a B&W printer ;AN000; +; ELSE ; Color printer attached ;AN000; +; CALL SET_UP_XLT_TAB ; Set up the color translation table ;AN000; +; CALL PRINT_COLOR ; Print the active screen on a Color prt. ;AN000; +; IRET ;AN000; +; ;AN000; +PRT_SCR_BEGIN: ;AN000; + PUSH AX ; Save Registers ;AN000; + PUSH BX ; ;AN000; + PUSH CX ; ;AN000; + PUSH DX ; ;AN000; + PUSH SI ; ;AN000; + PUSH DI ; ;AN000; + PUSH BP ; ;AN000; + PUSH DS ; ;AN000; + PUSH ES ; ;AN000; + ; ;AN000; + CLD ; Clear direction flag ;AN000; + PUSH CS ; DS := CS ;AN000; + POP DS ;AN000; + ;AN000; +;-------------------------------------------------------------------------------;AN000; +; Verify if we are allowed to print (not allowed if currently installing ;AN000; +; GRAPHICS or printing a screen): ;AN000; +;-------------------------------------------------------------------------------;AN000; + CMP PRINT_SCREEN_ALLOWED,NO ; IF not allowed to print ;AN000; + JE PRT_SCR_RETURN ; THEN quit ;AN000; + ; ELSE print the screen: ;AN000; +;-------------------------------------------------------------------------------;AN000; +; INITIALIZATION: ;AN000; +;-------------------------------------------------------------------------------;AN000; +PRT_SCR_INIT: ; Disable print screen while ;AN000; + MOV PRINT_SCREEN_ALLOWED,NO ; we are printing the current ;AN000; + ; screen. ;AN000; + MOV BP,SHARED_DATA_AREA_PTR ; BP := Offset Shared Data Area ;AN000; + MOV ERROR_CODE,NO_ERROR ; No error so far. ;AN000; + CALL DET_HW_CONFIG ; Determine the type of display adapter ;AN000; + CALL DET_MODE_STATE ; Init CUR_PAGE, CUR_MODE ;AN000; + CALL GET_MODE_ATTR ; Determine if APA or TXT, nb. of colors, ;AN000; + ; and screen dimensions in pels or characters. ;AN000; + ; ;AN000; + ; Test the error code returned by GET_MODE_ATTR: ;AN000; + ; ;AN000; + TEST ERROR_CODE,MODE_NOT_SUPPORTED ;If mode not supported then, ;AN000; + JNZ EXIT_TO_BIOS ; let BIOS give it a try. ;AN000; + ;AN000; + ;------------------------------------------------------------------------------;AN000; + ; Check the printer type: ;AN000; + ;------------------------------------------------------------------------------;AN000; + .IF ; Is a black and white printer ;AN000; + .THEN ; attached ? ;AN000; + ;------------------------------------------------------------------------------;AN000; + ; A Black and White printer is attached ;AN000; + ;------------------------------------------------------------------------------;AN000; + CMP MODE_TYPE,TXT ; Is the screen in text mode ? ;AN000; + JNE INVOKE_PRINT_ROUTINE ; No, call GRAPHICS B&W routine ;AN000; + JMP SHORT EXIT_TO_BIOS ; Yes, give control to BIOS INTERRUPT 5 ;AN000; + .ELSE ;AN000; + ;------------------------------------------------------------------------------;AN000; + ; A Color printer is attached ;AN000; + ;------------------------------------------------------------------------------;AN000; + CMP NB_COLORS,0 ; Is the screen in a Monochrome ;AN000; + JNE INVOKE_PRINT_ROUTINE ;AN000; + TEST MODE_TYPE,TXT ; text mode ? ;AN000; + JNZ INVOKE_PRINT_ROUTINE ;AN000; + JMP SHORT EXIT_TO_BIOS ; Yes, let BIOS INTERRUPT 5 handle it ;AN000; + ; No, we handle it. ;AN000; +.ENDIF ; ENDIF black and white or color printer ;AN000; +;-------------------------------------------------------------------------------;AN000; +; ;AN000; +; Call the print routine (which is either PRINT_COLOR or PRINT_BW_APA) ;AN000; +; ;AN000; +;-------------------------------------------------------------------------------;AN000; +INVOKE_PRINT_ROUTINE: ;AN000; + CALL SET_UP_XLT_TAB ; Set up the color translation table ;AN000; + CALL PRINT_MODULE_START ; Call the print modules that were ;AN000; + ; made resident at Install time. ;AN000; + MOV PRINT_SCREEN_ALLOWED,YES; Enable PrtScr for next calls ;AN000; + ;-----------------------------------------------------------------------------;AN000; + ; Test the error code returned by either PRINT_COLOR or PRT_BW_APA ;AN000; + ;-----------------------------------------------------------------------------;AN000; + TEST ERROR_CODE,UNABLE_TO_PRINT ; If unable to print the screen ;AN000; + JNZ SHORT EXIT_TO_BIOS ; then, let BIOS give it a try ;AN000; + ;AN000; +PRT_SCR_RETURN: ;AN000; + ; Restore registers ;AN000; + POP ES ; ;AN000; + POP DS ; ;AN000; + POP BP ; ;AN000; + POP DI ; ;AN000; + POP SI ; ;AN000; + POP DX ; ;AN000; + POP CX ; ;AN000; + POP BX ; ;AN000; + POP AX ; ;AN000; + ; ;AN000; + IRET ; Return control to interrupted ;AN000; + ; process ;AN000; +EXIT_TO_BIOS: ;AN000; + ; Restore registers ;AN000; + POP ES ; ;AN000; + POP DS ; ;AN000; + POP BP ; ;AN000; + POP DI ; ;AN000; + POP SI ; ;AN000; + POP DX ; ;AN000; + POP CX ; ;AN000; + POP BX ; ;AN000; + POP AX ; ;AN000; + CLI ; Disable interrupts ;AN000; + MOV CS:PRINT_SCREEN_ALLOWED,YES ; Enable PrtScr for next calls ;AN000; + JMP DWORD PTR CS:BIOS_INT_5H ; Exit to BIOS INTERRUPT 5 ;AN000; + ;AN000; +PRT_SCR ENDP ;AN000; + ;AN000; + ;AN000; +;===============================================================================;AN000; +; ;AN000; +; PRT_SCR MODULES: ;AN000; +; ;AN000; +;-------------------------------------------------------------------------------;AN000; +PAGE ;AN000; +;===============================================================================;AN000; +; ;AN000; +; DET_HW_CONFIG : DETERMINE WHAT TYPE OF VIDEO HARDWARE IS PRESENT ;AN000; +; ;AN000; +;-------------------------------------------------------------------------------;AN000; +; ;AN000; +; INPUT: BP = Offset of the shared data area ;AN000; +; ;AN000; +; OUTPUT: HARDWARE_CONFIG is updated in the shared data area ;AN000; +; ;AN000; +; CALLED BY: PRT_SCR ;AN000; +; ;AN000; +; EXTERNAL CALLS: BIOS INT 10H ;AN000; +; ;AN000; +;-------------------------------------------------------------------------------;AN000; +; ;AN000; +; LOGIC: ;AN000; +; Issue BIOS INT10H Get Display Configuration Code (AX=1A00H) ;AN000; +; IF AL = 1AH THEN /* VGA (PS/2 OR BRECON-B) */ ;AN000; +; /* BL = active DCC */ ;AN000; +; /* BH = alternate DCC */ ;AN000; +; /* Display Code: */ ;AN000; +; /* 1 - Mono Adapter */ ;AN000; +; /* 2 - CGA */ ;AN000; +; /* 4 - EGA with Mono Display */ ;AN000; +; /* 5 - EGA with Color Display */ ;AN000; +; /* 7 - PS/2 Mod 50,60,80 OR BRECON-B with Mono Display */ ;AN000; +; /* 8 - PS/2 Mod 50,60,80 OR BRECON-B with Color Display */ ;AN000; +; /* B - PS/2 Mod 30 with Mono Display */ ;AN000; +; /* C - PS/2 Mod 30 with Color Display */ ;AN000; +; IF AL = 1AH THEN /* Call is supported */ ;AN000; +; Set HARDWARE_CONFIG byte based on DCC returned in DL ;AN000; +; ELSE ;AN000; +; Issue INT 10H EGA Info (AH=12H BL=10H) ;AN000; +; IF BL <> 10H THEN /* EGA */ ;AN000; +; Set EGA bit in HARDWARE_CONFIG ;AN000; +; ELSE /* CGA or */ ;AN000; +; Issue INT 10H PC CONVERTIBLE Physical display description param. ;AN000; +; request. (AH=15H) ;AN000; +; IF ES:[DI] = 5140H ;AN000; +; THEN ;AN000; +; Set PC_CONVERTIBLE bit in HARDWARE_CONFIG ;AN000; +; ELSE ;AN000; +; Set OLD_ADAPTER bit in HARDWARE_CONFIG ;AN000; +; ENDIF ;AN000; +; ENDIF ;AN000; +; ENDIF ;AN000; +; RETURN ;AN000; +; ;AN000; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;AN000; +DET_HW_CONFIG PROC NEAR ;AN000; + ;AN000; +;-------------------------------------------------------------------------------;AN000; +; ;AN000; +; Try to read display combination code (PS/2 call): ;AN000; +; ;AN000; +;-------------------------------------------------------------------------------;AN000; + MOV AX,READ_CONFIG_CALL ;AN000; + INT 10H ; Call video BIOS ;AN000; + ;AN000; + .IF ; If call is supported ;AN000; + .THEN ;AN000; +;-------------------------------------------------------------------------------;AN000; +; ;AN000; +; Call is supported, PS/2 BIOS is present (Model 39,50,60,80 or BRECON-B card), ;AN000; +; Determine what is the primary video adapter: ;AN000; +; ;AN000; +;-------------------------------------------------------------------------------;AN000; + .SELECT ;AN000; + .WHEN OR ; MONO or ;AN000; + .WHEN ; CGA ;AN000; + MOV DS:[BP].HARDWARE_CONFIG,OLD_ADAPTER ;AN000; + .WHEN OR ; EGA with Mono or ;AN000; + .WHEN ; EGA with Color ;AN000; + MOV DS:[BP].HARDWARE_CONFIG,EGA ;AN000; + .WHEN OR ; BRECON-B with Mono or ;AN000; + .WHEN ; BRECON-B with Color ;AN000; + MOV DS:[BP].HARDWARE_CONFIG,ROUNDUP ;AN000; + .WHEN OR ; PS/2 Model 30 with Mono or ;AN000; + .WHEN ; PS/2 Model 30 with Color ;AN000; + MOV DS:[BP].HARDWARE_CONFIG,PALACE ;AN000; + .ENDSELECT ;AN000; +;-------------------------------------------------------------------------------;AN000; +; ;AN000; +; PS/2 call is not supported, try the EGA info call: ;AN000; +; ;AN000; +;-------------------------------------------------------------------------------;AN000; + .ELSE ;AN000; + MOV AH,ALT_SELECT_CALL ; Request Alternate select's ;AN000; + MOV BL,EGA_INFO_CALL ; "return EGA information call" ;AN000; + INT 10H ; Call video BIOS ;AN000; + .IF ; If a memory value is returned ;AN000; + .THEN ; then, there is an EGA ;AN000; + MOV DS:[BP].HARDWARE_CONFIG,EGA ;AN000; + .ELSE ; else, call is not supported: ;AN000; +;-------------------------------------------------------------------------------;AN000; +; ;AN000; +; EGA call is not supported, try the PC CONVERTIBLE display description call: ;AN000; +; ;AN000; +;-------------------------------------------------------------------------------;AN000; + MOV AH,DISP_DESC_CALL ;AN000; + INT 10H ; Call BIOS, ES:DI :=Offset of parms;AN000; + .IF ; If LCD display type, ;AN000; + .THEN ; set LCD bit in Shared Data area ;AN000; + MOV DS:[BP].HARDWARE_CONFIG,PC_CONVERTIBLE ;AN000; + .ELSE ; else, we have an old adapter. ;AN000; + MOV DS:[BP].HARDWARE_CONFIG,OLD_ADAPTER ; (either MONO or CGA);AN000; + .ENDIF ; Display type is LCD ;AN000; + .ENDIF ; EGA BIOS is present ;AN000; + .ENDIF ; PS/2 BIOS is present ;AN000; + RET ;AN000; +DET_HW_CONFIG ENDP ;AN000; +PAGE ;AN000; +;======================================================================= ;AN000; +; ;AN000; +; DET_MODE_STATE : Determine the current video mode and the active page. ;AN000; +; ;AN000; +;----------------------------------------------------------------------- ;AN000; +; ;AN000; +; INPUT: HARDWARE_CONFIG = Type of video hardware attached ;AN000; +; ;AN000; +; OUTPUT: CUR_MODE = Video mode number (0-13H) ;AN000; +; CUR_PAGE = Video page number (0-8) ;AN000; +; NB_CHAR_COLUMNS = Number of columns if in a text mode. ;AN000; +; ;AN000; +; ;AN000; +; CALLED BY: PRT_SCR ;AN000; +; ;AN000; +; ;AN000; +;-------------------------------------------------------------------------------;AN000; +; ;AN000; +; DESCRIPTION: Use the BIOS interface to ;AN000; +; obtain the current mode and active page. ;AN000; +; ;AN000; +; LOGIC: ;AN000; +; ;AN000; +; Call BIOS INTERRUPT 10H: "Return current video state" (AH = 0fh) ;AN000; +; ;AN000; +DET_MODE_STATE PROC NEAR ;AN000; + PUSH AX ;AN000; + PUSH BX ;AN000; + MOV AH,GET_STATE_CALL ;AN000; + INT 10H ; CALL BIOS ;AN000; + MOV CUR_MODE,AL ;AN000; + MOV NB_CHAR_COLUMNS,AH ;AN000; + MOV CUR_PAGE,BH ;AN000; + ;AN000; + POP BX ;AN000; + POP AX ;AN000; + RET ;AN000; +DET_MODE_STATE ENDP ;AN000; + ;AN000; +PAGE ;AN000; +;======================================================================= ;AN000; +; ;AN000; +; GET_MODE_ATTR: Obtain attributes of current video mode. ;AN000; +; ;AN000; +;----------------------------------------------------------------------- ;AN000; +; ;AN000; +; INPUT: CUR_MODE = Current video mode (1 BYTE) ;AN000; +; ;AN000; +; OUTPUT: MODE_TYPE = Video mode type (TXT or APA) ;AN000; +; NB_COLORS = Maximum number of colors (0-256) (0=B&W) ;AN000; +; ERROR_CODE = Error code if error occurred. ;AN000; +; SCREEN_HEIGHT= Number of rows (in pixels if APA or char if TEXT);AN000; +; SCREEN_WIDTH = Number of columns (in pixels/char) ;AN000; +; ;AN000; +; CALLED BY: PRT_SCR ;AN000; +; ;AN000; +; ;AN000; +;----------------------------------------------------------------------- ;AN000; +; ;AN000; +; DESCRIPTION: Scan the 2 local video mode attribute tables until the ;AN000; +; current mode is located. Return the attributes. ;AN000; +; For APA modes SCREEN_HEIGHT and SCREEN_WIDTH are in pixels, ;AN000; +; for TEXT modes they are in characters. ;AN000; +; ;AN000; +; ;AN000; +; LOGIC: ;AN000; +; ;AN000; +; Scan the APA_ATTR_TABLE ;AN000; +; IF FOUND ;AN000; +; MODE_TYPE := APA ;AN000; +; NB_COLORS := mode.MAX_COLORS ;AN000; +; SCREEN_HEIGHT := mode.NB_L ;AN000; +; SCREEN_WIDTH := mode.NB_C ;AN000; +; ELSE ;AN000; +; Scan the TXT_ATTR_TABLE ;AN000; +; When FOUND ;AN000; +; MODE_TYPE := TXT ;AN000; +; NB_COLORS := mode.NUM_COLORS ;AN000; +; SCREEN_WIDTH := NB_CHAR_COLUMNS ;AN000; +; SCREEN_HEIGHT := Byte in ROM BIOS at 40:84 ;AN000; +; ;AN000; +;----------------------------------------------------------------------- ;AN000; +GET_MODE_ATTR PROC NEAR ;AN000; + JMP SHORT GET_MODE_ATTR_BEGIN ;AN000; +;----------------------------------------------------------------------- ;AN000; +; ;AN000; +; LOCAL DATA ;AN000; +; ;AN000; +;----------------------------------------------------------------------- ;AN000; + ;AN000; +APA_ATTR STRUC ; ATTRIBUTES FOR APA MODES: ;AN000; + APA_MODE DB ? ; Mode number ;AN000; + NB_C DW ? ; Number of columns ;AN000; + NB_L DW ? ; Number of lines ;AN000; + MAX_COLORS DW ? ; Maximum number of colors available (0=B&W) ;AN000; +APA_ATTR ENDS ;AN000; + ;AN000; +TXT_ATTR STRUC ; ATTRIBUTES FOR TXT MODES: ;AN000; + TXT_MODE DB ? ; Mode number ;AN000; + NUM_COLORS DB ? ; Number of colors ;AN000; +TXT_ATTR ENDS ;AN000; + ;AN000; +;----------------------------------------------------------------------- ;AN000; +; ;AN000; +; APA MODE ATTRIBUTES: ;AN000; +; ;AN000; +;----------------------------------------------------------------------- ;AN000; +NB_APA_MODES DW 10 ;AN000; +APA_ATTR_TABLE LABEL WORD ;AN000; +MODE04 APA_ATTR < 4,320,200, 4> ;AN000; +MODE05 APA_ATTR < 5,320,200, 4> ;AN000; +MODE06 APA_ATTR < 6,640,200, 2> ;AN000; +MODE0D APA_ATTR <0DH,320,200, 16> ;AN000; +MODE0E APA_ATTR <0EH,640,200, 16> ;AN000; +MODE0F APA_ATTR <0FH,640,350, 4> ;AN000; +MODE10H APA_ATTR <10H,640,350, 16> ;AN000; +MODE11H APA_ATTR <11H,640,480, 2> ;AN000; +MODE12H APA_ATTR <12H,640,480, 16> ;AN000; +MODE13H APA_ATTR <13H,320,200,256> ;AN000; + ;AN000; +;----------------------------------------------------------------------- ;AN000; +; ;AN000; +; TXT MODE ATTRIBUTES: ;AN000; +; ;AN000; +;----------------------------------------------------------------------- ;AN000; +NB_TXT_MODES DW 5 ;AN000; +TXT_ATTR_TABLE LABEL WORD ;AN000; +MODE00 TXT_ATTR < 0, 16> ;AN000; +MODE01 TXT_ATTR < 1, 16> ;AN000; +MODE02 TXT_ATTR < 2, 16> ;AN000; +MODE03 TXT_ATTR < 3, 16> ;AN000; +MODE07 TXT_ATTR < 7, 0> ;AN000; + ;AN000; +;----------------------------------------------------------------------- ;AN000; +; ;AN000; +; BEGIN OF GET_MODE_ATTR ;AN000; +; ;AN000; +;----------------------------------------------------------------------- ;AN000; +GET_MODE_ATTR_BEGIN: ;AN000; + PUSH AX ;AN000; + PUSH BX ;AN000; + PUSH CX ;AN000; + PUSH DX ;AN000; + MOV DL,CUR_MODE ; DL = CURRENT MODE ;AN000; +; ;AN000; +; Scan the APA_ATTR_TABLE ;AN000; +; ;AN000; + MOV CX,NB_APA_MODES ; CS <-- Number of APA modes ;AN000; + MOV BX,OFFSET APA_ATTR_TABLE; BX <-- Offset of APA mode table ;AN000; + SCAN_APA: ;AN000; + CMP DL,[BX].APA_MODE ; IF mode found ;AN000; + JE SHORT ITS_APA ; THEN get its attributes ;AN000; + ADD BX,SIZE APA_ATTR ;AN000; + LOOP SCAN_APA ; ELSE keep scanning ;AN000; + JMP SHORT SCAN_TXT_INIT ; NOT in this table: scan txt modes ;AN000; +ITS_APA: ;AN000; + MOV MODE_TYPE,APA ; MODE = APA ;AN000; + MOV AX,[BX].MAX_COLORS ;AN000; + MOV NB_COLORS,AX ; Get number of colors ;AN000; + MOV AX,[BX].NB_L ;AN000; + MOV SCREEN_HEIGHT,AX ; Get number of lines ;AN000; + MOV AX,[BX].NB_C ;AN000; + MOV SCREEN_WIDTH,AX ; Get number of columns ;AN000; + JMP SHORT GET_MODE_ATTR_END ;AN000; + ;AN000; +; ;AN000; +; Scan the TXT_ATTR_TABLE ;AN000; +; ;AN000; +SCAN_TXT_INIT: ;AN000; + MOV CX,NB_TXT_MODES ; CX <-- Number of TXT modes ;AN000; + MOV BX,OFFSET TXT_ATTR_TABLE; BX <-- Offset of TXT mode table ;AN000; + SCAN_TXT: ;AN000; + CMP DL,[BX].TXT_MODE ; IF mode found ;AN000; + JE SHORT ITS_TXT ; THEN get its attributes ;AN000; + ADD BX,SIZE TXT_ATTR ;AN000; + LOOP SCAN_TXT ; ELSE keep scanning ;AN000; +ITS_TXT: ;AN000; + MOV MODE_TYPE,TXT ; MODE = TXT ;AN000; + MOV AL,[BX].NUM_COLORS ;AN000; + CBW ;AN000; + MOV NB_COLORS,AX ; Get number of colors ;AN000; + MOV AL,NB_CHAR_COLUMNS ; Get number of columns ;AN000; + CBW ;AN000; + MOV SCREEN_WIDTH,AX ;AN000; + .IF ; If an old adapter is there;AN000; + .THEN ; The number of lines is 25 ;AN000; + MOV SCREEN_HEIGHT,25 ;AN000; + .ELSE ;AN000; + MOV AX,BIOS_SEG ; Get number of rows ;AN000; + MOV ES,AX ; from BIOS Data Area ;AN000; + MOV BX,NB_ROWS_OFFSET ; at 0040:0084 ;AN000; + MOV AL,ES:[BX] ;AN000; + CBW ;AN000; + INC AX ;AN000; + MOV SCREEN_HEIGHT,AX ;AN000; + .ENDIF ;AN000; + JMP SHORT GET_MODE_ATTR_END ;AN000; + ;AN000; +; ;AN000; +; The current mode was not found in any of the tables ;AN000; +; ;AN000; + MOV ERROR_CODE,MODE_NOT_SUPPORTED ;AN000; + ;AN000; +GET_MODE_ATTR_END: ;AN000; + POP AX ;AN000; + POP BX ;AN000; + POP CX ;AN000; + POP DX ;AN000; + RET ;AN000; +GET_MODE_ATTR ENDP ;AN000; +PAGE ;AN000; +;======================================================================= ;AN000; +; ;AN000; +; SET_UP_XLT_TABLE : SET UP A COLOR MAPPING FOR EACH COLOR AVAILABLE ;AN000; +; WITH THE CURRENT MODE ;AN000; +; ;AN000; +;----------------------------------------------------------------------- ;AN000; +; ;AN000; +; INPUT: CUR_MODE = Current video mode. ;AN000; +; HARDWARE_CONFIG = Type of display adapter. ;AN000; +; PRINTER_TYPE = Type of printer attached (Color or B&W) ;AN000; +; XLT_TAB = Color translation table. ;AN000; +; CUR_PAGE = Active page number ;AN000; +; BP = Offset of the shared data area ;AN000; +; ;AN000; +; ;AN000; +; OUTPUT: XLT_TAB IS UPDATED ;AN000; +; ;AN000; +; CALLED BY: PRT_SCR ;AN000; +; ;AN000; +;----------------------------------------------------------------------- ;AN000; +; ;AN000; +; DESCRIPTION: The table is updated to hold a mapping for each color ;AN000; +; available in the current video mode either TEXT or APA. ;AN000; +; ;AN000; +; For example, if the current mode supports 16 colors then the first ;AN000; +; sixteen bytes of the table will hold the corresponding Color printer ;AN000; +; or Black and White printer mappings for these colors. ;AN000; +; ;AN000; +; ;AN000; +; LOGIC: ;AN000; +; ;AN000; +; IF HARDWARE_CONFIG = CGA OR HARDWARE_CONFIG = PC_CONVERTIBLE ;AN000; +; THEN ;AN000; +; CALL SET_CGA_XLT_TAB ;AN000; +; ;AN000; +; ELSE IF HARDWARE_CONFIG = EGA ;AN000; +; THEN ;AN000; +; CALL SET_EGA_XLT_TAB ;AN000; +; ;AN000; +; ELSE IF CUR_MODE = 0FH ;AN000; +; THEN ;AN000; +; CALL SET_MODE_F_XLT_TAB ;AN000; +; ;AN000; +; ELSE IF CUR_MODE = 19 ;AN000; +; THEN ;AN000; +; CALL SET_MODE_13H_XLT_TAB ;AN000; +; ;AN000; +; ELSE ;AN000; +; CALL SET_ROUNDUP_XLT_TAB ;AN000; +; ;AN000; +; CALL SET_BACKG_IN_XLT_TAB ; Update the background in the translation table ;AN000; +; ;AN000; +SET_UP_XLT_TAB PROC NEAR ;AN000; +;-------------------------------------------------------------------------------;AN000; +; For old display modes: set up translation table as for a Color Graphics Adapt.;AN000; +; Either 4 or 16 colors are set up depending if the mode is an APA or text mode.;AN000; +; ;AN000; +; NOTE: SET_UP_XLT_TAB cannot be invoked if the display adater is a Monochrome ;AN000; +; display adater. (When a Mono. adapter is attached, a jump is made to ;AN000; +; the ROM BIOS for printing the screen, and no translation table is set). ;AN000; +;-------------------------------------------------------------------------------;AN000; +.IF OR ; IF it is a CGA ;AN000; +.IF ; or a PC convertible ;AN000; +.THEN ; THEN set up CGA colors ;AN000; + CALL SET_CGA_XLT_TAB ; ;AN000; +.ELSEIF ; ELSEIF it is an EGA ;AN000; + CALL SET_EGA_XLT_TAB ; set up EGA colors. ;AN000; +.ELSEIF ; ELSEIF we are in mode 15 ;AN000; + CALL SET_MODE_F_XLT_TAB ; set up its 4 shades ;AN000; +;-------------------------------------------------------------------------------;AN000; +; A PS/2 system is attached: (we either have a PALACE [Model 30] or a ROUNDUP) ;AN000; +;-------------------------------------------------------------------------------;AN000; +.ELSEIF ; ELSEIF current mode is 13h;AN000; + CALL SET_MODE_13H_XLT_TAB ; set up 256 colors ;AN000; +.ELSEIF ; ELSEIF PS/2 Model 30(MCGA);AN000; + CALL SET_CGA_XLT_TAB ; handle it like a CGA ;AN000; +.ELSE ; ELSE we have a ROUNDUP ;AN000; +;-------------------------------------------------------------------------------;AN000; +; A PS/2 model 50, 60 or 80 or an ADA 'B' card is attached (in 16 color mode): ;AN000; +;-------------------------------------------------------------------------------;AN000; + CALL SET_ROUNDUP_XLT_TAB ; set up 16 colors ;AN000; +.ENDIF ;AN000; +;-------------------------------------------------------------------------------;AN000; +; Finish setting up the translation table: ;AN000; +;-------------------------------------------------------------------------------;AN000; + ;AN000; +CALL SET_BACKG_IN_XLT_TAB ; Update the background in the translation table ;AN000; + ; according to the command line switch setting ;AN000; + ; (i.e.,/R /B) ;AN000; + RET ;AN000; +SET_UP_XLT_TAB ENDP ;AN000; +PAGE ;AN000; +;===============================================================================;AN000; +; ;AN000; +; SET_BACKG_IN_XLT_TAB : ADJUST THE MAPPING FOR THE BACKGROUND COLOR IN THE ;AN000; +; XLT_TAB ACCORDING TO PRINTER TYPE AND /R /B. ;AN000; +; ;AN000; +; ;AN000; +;-------------------------------------------------------------------------------;AN000; +; ;AN000; +; INPUT: BP = Offset of shared data area (SWITCHES) ;AN000; +; XLT_TAB = The color translation table. ;AN000; +; ;AN000; +; OUTPUT: XLT_TAB IS UPDATED ;AN000; +; ;AN000; +;-------------------------------------------------------------------------------;AN000; +; ;AN000; +; DESCRIPTION: If there is a black and white printer and /R is NOT specified ;AN000; +; then the background color should not be printed and it is replaced in the ;AN000; +; translation table by the Intensity for white (will print nothing). ;AN000; +; ;AN000; +; If a color printer is attached and /B is not specified then the background ;AN000; +; color is replaced by the Print Band mask for white. ;AN000; +; ;AN000; +; LOGIC: ;AN000; +; IF (a black and white printer is attached) AND (/R is OFF) ;AN000; +; THEN ;AN000; +; MOV XLT_TAB, WHITE_INT ; Store white in translation table ;AN000; +; ELSE (a color printer is attached) ;AN000; +; IF (/B is ON) ;AN000; +; THEN ;AN000; +; RGB.R := MAX_INT ;AN000; +; RGB.G := MAX_INT ;AN000; +; RGB.B := MAX_INT ;AN000; +; CALL RGB2BAND ; Convert RGB for white to a Band Mask ;AN000; +; MOV XLT_TAB,AL ; Store the band mask in the xlt table ;AN000; +; ;AN000; +; ;AN000; +;-------------------------------------------------------------------------------;AN000; +SET_BACKG_IN_XLT_TAB PROC NEAR ;AN000; +;-------------------------------------------------------------------------------;AN000; +; ;AN000; +; Test if a black and white printer is attached. ;AN000; +; ;AN000; +;-------------------------------------------------------------------------------;AN000; +.IF AND ; IF black and white ;AN000; +.IF ; printer and not /R ;AN000; +.THEN ; then, map background ;AN000; + MOV XLT_TAB,WHITE_INT ; to white. ;AN000; +;-------------------------------------------------------------------------------;AN000; +; ;AN000; +; A Color printer is attached: ;AN000; +; ;AN000; +;-------------------------------------------------------------------------------;AN000; +.ELSEIF AND ; else, if color printer ;AN000; +.IF ; and /B if OFF ;AN000; +.THEN ; ;AN000; + ; Store a null band mask ;AN000; + MOV XLT_TAB,0 ; the translation table. ;AN000; +.ENDIF ;AN000; + RET ;AN000; +SET_BACKG_IN_XLT_TAB ENDP ;AN000; +PAGE ;AN000; +;======================================================================= ;AN000; +; ;AN000; +; SET_EGA_XLT_TAB : SET UP COLOR TRANSLATION TABLE FOR ENHANCED GRAPHIC ;AN000; +; ADAPTER ;AN000; +; ;AN000; +;----------------------------------------------------------------------- ;AN000; +; ;AN000; +; INPUT: XLT_TAB = Color translation table. ;AN000; +; PRINTER_TYPE = Type of printer attached (Color or B&W) ;AN000; +; SWITCHES = GRAPHICS command line parameters. ;AN000; +; ;AN000; +; OUTPUT: XLT_TAB IS UPDATED ;AN000; +; ;AN000; +; CALLED BY: SET_UP_XLT_TABLE ;AN000; +; ;AN000; +;----------------------------------------------------------------------- ;AN000; +; ;AN000; +; NOTES: With the EGA, "VIDEO BIOS READ DOT call" returns an index into ;AN000; +; the 16 EGA palette registers. ;AN000; +; ;AN000; +; These registers contain the actual colors stored as rgbRGB components ;AN000; +; (see EGA_COL2RGB for details) for mode hex 10. Under mode hex E these ;AN000; +; registers contain the actual colors as I0RGB components (see CGA_COL2RGB ;AN000; +; for details). ;AN000; +; ;AN000; +; These registers can be Revised by the user but, are 'WRITE ONLY'. ;AN000; +; However, it is possible to define a SAVE AREA where BIOS will maintain ;AN000; +; a copy of the palette registers. ;AN000; +; ;AN000; +; This area is called the "DYNAMIC SAVE AREA" and is defined via the ;AN000; +; BIOS EGA SAVE_PTR AREA. Whenever the palette registers are changed by ;AN000; +; the user, BIOS updates the EGA_SAVE_AREA. ;AN000; +; ;AN000; +; The 16 palette registers are the first 16 bytes of the DYNAMIC SAVE AREA. ;AN000; +; ;AN000; +; This program takes advantage of this feature and consults the EGA DYNAMIC ;AN000; +; SAVE AREA in order to obtain the colors used in the active screen. ;AN000; +; ;AN000; +; ;AN000; +; DESCRIPTION: Obtain each color available with an EGA by reading its ;AN000; +; palette register in the EGA_SAVE_AREA: ;AN000; +; ;AN000; +; Calculate the mapping for this color, either a BAND_MASK or a ;AN000; +; GREY INTENSITY and store it in the color translation table. ;AN000; +; ;AN000; +; ;AN000; +; LOGIC: ;AN000; +; ;AN000; +; Obtain the DYNAMIC EGA SAVE AREA offset from the BIOS SAVE_PTR_AREA. ;AN000; +; ;AN000; +; If current mode is either 4,5 or 6 ;AN000; +; Then, ;AN000; +; CALL SET_CGA_XLT_TAB ;AN000; +; Get the background color by reading palette register number 0 ;AN000; +; Else, ;AN000; +; For each register number (0 to 15): ;AN000; +; Get the register contents (rgbRGB values) from the EGA SAVE AREA ;AN000; +; CALL EGA_COL2RGB ; Obtain the Red, Green, Blue values ;AN000; +; CALL RGB2XLT_TAB ; Obtain a Band Mask or a Grey Intensity ;AN000; +; ; and store the result in the XLT_TAB ;AN000; +; ;AN000; +SET_EGA_XLT_TAB PROC NEAR ;AN000; + PUSH AX ; Save the registers used ;AN000; + PUSH BX ;AN000; + PUSH CX ;AN000; + PUSH DX ;AN000; + PUSH DI ;AN000; + ;AN000; +;-------------------------------------------------------------------------------;AN000; +; ;AN000; +; Obtain the pointer to the DYNAMIC SAVE AREA from the SAVE AREA POINTER TABLE: ;AN000; +; ;AN000; +;-------------------------------------------------------------------------------;AN000; +EGA_SAVE_PTR EQU 4A8H ; EGA BIOS pointer to table of ;AN000; + ; pointer to save areas. ;AN000; + XOR AX,AX ; ES segment := paragraph 0 ;AN000; + MOV ES,AX ;AN000; + ;AN000; + LES BX,ES:DWORD PTR EGA_SAVE_PTR ; ES:BX := Pointer to ptr table ;AN000; + LES BX,ES:[BX]+4 ; ES:BX := Pointer to dynamic save area;AN000; + ; (NOTE: It is the second pointer in ;AN000; + ; the table) ;AN000; + ;AN000; +;-------------------------------------------------------------------------------;AN000; +; ;AN000; +; Set up one entry in the translation table for each color available. ;AN000; +; ;AN000; +;-------------------------------------------------------------------------------;AN000; +.IF OR ; If the current mode is an old CGA ;AN000; +.IF OR ; GRAPHICS mode: ;AN000; +.IF ;AN000; +.THEN ;AN000; +;-------------------------------------------------------------------------------;AN000; +; Current mode is either mode 4, 5 or 6; ;AN000; +; Store each color of the old CGA All Points Addressable mode: ;AN000; +;-------------------------------------------------------------------------------;AN000; + CALL SET_CGA_XLT_TAB ; Set up colors in the translation ;AN000; + ; table, NOTE: The background color ;AN000; + ; will not be set properly since the ;AN000; + ; EGA BIOS does not update memory ;AN000; + ; location 40:66 with the value ;AN000; + ; of the background color as CGA ;AN000; + ; does. ;AN000; +;------Adjust the background color in the translation table: ;AN000; +;------The background color is obtained from the EGA DYNAMIC SAVE AREA ;AN000; +;------ES:BX = Address of the EGA DYNAMIC SAVE AREA ;AN000; +;------NOTE : For CGA compatible modes EGA BIOS stores the color in the ;AN000; +;------DYNAMIC SAVE AREA as a I0RGB value. ;AN000; + XOR DI,DI ; DI:=register number = index in XLT_TAB;AN000; + MOV AL,ES:[BX][DI] ; AL:=Palette register 0 = Back. color ;AN000; + MOV AH,AL ; Convert I0RGB to IRGB (CGA color) ;AN001; + AND AL,111B ; Isolate RGB bits ;AN001; + AND AH,10000B ; Isolate I bit ;AN001; + SHR AH,1 ; Move I bit from position 5 to 4 ;AN001; + OR AL,AH ; Get IRGB byte. ;AN001; + CALL CGA_COL2RGB ; Convert IRGB to R,G,B values ;AN001; + CALL RGB2XLT_TAB ; Convert RGB to an entry in XLT_TAB ;AN000; + ;AN000; +.ELSE ; ELSE, we have an EGA graphics mode: ;AN000; +;-------------------------------------------------------------------------------;AN000; +; The current mode is a either a text mode or one of the EGA enhanced mode; ;AN000; +; Store in the translation table each color available (these modes have 16 col.);AN000; +;-------------------------------------------------------------------------------;AN000; + MOV CX,16 ; CX := Number of palette registers ;AN000; + ; to read ;AN000; + XOR DI,DI ; DI := Palette register number ;AN000; + ; and index in the translation table ;AN000; +STORE_1_EGA_COLOR: ;AN000; + MOV AL,ES:[BX][DI] ; AL := Palette register ;AN000; + .IF OR ; If mode E (hex) OR mode D (hex) ;AN000; + .IF ; the colors are ;AN000; + .THEN ; stored as I0CGA colors ;AN000; + MOV AH,AL ; Convert I0RGB to IRGB (CGA color) ;AN000; + AND AL,111B ; Isolate RGB bits ;AN000; + AND AH,10000B ; Isolate I bit ;AN000; + SHR AH,1 ; Move I bit from position 5 to 4 ;AN000; + OR AL,AH ; Get IRGB byte. ;AN000; + CALL CGA_COL2RGB ; Convert IRGB to R,G,B values ;AN000; + .ELSE ; Else, they are stored as (rgbRGB); ;AN000; + CALL EGA_COL2RGB ; Convert register to R,G,B values ;AN000; + .ENDIF ;AN000; + CALL RGB2XLT_TAB ; Convert RGB to an entry in XLT_TAB ;AN000; + INC DI ; Get next palette register number ;AN000; + LOOP STORE_1_EGA_COLOR ;AN000; +.ENDIF ; ENDIF 4 colors or 16 colors ;AN000; + ;AN000; + POP DI ; Restore the registers ;AN000; + POP DX ;AN000; + POP CX ;AN000; + POP BX ;AN000; + POP AX ;AN000; + RET ;AN000; +SET_EGA_XLT_TAB ENDP ;AN000; +PAGE ;AN000; +;======================================================================= ;AN000; +; ;AN000; +; SET_CGA_XLT_TAB : SET UP COLOR TRANSLATION TABLE FOR COLOR GRAPHIC ;AN000; +; ADAPTER ;AN000; +; ;AN000; +;----------------------------------------------------------------------- ;AN000; +; ;AN000; +; INPUT: XLT_TAB = Color translation table. ;AN000; +; PRINTER_TYPE = Type of printer attached (Color or B&W) ;AN000; +; SWITCHES = GRAPHICS command line parameters. ;AN000; +; ;AN000; +; OUTPUT: XLT_TAB IS UPDATED ;AN000; +; ;AN000; +; CALLED BY: SET_UP_XLT_TABLE ;AN000; +; ;AN000; +;----------------------------------------------------------------------- ;AN000; +; ;AN000; +; NOTES: With the CGA, the "VIDEO BIOS READ DOT call" returns a number ;AN000; +; from 0 to 3. A dot of value 0 is of the background color. ;AN000; +; ;AN000; +; The actual value of the background color is stored in BIOS VIDEO ;AN000; +; DISPLAY DATA AREA as a PIIRGB value (see CGA_COL2RGB for details) and ;AN000; +; can be any of 16 colors. ;AN000; +; ;AN000; +; A dot of value 1,2, or 3 represents any of 2 specific colors depending ;AN000; +; on the current color palette. ;AN000; +; ;AN000; +; The palette number is obtained from the BIOS VIDEO DISPLAY DATA AREA ;AN000; +; (It is the "P" bit or bit number 5) ;AN000; +; ;AN000; +; The dot values 1,2,3 expressed in binary actually represent the RG ;AN000; +; (Red, Green) components of the color. ;AN000; +; ;AN000; +; The palette number represents the B (Blue) component therefore, when ;AN000; +; the palette number is appended to the color number we obtain the RGB ;AN000; +; components for that color. ;AN000; +; ;AN000; +; (E.G., COLOR = 010 ; COLOR # 2 ;AN000; +; PALETTE= 0 ; PALETTE # 0 ;AN000; +; ;AN000; +; IRGB = 0100 ; Intensity = 0 Ŀ ;AN000; +; ; Red = 1 > color = Red ;AN000; +; ; Green = 0 ;AN000; +; ; Blue = 0 ;AN000; +; ;AN000; +; ;AN000; +; DESCRIPTION: ;AN000; +; ;AN000; +; For each color available with a CGA: ;AN000; +; Calculate the color mapping, either a BAND_MASK or a GREY ;AN000; +; INTENSITY and store it in the color translation table. ;AN000; +; ;AN000; +; LOGIC: ;AN000; +; ;AN000; +; ; Obtain the background color from VIDEO BIOS DATA AREA ;AN000; +; ; and the paletter number ;AN000; +; ;AN000; +; ; Store the Background color: ;AN000; +; CALL CGA_COL2RGB ; Convert IRGB components to RGB values ;AN000; +; CALL RGB2XLT_TAB ; Convert RGB to an entry in the translation ;AN000; +; ; table ;AN000; +; ; Store all other colors: ;AN000; +; FOR IRG := 1 TO 3 ; Obtain the color number ;AN000; +; Append palette number (B) to IRG ;AN000; +; CALL CGA_COL2RGB ; Convert color to RGB values ;AN000; +; CALL RGB2XLT_TAB ; Convert RGB to an entry in the translation ;AN000; +; ; table ;AN000; +; ;AN000; +SET_CGA_XLT_TAB PROC NEAR ;AN000; + PUSH AX ;AN000; + PUSH BX ;AN000; + PUSH CX ;AN000; + PUSH DI ;AN000; + PUSH ES ;AN000; + ;AN000; +.IF OR ;AN000; +.IF ;AN000; +;===============================================================================;AN000; +; ;AN000; +; THE CURRENT MODE IS MODE 4 OR 5 ;AN000; +; ;AN000; +;-------------------------------------------------------------------------------;AN000; +.THEN ;AN000; +;-------------------------------------------------------------------------------;AN000; +; Read the CRT palette from the BIOS ROM to obtain the background color and ;AN000; +; the current palette number; store the palette number in BL ;AN000; +;-------------------------------------------------------------------------------;AN000; +ROM_BIOS_SEG EQU 40H ; CGA BIOS SEGMENT ;AN000; +CRT_PALETTE_OFF EQU 66H ; BIOS Current palette setting ;AN000; +P_BIT_MASK EQU 100000B ; bit 5 = Current palette ;AN000; +I_BIT_MASK EQU 1000B ; bit 4 = Intensity bit ;AN000; +R_BIT_MASK EQU 100B ; bit 2 = Red bit ;AN000; +G_BIT_MASK EQU 10B ; bit 1 = Green bit ;AN000; +B_BIT_MASK EQU 1B ; bit 0 = Blue bit ;AN000; + ;AN000; + MOV AX,ROM_BIOS_SEG ; ES := ROM BIOS SEGMENT ;AN000; + PUSH AX ;AN000; + POP ES ;AN000; + ;AN000; + MOV AL,ES:CRT_PALETTE_OFF; AL := CRT Palette (00PIIRGB) ;AN000; + MOV BL,P_BIT_MASK ; LOW NIBBLE = BACKGROUND COLOR ;AN000; + AND BL,AL ; BL := Palette number ;AN000; + MOV CL,5 ;AN000; + SHR BL,CL ;AN000; + ;AN000; + XOR DI,DI ; DI := Index in the XLT_TAB ;AN000; +;-------------------------------------------------------------------------------;AN000; +; Store the background color, (obtained from low 4 bits of the byte at 40:66) ;AN000; +;-------------------------------------------------------------------------------;AN000; + CALL CGA_COL2RGB ; Convert color (in AL) to R, G, B values ;AN000; + CALL RGB2XLT_TAB ; Convert RGB to an entry in XLT_TAB ;AN000; +;-------------------------------------------------------------------------------;AN000; +; Store the 3 foreground colors for mode 4 and 5 ;AN000; +;-------------------------------------------------------------------------------;AN000; + MOV CX,3 ; For each color, but the background: ;AN000; +STORE_1_CGA_MODE4_COLOR: ;AN000; + INC DI ; Increment index in the translation table ;AN000; + MOV AX,DI ; AL := IRG ;AN000; + SHL AL,1 ;AN000; + OR AL,BL ; AL := IRGB ;AN000; + CALL CGA_COL2RGB ; Convert color (in AL) to R, G, B values ;AN000; + CALL RGB2XLT_TAB ; Convert RGB to an entry in XLT_TAB ;AN000; + LOOP STORE_1_CGA_MODE4_COLOR ;AN000; +.ELSEIF ;AN000; +;===============================================================================;AN000; +; ;AN000; +; THE CURRENT MODE IS MODE 6 ;AN000; +; ;AN000; +;-------------------------------------------------------------------------------;AN000; +.THEN ;AN000; +;-------------------------------------------------------------------------------;AN000; +; Store background color for mode 6 (mode 6 is a 2 colors, APA mode) ;AN000; +; Background is stored as BLACK ;AN000; +;-------------------------------------------------------------------------------;AN000; + XOR DI,DI ; DI := Index of color in translation table ;AN000; + MOV RGB.R,BLACK_INT ; Foreground color is white ;AN000; + MOV RGB.G,BLACK_INT ; RGB := RGB of white ;AN000; + MOV RGB.B,BLACK_INT ; ;AN000; + CALL RGB2XLT_TAB ; Convert RGB to an entry in XLT_TAB ;AN000; +;-------------------------------------------------------------------------------;AN000; +; Store foreground color for mode 6 (mode 6 is a 2 colors, APA mode) ;AN000; +;-------------------------------------------------------------------------------;AN000; + INC DI ; DI := Index of color in translation table ;AN000; + MOV RGB.R,WHITE_INT ; Background color is BLACK ;AN000; + MOV RGB.G,WHITE_INT ; RGB := RGB of BLACK ;AN000; + MOV RGB.B,WHITE_INT ; ;AN000; + CALL RGB2XLT_TAB ; Convert RGB to an entry in XLT_TAB ;AN000; +.ELSE ;AN000; +;===============================================================================;AN000; +; ;AN000; +; THE CURRENT MODE IS A TEXT MODE: ;AN000; +; ;AN000; +;-------------------------------------------------------------------------------;AN000; + XOR DI,DI ; DI := Index in the translation table ;AN000; + MOV CX,16 ; For each of the 16 colors: ;AN000; +STORE_1_CGA_TEXT_COLOR: ;AN000; + MOV AX,DI ; AL := IRGB ;AN000; + CALL CGA_COL2RGB ; Convert color (in AL) to R, G, B values ;AN000; + CALL RGB2XLT_TAB ; Convert RGB to an entry in XLT_TAB ;AN000; + INC DI ; Increment index in the translation table ;AN000; + LOOP STORE_1_CGA_TEXT_COLOR ;AN000; +.ENDIF ; ;AN000; + ;AN000; + POP ES ;AN000; + POP DI ;AN000; + POP CX ;AN000; + POP BX ;AN000; + POP AX ;AN000; + ;AN000; + RET ;AN000; +SET_CGA_XLT_TAB ENDP ;AN000; +PAGE ;AN000; +;===============================================================================;AN000; +; ;AN000; +; RGB2XLT_TAB: CONVERT R,G,B VALUES TO EITHER A BAND MASK OR AN INTENSITY ;AN000; +; STORE THE RESULT IN THE TRANSLATION TABLE ;AN000; +; ;AN000; +;-------------------------------------------------------------------------------;AN000; +; ;AN000; +; INPUT: DI = Index in the translation table ;AN000; +; RGB = Red Green Blue values of the color to be stored. ;AN000; +; ;AN000; +; OUTPUT: XLT_TAB is updated ;AN000; +; ;AN000; +;-------------------------------------------------------------------------------;AN000; +; DESCRIPTION: Convert the RGB values to either a Band mask or an intensity ;AN000; +; depending on the printer type; store the result in the translation table. ;AN000; +; ;AN000; +; LOGIC: ;AN000; +; IF PRINTER_TYPE = COLOR ;AN000; +; THEN ;AN000; +; CALL RGB2BAND ; Obtain a Band Mask ;AN000; +; ELSE ; Printer is Monochrome ;AN000; +; CALL RGB2INT ; Obtain a Grey Intensity ;AN000; +; Store the result in the XLT_TAB ;AN000; +; ;AN000; +RGB2XLT_TAB PROC NEAR ;AN000; + .IF ; Color printer ? ;AN000; + .THEN ;AN000; +;-------A color printer is attached: ;AN000; + CALL RGB2BAND ; Yes, convert RGB to color band (in AL);AN000; + .ELSE ;AN000; +;-------A black and white printer is attached: ;AN000; + CALL RGB2INT ; No, RGB to an intensity in AL ;AN000; + .ENDIF ;AN000; +;-------Store the result ;AN000; + MOV XLT_TAB[DI],AL ;AN000; + RET ;AN000; +RGB2XLT_TAB ENDP ;AN000; +PAGE ;AN000; +;===============================================================================;AN000; +; ;AN000; +; CGA_COL2RGB : CONVERT A COLOR FROM THE CGA TO RED GREEN BLUE VALUES ;AN000; +; ;AN000; +;-------------------------------------------------------------------------------;AN000; +; ;AN000; +; INPUT: AL = 0000IRGB ONE BYTE WHERE BIT: ;AN000; +; ;AN000; +; I = Intensity bit ;AN000; +; R = Red component ;AN000; +; G = Green component ;AN000; +; B = Blue component ;AN000; +; ;AN000; +; ;AN000; +; OUTPUT: RGB.R = RED component (0-63) ;AN000; +; RGB.G = GREEN component (0-63) ;AN000; +; RGB.B = BLUE component (0-63) ;AN000; +; ;AN000; +; CALLED BY: SET_UP_CGA_XLT_TABLE ;AN000; +; ;AN000; +;----------------------------------------------------------------------- ;AN000; +; ;AN000; +; DESCRIPTION: If either the RED, GREEN, or BLUE bit is on (in an IRGB ;AN000; +; byte) then, the corresponding color gun on the display is firing 2/3 ;AN000; +; of its capacity, giving a color intensity of "2/3". ;AN000; +; ;AN000; +; If the INTENSITY bit is on, then 1/3 is added to EACH color. ;AN000; +; ;AN000; +; (E.G., IRGB R G B ;AN000; +; BLACK = 00000000 ( 0, 0, 0) ;AN000; +; WHITE = 00001111 (3/3, 3/3, 3/3) ;AN000; +; RED = 00000100 (2/3, 0, 0) ;AN000; +; HIGH INT. RED = 00001100 (3/3, 1/3, 1/3) ;AN000; +; ;AN000; +; Since we want an intensity from 0 to 63, ;AN000; +; "2/3" of RED means: ;AN000; +; 2/3 * 63 = 42 ;AN000; +; ;AN000; +; ;AN000; +; LOGIC: ;AN000; +; Get the intensity. ;AN000; +; Get the red component ;AN000; +; Get the green component ;AN000; +; Get the blue component ;AN000; +; ;AN000; +CGA_COL2RGB PROC NEAR ;AN000; +;----------------------------------------------------------------------- ;AN000; +; ;AN000; +; Init the R,G,B values: ;AN000; +; ;AN000; +;----------------------------------------------------------------------- ;AN000; + MOV RGB.R,0 ;AN000; + MOV RGB.G,0 ;AN000; + MOV RGB.B,0 ;AN000; +;----------------------------------------------------------------------- ;AN000; +; ;AN000; +; Test the Intensity bit: ;AN000; +; ;AN000; +;----------------------------------------------------------------------- ;AN000; + .IF ; IF, I is on ;AN000; + .THEN ;AN000; + ADD RGB.R,ONE_THIRD ; Then, add one third to each ;AN000; + ADD RGB.G,ONE_THIRD ; color. ;AN000; + ADD RGB.B,ONE_THIRD ;AN000; + .ENDIF ;AN000; +;----------------------------------------------------------------------- ;AN000; +; ;AN000; +; Test the RGB bits: ;AN000; +; ;AN000; +;----------------------------------------------------------------------- ;AN000; + .IF ; If, Red is on ;AN000; + .THEN ;AN000; + ADD RGB.R,TWO_THIRD ; then, add two third RED ;AN000; + .ENDIF ;AN000; + ;AN000; + .IF ; If, Green is on ;AN000; + .THEN ;AN000; + ADD RGB.G,TWO_THIRD ; then, add two third GREEN ;AN000; + .ENDIF ;AN000; + ;AN000; + .IF ; If, Blue is on ;AN000; + .THEN ;AN000; + ADD RGB.B,TWO_THIRD ; then, add two third BLUE ;AN000; + .ENDIF ;AN000; + ;AN000; + RET ;AN000; +CGA_COL2RGB ENDP ;AN000; +PAGE ;AN000; +;======================================================================= ;AN000; +; ;AN000; +; SET_MODE_F_XLT_TAB: SET UP COLOR TRANSLATION TABLE FOR MONOCHROME ;AN000; +; MODE "F" ;AN000; +; ;AN000; +;----------------------------------------------------------------------- ;AN000; +; ;AN000; +; INPUT: XLT_TAB = Color translation table. ;AN000; +; PRINTER_TYPE = Type of printer attached (Color or B&W) ;AN000; +; SWITCHES = GRAPHICS command line parameters. ;AN000; +; ;AN000; +; OUTPUT: XLT_TAB IS UPDATED ;AN000; +; ;AN000; +; CALLED BY: SET_UP_XLT_TABLE ;AN000; +; ;AN000; +;-------------------------------------------------------------------------------;AN000; +; ;AN000; +; NOTES: In mode F the "VIDEO BIOS READ DOT call" returns a byte where ;AN000; +; bit 1 and 3 represent the value of plane 1 and 3. ;AN000; +; The following colors are available using this mode: ;AN000; +; ;AN000; +; plane 2: plane 0: color: ;AN000; +; 0 0 black ;AN000; +; 0 1 white ;AN000; +; 1 0 blinking white ;AN000; +; 1 1 high-intensity white ;AN000; +; ;AN000; +; ;AN000; +; DESCRIPTION: A local table holds the Red, Green, Blue values for each of ;AN000; +; the 4 Mono colors available in Mode Fh. ;AN000; +; Each color is stored as either a Grey intensity if printing in Monochrome ;AN000; +; or as a Band Mask if printing in color. ;AN000; +; Black is stored as black. ;AN000; +; White is stored as a light gray ;AN000; +; High-intensity white and blinking white are stored as white. ;AN000; +; ;AN000; +; ;AN000; +; LOGIC: ;AN000; +; FOR EACH "COLOR" AVAILABLE WITH MODE F ;AN000; +; GET ITS R,G,B VALUES ;AN000; +; CALL RGB2XLT_TAB ; Convert RGB to an entry in the translation ;AN000; +; ; table ;AN000; +; ;AN000; +SET_MODE_F_XLT_TAB PROC NEAR ;AN000; + PUSH AX ;AN000; + PUSH SI ;AN000; + PUSH DI ;AN000; + JMP SHORT SET_MODE_F_BEGIN ;AN000; +;-------------------------------------------------------------------------------;AN000; +; ;AN000; +; TABLE OF R,G,B VALUES WE ASSIGN TO THE 4 COLORS AVAILABLE IN MODE F: ;AN000; +; ;AN000; +;-------------------------------------------------------------------------------;AN000; +MODE_F_RGB LABEL BYTE ;AN000; + DB BLACK_INT,BLACK_INT,BLACK_INT ; Black is mapped to black. ;AN000; + DB TWO_THIRD,TWO_THIRD,TWO_THIRD ; White --> light grey ;AN000; + DB WHITE_INT,WHITE_INT,WHITE_INT ; Blinking --> white ;AN000; + DB WHITE_INT,WHITE_INT,WHITE_INT ; High-int. White --> white ;AN000; +;-------------------------------------------------------------------------------;AN000; +; ;AN000; +; STORE THE COLORS AVAILABLE WITH MODE F ;AN000; +; ;AN000; +;-------------------------------------------------------------------------------;AN000; +SET_MODE_F_BEGIN: ;AN000; + MOV SI,OFFSET MODE_F_RGB ; SI <-- Offset of RGB table ;AN000; + XOR DI,DI ; DI <-- Index into translation table ;AN000; + ;AN000; +;-------For each color available in mode F: ;AN000; +STORE_1_MODE_F_COLOR: ;AN000; + MOV AL,[SI] ; Get the Red component ;AN000; + MOV RGB.R,AL ;AN000; + MOV AL,[SI]+1 ; Get the Green component ;AN000; + MOV RGB.G,AL ;AN000; + MOV AL,[SI]+2 ; Get the Blue component ;AN000; + MOV RGB.B,AL ;AN000; + ;AN000; +;-------Convert pixel to either a Color band or an Intensity: ;AN000; + CALL RGB2XLT_TAB ; Convert and store in the xlt table ;AN000; + ;AN000; + ADD SI,3 ; Get next R,G,B values ;AN000; + INC DI ; One more color has been stored ;AN000; + CMP DI,NB_COLORS ; All stored ? ;AN000; + JL STORE_1_MODE_F_COLOR ;AN000; + ;AN000; + POP DI ;AN000; + POP SI ;AN000; + POP AX ;AN000; + RET ;AN000; +SET_MODE_F_XLT_TAB ENDP ;AN000; +PAGE ;AN000; +;======================================================================= ;AN000; +; ;AN000; +; SET_MODE_13H_XLT_TAB: SET UP COLOR TRANSLATION TABLE FOR PALACE VIDEO ;AN000; +; ADAPTER IN MODE 13H ;AN000; +; ;AN000; +;----------------------------------------------------------------------- ;AN000; +; ;AN000; +; INPUT: XLT_TAB = Color translation table. ;AN000; +; PRINTER_TYPE = Type of printer attached (Color or B&W) ;AN000; +; SWITCHES = GRAPHICS command line parameters. ;AN000; +; ;AN000; +; OUTPUT: XLT_TAB IS UPDATED ;AN000; +; ;AN000; +; CALLED BY: SET_UP_XLT_TABLE ;AN000; +; ;AN000; +;----------------------------------------------------------------------- ;AN000; +; ;AN000; +; NOTES: With the PALACE the "VIDEO BIOS READ DOT call" returns a direct ;AN000; +; index to the 256 COLOR REGISTERS. ;AN000; +; ;AN000; +; These COLORS REGISTERS hold the R,G,B (Red, Green, Blue) values for ;AN000; +; each of the 256 colors available at the same time on the screen. ;AN000; +; Color register number 0 holds the background color. ;AN000; +; ;AN000; +; DESCRIPTION: Store a color mapping for each color register. ;AN000; +; If the REVERSE_SW is off, exchange white and black. ;AN000; +; ;AN000; +; LOGIC: ;AN000; +; ;AN000; +; For each color (0 to 255) ;AN000; +; Read the color register ; get the RGB values for this color num. ;AN000; +; Store the result in the XLT_TAB ;AN000; +; ;AN000; +SET_MODE_13H_XLT_TAB PROC NEAR ;AN000; + PUSH AX ;AN000; + PUSH BX ;AN000; + PUSH CX ;AN000; + PUSH DX ;AN000; + PUSH DI ;AN000; + ;AN000; + MOV NB_COLORS_TO_READ,256 ; Read 256 color registers ;AN000; + ;AN000; +;-------------------------------------------------------------------------------;AN000; +; ;AN000; +; Store in the translation table each color available for mode 13h: ;AN000; +; ;AN000; +;-------------------------------------------------------------------------------;AN000; + XOR DI,DI ; DI := Palette register number ;AN000; + ; and index in the translation table ;AN000; +STORE_1_M13H_COLOR: ;AN000; + MOV BX,DI ; BX := Color register to be read ;AN000; + MOV AX,GET_C_REG_CALL ; AX := BIOS Get color register call ;AN000; + INT 10H ; Call BIOS ;AN000; + MOV RGB.R,DH ; Get Red value ;AN000; + MOV RGB.G,CH ; Get Green value ;AN000; + MOV RGB.B,CL ; Get Blue value ;AN000; + CALL RGB2XLT_TAB ; Convert RGB to an entry in XLT_TAB ;AN000; + INC DI ; Get next palette register number ;AN000; + CMP DI,NB_COLORS_TO_READ ; All colors stored ? ;AN000; + JL STORE_1_M13H_COLOR ; No, get next one ;AN000; + ;AN000; + ;AN000; + POP DI ;AN000; + POP DX ;AN000; + POP CX ;AN000; + POP BX ;AN000; + POP AX ;AN000; + RET ;AN000; +NB_COLORS_TO_READ DW ? ; Number of colors registers to read with a PS/2;AN000; +SET_MODE_13H_XLT_TAB ENDP ;AN000; +PAGE ;AN000; +;===============================================================================;AN000; +; ;AN000; +; SET_ROUNDUP_XLT_TAB: SET UP COLOR TRANSLATION TABLE FOR ROUNDUP VIDEO ;AN000; +; ADAPTER ;AN000; +; ;AN000; +;-------------------------------------------------------------------------------;AN000; +; ;AN000; +; INPUT: XLT_TAB = Color translation table. ;AN000; +; PRINTER_TYPE = Type of printer attached (Color or B&W) ;AN000; +; SWITCHES = GRAPHICS command line parameters. ;AN000; +; ;AN000; +; OUTPUT: XLT_TAB IS UPDATED ;AN000; +; ;AN000; +; CALLED BY: SET_UP_XLT_TABLE ;AN000; +; ;AN000; +;-------------------------------------------------------------------------------;AN000; +; ;AN000; +; NOTES: With the ROUNDUP the "VIDEO BIOS READ DOT call" returns an ;AN000; +; index into the 16 PALETTE REGISTERS. ;AN000; +; ;AN000; +; Each palette register holds an index into the current "color page" ;AN000; +; within the 256 COLOR REGISTERS. ;AN000; +; ;AN000; +; These "color pages" represent all the colors from WHICH TO CHOOSE the ;AN000; +; screen colors for an active page; 16 colors can be displayed at the ;AN000; +; same time on the screen. ;AN000; +; ;AN000; +; There are 2 paging modes: either 64 color pages or 16 color pages: ;AN000; +; ;AN000; +; In 64 color mode, there are 4 color pages available (the 256 palette ;AN000; +; registers are partitioned in 4 blocks of 64 colors). ;AN000; +; ;AN000; +; The 16 screen colors for the active page are selected from these 64 ;AN000; +; color registers. ;AN000; +; ;AN000; +; This scheme allows for quickly changing the contents of the screen by ;AN000; +; changing the active page. ;AN000; +; ;AN000; +; The COLOR REGISTERS contains the color information stored as RGB (Red, ;AN000; +; Green, Blue) components. There is one byte for each of these 3 ;AN000; +; components. The value for each component ranges from 0 to 63 (where ;AN000; +; 0 = color not present). ;AN000; +; ;AN000; +; ;AN000; +; DESCRIPTION: Determine the paging mode and the active color page. ;AN000; +; For each color available with the current mode, get the palette ;AN000; +; register and then, read the corresponding color register in order to ;AN000; +; obtain its RGB components. ;AN000; +; ;AN000; +; For mode 11h, 2 colors only are available. These colors are obtained from ;AN000; +; palette register 0 (background) and 7 (foreground color). The contents ;AN000; +; of these 2 palette registers is also used as an index within the color ;AN000; +; registers. ;AN000; +; ;AN000; +; If printing is Monochrome, map the RGB to a Grey Intensity. ;AN000; +; If printing is in colors, map the RGB to a Band Mask. ;AN000; +; Store the result in the translation table ;AN000; +; ;AN000; +; LOGIC: ;AN000; +; ;AN000; +; Read color page state (BIOS INT 10H - AL = 1AH) ;AN000; +; ;AN000; +; If mode 4,5 or 6 ;AN000; +; Then ;AN000; +; CALL SET_CGA_XLT_TAB ;AN000; +; Adjust the background color. ;AN000; +; else ;AN000; +; If mode 11h ;AN000; +; then ;AN000; +; For PALETTE_INDEX := 0 to 15 ;AN000; +; IF PAGE_MODE = PAGE_64_REGISTERS ;AN000; +; THEN ;AN000; +; Read the palette register number "PALETTE_INDEX" ;AN000; +; COLOR_INDEX := Palette register contents ;AN000; +; COLOR_INDEX := (CUR_PAGE_NUM * 64) + COLOR_INDEX ;AN000; +; Read color register number "COLOR_INDEX" ; Obtain R,G,B values. ;AN000; +; CALL RGB2XLT_TAB ; Convert RGB to an entry in XLT_TAB ;AN000; +; ;AN000; +; ELSE IF PAGE_MODE = PAGE_16_REGISTERS ;AN000; +; COLOR_INDEX := (CUR_PAGE_NUM * 16) + PALETTE_INDEX ;AN000; +; Read color register number "COLOR_INDEX" ;AN000; +; CALL RGB2XLT_TAB ; Convert RGB to an entry in XLT_TAB ;AN000; +; ;AN000; +; ;AN000; +SET_ROUNDUP_XLT_TAB PROC NEAR ;AN000; +PAGING_MODE_64 EQU 0 ;AN000; + ;AN000; + PUSH AX ;AN000; + PUSH BX ;AN000; + PUSH CX ;AN000; + PUSH DI ;AN000; + ;AN000; +;-------------------------------------------------------------------------------;AN000; +; Obtain the color page state ;AN000; +;-------------------------------------------------------------------------------;AN000; + MOV AX,PAGE_STATE_CALL ; Call BIOS ;AN000; + INT 10H ; BL := Paging mode ;AN000; + ; BH := Current page ;AN000; + ;AN000; +;-------------------------------------------------------------------------------;AN000; +; Check the video mode: ;AN000; +;-------------------------------------------------------------------------------;AN000; +.SELECT ;AN000; +.WHEN OR ; If the current mode is an old CGA ;AN000; +.WHEN OR ; mode: ;AN000; +.WHEN ; ;AN000; +;-------------------------------------------------------------------------------;AN000; +; ;AN000; +; Old CGA graphics mode (mode 4, 5 or 6) ;AN000; +; ;AN000; +;-------------------------------------------------------------------------------;AN000; +;-------------------------------------------------------------------------------;AN000; +; Store colors of the old CGA modes: ;AN000; +;-------------------------------------------------------------------------------;AN000; + CALL SET_CGA_XLT_TAB ; Set up colors in the translation ;AN000; + ; table, NOTE: The background color ;AN000; + ; will not be set properly since the ;AN000; + ; PS/2 BIOS does not update memory ;AN000; + ; location 40:66 with the value ;AN000; + ; of the background color as CGA ;AN000; + ; does for modes 4 and 5. However ;AN000; + ; 40:66 holds the current palette;AN000; + ; selected. ;AN000; +;-------------------------------------------------------------------------------;AN000; +; Adjust the background color for modes 4,5 or 6 ;AN000; +;-------------------------------------------------------------------------------;AN000; + MOV PAL_REGISTER_NB,0 ; Read the palette register number 0 ;AN000; + CALL GET_PALETTE_RGB ; this register points to the color ;AN000; + ; register that contains the RGB ;AN000; + ; values of the BACKGROUND color. ;AN000; + MOV DI,0 ; DI := Index in the translation table ;AN000; + CALL RGB2XLT_TAB ; Store mapping in the translation table;AN000; + ;AN000; +.WHEN ;AN000; +;-------------------------------------------------------------------------------;AN000; +; ;AN000; +; Mode 11h (2 colors out of 256,000 colors) ;AN000; +; ;AN000; +;-------------------------------------------------------------------------------;AN000; +;-------------------------------------------------------------------------------;AN000; +; Get the background color: ;AN000; +;-------------------------------------------------------------------------------;AN000; + MOV PAL_REGISTER_NB,0 ; Read the palette register number 0 ;AN000; + CALL GET_PALETTE_RGB ; Get the RGB values for this color ;AN000; + MOV DI,0 ; DI := Index in translation table ;AN000; + CALL RGB2XLT_TAB ; Store mapping in the translation table;AN000; +;-------------------------------------------------------------------------------;AN000; +; Get the foreground color: ;AN000; +;-------------------------------------------------------------------------------;AN000; + MOV PAL_REGISTER_NB,7 ; Read the palette register for the ;AN000; + ; FOREGROUND color (palette register 7);AN000; + CALL GET_PALETTE_RGB ; Get the RGB values for this color ;AN000; + MOV DI,1 ; DI := Index in translation table ;AN000; + CALL RGB2XLT_TAB ; Store mapping in the translation table;AN000; +.OTHERWISE ;AN000; +;-------------------------------------------------------------------------------;AN000; +; ;AN000; +; The current mode is a 16 color mode ;AN000; +; ;AN000; +;-------------------------------------------------------------------------------;AN000; + XOR DI,DI ; DI := Index in translation table ;AN000; + MOV CX,16 ; 16 colors to read and store ;AN000; + MOV PAL_REGISTER_NB,0 ; Palette register to read ;AN000; +STORE_1_PS2_COLOR: ;AN000; + CALL GET_PALETTE_RGB ; Get the RGB values for this color ;AN000; +; ;AN000; +;-------Convert the RGB values to band mask or intensity and store in XLT_TAB: ;AN000; + ;AN000; + CALL RGB2XLT_TAB ; Store mapping in the translation table;AN000; + INC DI ; Get next palette register number ;AN000; + INC PAL_REGISTER_NB ; ;AN000; + LOOP STORE_1_PS2_COLOR ; Read it. ;AN000; +.ENDSELECT ;AN000; + ;AN000; + POP DI ;AN000; + POP CX ;AN000; + POP BX ;AN000; + POP AX ;AN000; + RET ;AN000; +PAL_REGISTER_NB DB ? ; Number of the palette register to read;AN000; +SET_ROUNDUP_XLT_TAB ENDP ;AN000; + ;AN000; +PAGE ;AN000; +;===============================================================================;AN000; +; ;AN000; +; GET_PALETTE_RGB: ON THE PS/2 MODEL 50, 60 AND 80, GET THE RGB VALUES FOR A ;AN000; +; PALETTE REGISTER BY READING THE CORRESPONDING COLOR REGISTER;AN000; +; ;AN000; +;-------------------------------------------------------------------------------;AN000; +; ;AN000; +; INPUT: PAL_REGISTER_NB = Palette register number ;AN000; +; BH = Current page number ;AN000; +; BL = Current paging mode ;AN000; +; ;AN000; +; OUTPUT: RGB.R = The RGB values obtained from the color register;AN000; +; RGB.G corresponding to the palette register specified;AN000; +; RGB.B ;AN000; +; ;AN000; +; CALLED BY: SET_ROUNDUP_XLT_TAB ;AN000; +; ;AN000; +;-------------------------------------------------------------------------------;AN000; +GET_PALETTE_RGB PROC ;AN000; + PUSH AX ;AN000; + PUSH BX ;AN000; + PUSH CX ;AN000; + PUSH DX ;AN000; + PUSH SI ;AN000; + ;AN000; + MOV AL,BH ; SI := Current page number ;AN000; + CBW ; ;AN000; + MOV SI,AX ; ;AN000; +;-------------------------------------------------------------------------------;AN000; +; ;AN000; +; Calculte the absolute number of the first Color Register for the current page:;AN000; +; (calculated in SI) ;AN000; +; ;AN000; +;-------------------------------------------------------------------------------;AN000; +.IF ; If mode is 64 Color page ;AN000; +.THEN ; then ;AN000; + MOV CL,6 ; SI := Current page num * 64 ;AN000; + SHL SI,CL ; ;AN000; +.ELSE ; else, Mode is 16 Color page ;AN000; + MOV CL,4 ; SI := Current page num * 16 ;AN000; + SHL SI,CL ; ;AN000; +.ENDIF ;AN000; + ;AN000; +; ;AN000; +;-------Read the PALETTE REGISTER ;AN000; + MOV BL,PAL_REGISTER_NB ; BL := Palette register to be read ;AN000; + MOV AX,GET_P_REG_CALL ; Read palette register call ;AN000; + INT 10H ; Call BIOS, ;AN000; + ; BH := Color register index ;AN000; + ; WITHIN the current page and is;AN000; + ; either (0-15) or (0-63) ;AN000; + ; NOTE: SI = Absolute index (0-255) to ;AN000; + ; the first color register of the ;AN000; + ; current page and is a multiple of ;AN000; + ; either 16 or 64 ;AN000; + MOV BL,BH ; BX := Index within current color page ;AN000; + XOR BH,BH ; ;AN000; + ;AN000; +; ;AN000; +;-------Read the Color register: ;AN000; + OR BX,SI ; BX := Index of Color register to read ;AN000; + MOV AX,GET_C_REG_CALL ; Read the color register ;AN000; + INT 10H ; Call BIOS, ;AN000; + MOV RGB.R,DH ; DH := Red value read ;AN000; + MOV RGB.G,CH ; CH := Green value read ;AN000; + MOV RGB.B,CL ; CL := Blue value read ;AN000; + ;AN000; + POP SI ;AN000; + POP DX ;AN000; + POP CX ;AN000; + POP BX ;AN000; + POP AX ;AN000; + RET ;AN000; +GET_PALETTE_RGB ENDP ;AN000; +PAGE ;AN000; +;======================================================================= ;AN000; +; ;AN000; +; EGA_COL2RGB : CONVERT A COLOR FROM THE EGA TO RED GREEN BLUE VALUES ;AN000; +; ;AN000; +;----------------------------------------------------------------------- ;AN000; +; ;AN000; +; INPUT: AL = 00rgbRGB ONE BYTE WHERE BIT: ;AN000; +; ;AN000; +; r = 1/3 of Red component ;AN000; +; g = 1/3 of Green component ;AN000; +; b = 1/3 of Blue component ;AN000; +; R = 2/3 of Red component ;AN000; +; G = 2/3 of Green component ;AN000; +; B = 3/3 of Blue component ;AN000; +; ;AN000; +; ;AN000; +; OUTPUT: RGB.R = RED component (0-63) ;AN000; +; RGB.G = GREEN component (0-63) ;AN000; +; RGB.B = BLUE component (0-63) ;AN000; +; ;AN000; +; CALLED BY: SET_UP_EGA_XLT_TABLE ;AN000; +; ;AN000; +;----------------------------------------------------------------------- ;AN000; +; ;AN000; +; DESCRIPTION: Sums up the values for each color component. ;AN000; +; "2/3 of RED" means that the red gun in the display attached to the EGA ;AN000; +; is firing at 2/3 of full intensity. ;AN000; +; ;AN000; +; Since the color intensities range from 0 to 63, "1/3" means an ;AN000; +; intensity of: ;AN000; +; 1/3 * 63 = 21 ;AN000; +; ;AN000; +; LOGIC: ;AN000; +; ;AN000; +; Get the red component ;AN000; +; Get the green component ;AN000; +; Get the blue component ;AN000; +; ;AN000; +EGA_COL2RGB PROC NEAR ;AN000; +; ;AN000; +;-------Get the RED component (bit 5 and 2) ;AN000; +; ;AN000; +;-------Check bit 2 ;AN000; + MOV RGB.R,0 ;AN000; + TEST AL,100B ; "R" is on ? ;AN000; + JZ CHECK_BIT_5 ; No, check "r" ;AN000; + ADD RGB.R,TWO_THIRD ; Yes, add 2/3 RED ;AN000; +CHECK_BIT_5: ;AN000; + TEST AL,100000B ; "r" is on ? ;AN000; + JZ CHECK_BIT_1 ; No, check Green ;AN000; + ADD RGB.R,ONE_THIRD ; Yes, add 1/3 RED ;AN000; +; ;AN000; +;-------Get the GREEN component (bit 4 and 1) ;AN000; +; ;AN000; +CHECK_BIT_1: ;AN000; + MOV RGB.G,0 ;AN000; + TEST AL,10B ; "G" is on ? ;AN000; + JZ CHECK_BIT_4 ; No, check "g" ;AN000; + ADD RGB.G,TWO_THIRD ; Yes, add 2/3 GREEN ;AN000; +CHECK_BIT_4: ;AN000; + TEST AL,10000B ; "g" is on ? ;AN000; + JZ CHECK_BIT_0 ; No, check for Blue ;AN000; + ADD RGB.G,ONE_THIRD ; Yes, add 1/3 GREEN ;AN000; +; ;AN000; +;-------Get the BLUE component (bit 3 and 0) ;AN000; +; ;AN000; +CHECK_BIT_0: ;AN000; + MOV RGB.B,0 ;AN000; + TEST AL,1B ; "B" is on ? ;AN000; + JZ CHECK_BIT_3 ; No, check "b" ;AN000; + ADD RGB.B,TWO_THIRD ; Yes, add 2/3 BLUE ;AN000; +CHECK_BIT_3: ;AN000; + TEST AL,1000B ; "b" is on ? ;AN000; + JZ EGA_COL2RGB_RETURN ; No, return ;AN000; + ADD RGB.B,ONE_THIRD ; Yes, add 1/3 BLUE ;AN000; +EGA_COL2RGB_RETURN: ;AN000; + RET ;AN000; +EGA_COL2RGB ENDP ;AN000; + ;AN000; +PAGE ;AN000; +;===============================================================================;AN000; +; ;AN000; +; RGB2INT : MAP RED GREEN BLUE VALUES TO AN INTENSITY. ;AN000; +; ;AN000; +;-------------------------------------------------------------------------------;AN000; +; ;AN000; +; INPUT: RGB.R = A RED value (0-63) ;AN000; +; RGB.G = A GREEN value (0-63) ;AN000; +; RGB.B = A BLUE value (0-63) ;AN000; +; DARKADJUST_VALUE= THE DARKNESS VALUE (In shared data area). ;AN000; +; SWITCHES = Command line switches ;AN000; +; ;AN000; +; OUTPUT: AL = THE INTENSITY (0-63) NOTE: 0 = BLACK ;AN000; +; 63 = BRIGHT WHITE ;AN000; +; ;AN000; +; WARNING: AH IS LOST ;AN000; +; ;AN000; +;-------------------------------------------------------------------------------;AN000; +; ;AN000; +; DESCRIPTION: When the RGB values for a pixel are at their maximum ;AN000; +; value, what we obtain is a bright white pixel on the screen; this is ;AN000; +; the brightest color achievable and therefore, its intensity is 63. ;AN000; +; ;AN000; +; When no color gun is firing on the display: RGB values are 0,0,0 this ;AN000; +; is no color at all and therefore maps to intensity 0. ;AN000; +; ;AN000; +; For intermediate colors, experimentation has shown that the eye will ;AN000; +; see blue as darker than red and red as darker than green. ;AN000; +; ;AN000; +; On a grey rainbow from 0 - 10 where 0 is black and 10 is white: ;AN000; +; ;AN000; +; Blue corresponds to a grey of intensity 1 ;AN000; +; Red corresponds to a grey of intensity 3 ;AN000; +; Green corresponds to a grey of intensity 6 ;AN000; +; ;AN000; +; Therefore, if we mix all 3 colors we obtain a grey of ;AN000; +; intensity 1 + 3 + 6 = 10 (i.e.,white). ;AN000; +; ;AN000; +; ;AN000; +; LOGIC: ;AN000; +; ;AN000; +; Calculate the intensity ;AN000; +; ;AN000; +; AL = (.6 * G) + (.3 * R) + (.1 * B) ;AN000; +; ;AN000; +; Adjust Darkness ;AN000; +; ;AN000; +; AL = AL + DARKADJUST_VALUE ;AN000; +; ;AN000; +RGB2INT PROC NEAR ;AN000; + PUSH BX ;AN000; + PUSH CX ;AN000; + PUSH DX ;AN000; + ;AN000; + XOR AX,AX ; AL := Current component intensity ;AN000; + XOR BX,BX ; BX is used for calculations ;AN000; + XOR DX,DX ; DL := Running sum for grey intensity ;AN000; + ;AN000; +;-------Process /R (Reverse black and white) ;AN000; +.IF ; IF reverse is OFF ;AN000; +.THEN ; THEN REVERSE BLACK AND WHITE: ;AN000; +;-------Test if the color is BLACK ;AN000; + .IF AND ; If black ;AN000; + .IF AND ; ;AN000; + .IF ; ;AN000; + .THEN ; then, replace it with white ;AN000; + MOV AL,WHITE_INT ;AN000; + JMP SHORT RGB2INT_END ;AN000; + .ELSEIF AND ; else if, high-intensity white ;AN000; + .IF AND ; ;AN000; + .IF ; ;AN000; + .THEN ; then, replace it with black ;AN000; + MOV AL,BLACK_INT ;AN000; + JMP SHORT RGB2INT_END ;AN000; + .ELSEIF AND ; else if, white ;AN000; + .IF AND ; ;AN000; + .IF ; ;AN000; + .THEN ; then, replace it with black ;AN000; + MOV AL,BLACK_INT ;AN000; + JMP SHORT RGB2INT_END ;AN000; + .ENDIF ;AN000; +.ENDIF ;AN000; + ;AN000; +;-------Calculate Green component ;AN000; + MOV AL,RGB.G ; AL := Green component ;AN000; + MOV BH,6 ; ;AN000; + MUL BH ; AX := Green * 6 ;AN000; + MOV BH,10 ; ;AN000; + DIV BH ; AL := (GREEN * 6) / 10 ;AN000; + ADD DL,AL ; DL := Cumulative intensity ;AN000; + MOV CH,AH ; CH := Cumulative remainder ;AN000; + ;AN000; +;-------Calculate Red component ;AN000; + MOV AL,RGB.R ; AL := Red component ;AN000; + MOV BH,3 ; ;AN000; + MUL BH ; AX := Red * 3 ;AN000; + MOV BH,10 ; ;AN000; + DIV BH ; AL := (RED * 3) / 10 ;AN000; + ADD DL,AL ; DL := Cumulative intensity ;AN000; + ADD CH,AH ; CH := Cumulative remainder ;AN000; + ;AN000; +;-------Calculate Blue component ;AN000; + MOV AL,RGB.B ; AX := Blue component ;AN000; + XOR AH,AH ; ;AN000; + DIV BH ; AL := BLUE / 10 ;AN000; + ADD DL,AL ; DL := Cumulative intensity ;AN000; + ADD CH,AH ; CH := Cumulative remainder ;AN000; + ;AN000; +;-------Adjust intensity with cumulative remainder ;AN000; + XOR AX,AX ;AN000; + MOV AL,CH ; AX := Cumulative remainder ;AN000; + MOV BH,10 ; BH := 10 ;AN000; + DIV BH ; AL := Total remainder / 10 ;AN000; + ADD DL,AL ; DL := Cumulative intensity ;AN000; + .IF ; If remainder > 4 ;AN000; + .THEN ; Then, add 1 ;AN000; + INC DL ; to the intensity ;AN000; + .ENDIF ;AN000; + ;AN000; +;-------Adjust darkness ;AN000; + ADD DL,DS:[BP].DARKADJUST_VALUE ;AN000; + ;AN000; +;-------Return result ;AN000; + MOV AL,DL ; AL := sum of R,G,B intensities ;AN000; + ;AN000; +RGB2INT_END: ;AN000; + POP DX ;AN000; + POP CX ;AN000; + POP BX ;AN000; + RET ;AN000; +RGB2INT ENDP ;AN000; + ;AN000; +PAGE ;AN000; +;============================================================================== ;AN000; +; ;AN000; +; RGB2BAND: MAP RED GREEN BLUE VALUES TO A "SELECT COLOR BAND" MASK FOR ;AN000; +; THE COLOR PRINTER. ;AN000; +; ;AN000; +;------------------------------------------------------------------------------ ;AN000; +; ;AN000; +; INPUT: RGB.R = A RED value (0-63) ;AN000; +; RGB.G = A GREEN value (0-63) ;AN000; +; RGB.B = A BLUE value (0-63) ;AN000; +; BP = Offset of the Shared Data Area. ;AN000; +; ;AN000; +; OUTPUT: AL = The Band Mask, one byte where: ;AN000; +; ;AN000; +; bit 0 = Color Band 1 is needed ;AN000; +; bit 1 = Color Band 2 is needed ;AN000; +; bit 2 = Color Band 3 is needed ;AN000; +; bit 3 = Color Band 4 is needed ;AN000; +; ;AN000; +; ;AN000; +; CALLED BY: SET_CGA_XLT_TAB ;AN000; +; SET_EGA_XLT_TAB ;AN000; +; SET_ROUNDUP_XLT_TAB ;AN000; +; SET_MODE_13H_XLT_TAB ;AN000; +; SET_MODE_F_XLT_TAB ;AN000; +; ;AN000; +;------------------------------------------------------------------------------ ;AN000; +; ;AN000; +; NOTES: The RGB values in input describe a color from the screen. ;AN000; +; Up to 256K different colors can be described with these RGB values. ;AN000; +; ;AN000; +; On the color printer, the print ribbon is composed of 4 color bands, ;AN000; +; each of a different color. By overlapping these 4 bands when ;AN000; +; printing, more colors can be obtained. However, the number of colors ;AN000; +; that can be achieved by overlapping print bands is very limited (4 or ;AN000; +; 8 colors). ;AN000; +; ;AN000; +; THIS MODULE SELECT THE PRINTER COLOR THAT IS THE CLOSEST TO THE ;AN000; +; DESIRED SCREEN COLOR. ;AN000; +; ;AN000; +; The Band Mask specifies which color bands have to be overlapped to ;AN000; +; obtain a color on the printer. ;AN000; +; ;AN000; +; ;AN000; +; DESCRIPTION: Go through the list of printer colors in the SHARED DATA ;AN000; +; AREA, for each of these colors, compare its RGB values with those in ;AN000; +; input. ;AN000; +; Get the BAND_MASK of the closest printer color. ;AN000; +; ;AN000; +; LOGIC: ;AN000; +; ;AN000; +; Locate the printer colors info structure in the shared data area: ;AN000; +; COLORPRINT_PTR := BP + COLORPRINT_PTR ;AN000; +; ;AN000; +; Get the number of printer colors from the COLORPRINT info in the Shared ;AN000; +; data area: ;AN000; +; Number of colors := COLORPRINT_PTR.NUM_PRT_COLOR ;AN000; +; ;AN000; +; CURRENT_COLOR_PTR : First record in the COLORPRINT info structure ;AN000; +; BEST_CHOICE := CURRENT_RECORD_PTR.BAND_MASK ;AN000; +; MIN_DIFF := Maximum positive value ;AN000; +; ;AN000; +; FOR each printer color: ;AN000; +; CUR_DIFF := 0 ;AN000; +; (* Calculate the geometric distance between the RGB values from the *) ;AN000; +; (* input and those of the printer color. *) ;AN000; +; Red difference := (R - CURRENT_COLOR_PTR.RED) ;AN000; +; Red difference := Red difference * Red difference ;AN000; +; CUR_DIFF := CUR_DIFF + Red difference ;AN000; +; ;AN000; +; Green difference := (G - CURRENT_COLOR_PTR.GREEN) ;AN000; +; Green difference := Green difference * Green difference ;AN000; +; CUR_DIFF := CUR_DIFF + Green difference ;AN000; +; ;AN000; +; Blue difference := (B - CURRENT_COLOR_PTR.BLUE) ;AN000; +; Blue difference := Blue difference * Blue difference ;AN000; +; CUR_DIFF := CUR_DIFF + Blue difference ;AN000; +; ;AN000; +; IF CUR_DIFF < MIN_DIFF ;AN000; +; THEN BEGIN ;AN000; +; MIN_DIFF := CUR_DIFF ;AN000; +; BEST_CHOICE := printer color.BAND_MASK ;AN000; +; END ;AN000; +; ;AN000; +; CURRENT_COLOR_PTR := Offset of next color ;AN000; +; END (For each printer color) ;AN000; +; ;AN000; +; Return BEST_CHOICE ;AN000; +; ;AN000; +; ;AN000; +RGB2BAND PROC NEAR ;AN000; + PUSH AX ;AN000; + PUSH BX ;AN000; + PUSH CX ;AN000; + PUSH DX ;AN000; + ;AN000; +;-------Process /R (Reverse black and white) ;AN000; +.IF ; IF reverse is OFF ;AN000; +.THEN ; THEN REVERSE BLACK AND WHITE: ;AN000; +;------------------------------------------------------------------------------ ;AN000; +; ;AN000; +; REVERSE BLACK AND WHITE: ;AN000; +; ;AN000; +;------------------------------------------------------------------------------ ;AN000; +;-------Test if the color is BLACK ;AN000; + .IF AND ; If black ;AN000; + .IF AND ; ;AN000; + .IF ; ;AN000; + .THEN ; then, replace it with the ;AN000; + MOV BEST_CHOICE,0 ; band mask for white ;AN000; + JMP RGB2BAND_END ; return this band mask ;AN000; + .ELSEIF AND ; else if, high-intensity white ;AN000; + .IF AND ; ;AN000; + .IF ; ;AN000; + .THEN ; then, replace it with the ;AN000; + MOV RGB.R,BLACK_INT ; RGB values of black ;AN000; + MOV RGB.G,BLACK_INT ;AN000; + MOV RGB.B,BLACK_INT ;AN000; + .ELSEIF AND ; else if, white ;AN000; + .IF AND ; ;AN000; + .IF ; ;AN000; + .THEN ; then, replace it with the ;AN000; + MOV RGB.R,BLACK_INT ; RGB values of black ;AN000; + MOV RGB.G,BLACK_INT ;AN000; + MOV RGB.B,BLACK_INT ;AN000; + .ENDIF ;AN000; +.ENDIF ;AN000; +;------------------------------------------------------------------------------ ;AN000; +; ;AN000; +; CALCULATE THE GEOMETRIC DISTANCE BETWEEN THE COLORS OF THE PIXEL AND THOSE OF ;AN000; +; THE PRINTER: ;AN000; +; ;AN000; +;------------------------------------------------------------------------------ ;AN000; + MOV BX,DS:[BP].COLORPRINT_PTR ; BX := OFFSET of COLORPRINT ;AN000; + ADD BX,BP ;AN000; + MOV MIN_DIFF,7FFFh ; No match yet, minimum diff. ;AN000; + ; is maximum POSITIVE value. ;AN000; + XOR CX,CX ;AN000; + MOV CL,DS:[BP].NUM_PRT_COLOR ; CX := Number of print colors ;AN000; + ;AN000; + ;AN000; +INSPECT_1_PRINT_COLOR: ;AN000; + MOV CUR_DIFF,0 ; Current difference := 0 ;AN000; +;------------------------------------------------------------------------------ ;AN000; +; Calculate the Red difference: ;AN000; +;------------------------------------------------------------------------------ ;AN000; + MOV AL,RGB.R ;AN000; + SUB AL,[BX].RED ;AN000; +;-------Elevate at the power of two ;AN000; + MOV DL,AL ; DX := Red difference ;AN000; + IMUL DL ; AX := Red diff. square ;AN000; + ADD CUR_DIFF,AX ; CURR_DIF + Red diff. ;AN000; + ;AN000; +;------------------------------------------------------------------------------ ;AN000; +; Calculate the Green difference: ;AN000; +;------------------------------------------------------------------------------ ;AN000; + MOV AL,RGB.G ;AN000; + SUB AL,[BX].GREEN ;AN000; +;-------Elevate at the power of two ;AN000; + MOV DL,AL ; DX := Red difference ;AN000; + IMUL DL ; AX := Red diff. square ;AN000; + ADD CUR_DIFF,AX ; CURR_DIF + Green diff. ;AN000; + ;AN000; +;------------------------------------------------------------------------------ ;AN000; +; Calculate the Blue difference: ;AN000; +;------------------------------------------------------------------------------ ;AN000; + MOV AL,RGB.B ;AN000; + SUB AL,[BX].BLUE ;AN000; +;-------Elevate at the power of two ;AN000; + MOV DL,AL ; DX := Red difference ;AN000; + IMUL DL ; AX := Red diff. square ;AN000; + ADD CUR_DIFF,AX ; CURR_DIF + Blue diff. ;AN000; + ;AN000; +;------------------------------------------------------------------------------ ;AN000; +; Check how close is this print color to the screen color: ;AN000; +;------------------------------------------------------------------------------ ;AN000; + MOV AX,CUR_DIFF ; If this color is better than what we ;AN000; + .IF ; had before. ;AN000; + .THEN ; ;AN000; + MOV MIN_DIFF,AX ; then, new minimum distance; ;AN000; + MOV AL,[BX].SELECT_MASK ; get its band mask. ;AN000; + MOV BEST_CHOICE,AL ; ;AN000; + .ENDIF ; ;AN000; + ;AN000; +;------------------------------------------------------------------------------ ;AN000; +; Get offset of next COLORPRINT info record: ;AN000; +;------------------------------------------------------------------------------ ;AN000; + ADD BX,SIZE COLORPRINT_STR ;AN000; + LOOP INSPECT_1_PRINT_COLOR ;AN000; + ;AN000; +;------------------------------------------------------------------------------ ;AN000; +; BEST_CHOICE contains the print color with the closest RGB values ;AN000; +;------------------------------------------------------------------------------ ;AN000; +RGB2BAND_END: ;AN000; + POP DX ;AN000; + POP CX ;AN000; + POP BX ;AN000; + POP AX ;AN000; + MOV AL,BEST_CHOICE ;AN000; + RET ;AN000; +BEST_CHOICE DB ? ;AN000; +MIN_DIFF DW ? ;AN000; +CUR_DIFF DW ? ;AN000; +RGB2BAND ENDP ;AN000; +CODE ENDS ;AN000; + END ;AN000; diff --git a/v4.0/src/CMD/GRAPHICS/GRCTRL.EXT b/v4.0/src/CMD/GRAPHICS/GRCTRL.EXT new file mode 100644 index 0000000..2d756fd --- /dev/null +++ b/v4.0/src/CMD/GRAPHICS/GRCTRL.EXT @@ -0,0 +1,47 @@ +PAGE ,132 +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;AN000; +;; DOS - GRAPHICS Command +;; (C) Copyright 1988 Microsoft +;; ;AN000; +;; File Name: GRCTRL.EXT ;AN000; +;; ---------- ;AN000; +;; ;AN000; +;; Description: ;AN000; +;; ------------ ;AN000; +;; Include file containing external declarations for ;AN000; +;; the code and data defined in GRCTRL.ASM ;AN000; +;; ;AN000; +;; Change History: ;AN000; +;; --------------- ;AN000; +;; ;AN000; +;; ;AN000; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;AN000; + ;; ;AN000; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;AN000; +EXTRN DET_HW_CONFIG:NEAR ;AN000; +EXTRN RGB:BYTE ;AN000; +EXTRN BIOS_INT_5H:WORD ;AN000; +EXTRN PRT_SCR:NEAR ;AN000; +EXTRN PRINT_SCREEN_ALLOWED:BYTE ;AN000; +EXTRN XLT_TAB:BYTE ;AN000; +EXTRN MODE_TYPE:BYTE ;AN000; +EXTRN CUR_MODE_PTR:WORD ;AN000; +EXTRN CUR_MODE:BYTE ;AN000; +EXTRN MODE_TYPE:BYTE ;AN000; +EXTRN NB_COLORS:WORD ;AN000; +EXTRN SCREEN_HEIGHT:WORD ;AN000; +EXTRN SCREEN_WIDTH:WORD ;AN000; +EXTRN NB_CHAR_COLUMNS:BYTE ;AN000; +EXTRN CUR_PAGE:BYTE ;AN000; +EXTRN CUR_COLUMN:WORD ;AN000; +EXTRN CUR_ROW:WORD ;AN000; +EXTRN NB_SCAN_LINES:WORD ;AN000; +EXTRN SCAN_LINE_MAX_LENGTH:WORD ;AN000; +EXTRN CUR_SCAN_LNE_LENGTH:WORD ;AN000; +EXTRN PRT_BUF:BYTE ;AN000; +EXTRN NB_BOXES_PER_PRT_BUF:BYTE ;AN000; +EXTRN CUR_BOX:BYTE ;AN000; +EXTRN BOX_H:BYTE ;AN000; +EXTRN BOX_W:BYTE ;AN000; +EXTRN ERROR_CODE:BYTE ;AN000; +EXTRN ROTATE_SW:BYTE ;AN000; diff --git a/v4.0/src/CMD/GRAPHICS/GRCTRL.STR b/v4.0/src/CMD/GRAPHICS/GRCTRL.STR new file mode 100644 index 0000000..fb913df --- /dev/null +++ b/v4.0/src/CMD/GRAPHICS/GRCTRL.STR @@ -0,0 +1,111 @@ +.XLIST ;AN000; +PAGE ,132 ;AN000; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;AN000; +;; DOS - GRAPHICS Command +;; (C) Copyright 1988 Microsoft +;; ;AN000; +;; File Name: GRCTRL.STR ;AN000; +;; ---------- ;AN000; +;; ;AN000; +;; Description: ;AN000; +;; ------------ ;AN000; +;; Include file containing structures and equates for ;AN000; +;; the Print Screen process. ;AN000; +;; ;AN000; +;; Change History: ;AN000; +;; --------------- ;AN000; +;; ;AN000; +;; ;AN000; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;AN000; + ;; ;AN000; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;AN000; +.LIST ;AN000; +;-------------------------------------------------------------------------------;AN000; +; ;AN000; +; PRINT SCREEN INTERNAL ERROR CODES ;AN000; +; ;AN000; +;-------------------------------------------------------------------------------;AN000; +NO_ERROR EQU 0 ;AN000; +UNABLE_TO_PRINT EQU 1 ; The procedure was unable to print the ;AN000; + ; screen ;AN000; +DISPLAYMODE_INFO_NOT_FOUND EQU 2 ; There was no DISPLAYMODE info record ;AN000; + ; in the Shared Area for the current mode ;AN000; +MODE_NOT_SUPPORTED EQU 4 ; This mode is not supported by this version ;AN000; + ; of GRAHICS. ;AN000; +PRINTER_ERROR EQU 8 ; An error occurred while printing a byte ;AN000; + ; (i.e., Out of paper, etc) ;AN000; +;-------------------------------------------------------------------------------;AN000; +; ;AN000; +; PIXEL INTERNAL REPRESENTATION ;AN000; +; ;AN000; +;-------------------------------------------------------------------------------;AN000; +PIXEL_STR STRUC ;AN000; + R DB ? ; RED component (0 to MAX_INT) ;AN000; + G DB ? ; GREEN component (0 to MAX_INT) ;AN000; + B DB ? ; BLUE component (0 to MAX_INT) ;AN000; +PIXEL_STR ENDS ;AN000; +;-------------------------------------------------------------------------------;AN000; +; ;AN000; +; VIDEO MODE TYPES ;AN000; +; ;AN000; +;-------------------------------------------------------------------------------;AN000; +TXT EQU 0 ; Text ;AN000; +APA EQU 1 ; All Points Addressable ;AN000; + ;AN000; +;-------------------------------------------------------------------------------;AN000; +; ;AN000; +; BIOS INTERRUPT 10H CALL EQUATES ;AN000; +; Note: Either AX or AH must be initialized, depending if the call is ;AN000; +; a sub-call or not. ;AN000; +; ;AN000; +;-------------------------------------------------------------------------------;AN000; +READ_DOT_CALL EQU 0DH ; Read dot ;AN000; +SET_CURSOR_CALL EQU 02H ; Set cursor on the screen ;AN000; +READ_CURSOR_CALL EQU 03H ; Read position of the cursor on the screen ;AN000; +READ_CHAR_CALL EQU 08H ; Read attribute/character ;AN000; +GET_STATE_CALL EQU 0FH ; Return current video state ;AN000; +GET_P_REG_CALL EQU 1007H ; Read a palette register (EGA, VGA) ;AN000; +GET_C_REG_CALL EQU 1015H ; Read a color register (VGA) ;AN000; +READ_CONFIG_CALL EQU 1A00H ; Read display adapter configuration (PS/2) ;AN000; +PAGE_STATE_CALL EQU 101AH ; Read color page state call (PS/2) ;AN000; +ALT_SELECT_CALL EQU 12H ; Alternate select call (AH = 12h) ;AN000; +EGA_INFO_CALL EQU 10H ; Return EGA information (AH=12H,BH = 10H) ;AN000; +DISP_DESC_CALL EQU 15H ; PC CONVERTIBLE display description call ;AN000; + ;AN000; +;-------------------------------------------------------------------------------;AN000; +; ;AN000; +; BIOS DATA AREA EQUATES ;AN000; +; ;AN000; +;-------------------------------------------------------------------------------;AN000; +BIOS_SEG EQU 40H ; BIOS segment ;AN000; +NB_ROWS_OFFSET EQU 84H ; Number of rows displayed when in a text mode ;AN000; + ;AN000; +;-------------------------------------------------------------------------------;AN000; +; ;AN000; +; CONSTANT DEFINITIONS ;AN000; +; ;AN000; +;-------------------------------------------------------------------------------;AN000; +NO EQU 0 ;AN000; +YES EQU 1 ;AN000; +OFF EQU 0 ;AN000; +ON EQU 1 ;AN000; + ;AN000; +;-------------------------------------------------------------------------------;AN000; +; ;AN000; +; TRANSLATION TABLE DEFINITIONS ;AN000; +; ;AN000; +;-------------------------------------------------------------------------------;AN000; +WHITE_INT EQU 63 ; Intensity for WHITE on the printer ;AN000; +BLACK_INT EQU 0 ; Intensity for BLACK on the printer ;AN000; +MAX_INT EQU WHITE_INT ; Maximum intensity for a RGB value, ;AN000; + ; (Red, Green, or Blue). ;AN000; +ONE_THIRD EQU MAX_INT*1/3 ; Used to calculate Red, Green, Blue intensity ;AN000; +TWO_THIRD EQU MAX_INT*2/3 ; values. ;AN000; + ;AN000; +;-------------------------------------------------------------------------------;AN000; +; ;AN000; +; PRINTER CONTROL ASCII CODES ;AN000; +; ;AN000; +;-------------------------------------------------------------------------------;AN000; +CR EQU 0DH ; Carriage return ;AN000; +LF EQU 0AH ; Line feed ;AN000; diff --git a/v4.0/src/CMD/GRAPHICS/GRINST.ASM b/v4.0/src/CMD/GRAPHICS/GRINST.ASM new file mode 100644 index 0000000..cdb8b17 --- /dev/null +++ b/v4.0/src/CMD/GRAPHICS/GRINST.ASM @@ -0,0 +1,973 @@ + PAGE ,132 ;AN000; + TITLE DOS - GRAPHICS Command - Installation Modules ;AN000; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;AN000; +;; DOS - GRAPHICS Command +;; (C) Copyright 1988 Microsoft +;; ;AN000; +;; File Name: GRINST.ASM ;AN000; +;; ---------- ;AN000; +;; ;AN000; +;; Description: ;AN000; +;; ------------ ;AN000; +;; This file contains the installation modules for the ;AN000; +;; GRAPHICS command. ;AN000; +;; ;AN000; +;; GRAPHICS_INSTALL is the main module. ;AN000; +;; ;AN000; +;; GRAPHICS_INSTALL calls modules in GRLOAD.ASM to load ;AN000; +;; the GRAPHICS profile and GRPARMS.ASM to parse the command line. ;AN000; +;; ;AN000; +;; ;AN000; +;; Documentation Reference: ;AN000; +;; ------------------------ ;AN000; +;; OASIS High Level Design ;AN000; +;; OASIS GRAPHICS I1 Overview ;AN000; +;; DOS 3.3 Message Retriever Interface Supplement. ;AN000; +;; TUPPER I0 Document - PARSER HIGH LEVEL DESIGN REVIEW ;AN000; +;; ;AN000; +;; Procedures Contained in This File: ;AN000; +;; ---------------------------------- ;AN000; +;; GRAPHICS_INSTALL - Main installation module ;AN000; +;; CHAIN_INTERRUPTS - Chain interrupts 5, 2F, EGA Save Pointers ;AN000; +;; COPY_PRINT_MODULES - Throw away one set of print modules ;AN000; +;; ;AN000; +;; ;AN000; +;; Include Files Required: ;AN000; +;; ----------------------- ;AN000; +;; GRLOAD.EXT - Externals for profile load ;AN000; +;; GRLOAD2.EXT - Externals for profile load ;AN000; +;; GRCTRL.EXT - Externals for print screen control ;AN000; +;; GRPRINT.EXT - Externals for print modules ;AN000; +;; GRCPSD.EXT - Externals for COPY_SHARED_DATA module ;AN000; +;; GRPARMS.EXT - External for GRAPHICS command line parsing ;AN000; +;; GRPARSE.EXT - External for DOS parser ;AN000; +;; GRBWPRT.EXT - Externals for Black and white printing modules ;AN000; +;; GRCOLPRT.EXT - Externals for color printing modules ;AN000; +;; GRINT2FH.EXT - Externals for Interrupt 2Fh driver. ;AN000; +;; ;AN000; +;; GRMSG.EQU - Equates for the GRAPHICS error messages ;AN000; +;; SYSMSG.INC - DOS message retriever ;AN000; +;; ;AN000; +;; GRSHAR.STR - Shared Data Area Structure ;AN000; +;; ;AN000; +;; STRUC.INC - Macros for using structured assembly language ;AN000; +;; ;AN000; +;; External Procedure References: ;AN000; +;; ------------------------------ ;AN000; +;; FROM FILE GRLOAD.ASM: ;AN000; +;; LOAD_PROFILE - Main module for profile loading ;AN000; +;; SYSPARSE - DOS system parser ;AN000; +;; SYSDISPMSG - DOS message retriever ;AN000; +;; ;AN000; +;; Linkage Instructions: ;AN000; +;; -------------------- ;AN000; +;; Refer to GRAPHICS.ASM ;AN000; +;; ;AN000; +;; Change History: ;AN000; +;; --------------- ;AN000; +;; ;AN000; +;; ;AN000; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;AN000; + ;; ;AN000; +CODE SEGMENT PUBLIC 'CODE' ;; ;AN000; + ASSUME CS:CODE,DS:CODE ;; ;AN000; + ;; ;AN000; +.XLIST ;; ;AN000; + INCLUDE GRSHAR.STR ;; Include the Shared data area structure;AN000; + INCLUDE SYSMSG.INC ;; Include DOS message retriever ;AN000; + INCLUDE STRUC.INC ;; Include macros - Structured Assembler ;AN000; + INCLUDE GRLOAD.EXT ;; Bring in external declarations ;AN000; + INCLUDE GRLOAD2.EXT ;; ;AN000; + INCLUDE GRLOAD3.EXT ;; ;AN000; + INCLUDE GRCTRL.EXT ;; ;AN000; + INCLUDE GRBWPRT.EXT ;; ;AN000; + INCLUDE GRCOLPRT.EXT ;; ;AN000; + INCLUDE GRCPSD.EXT ;; ;AN000; + INCLUDE GRINT2FH.EXT ;; ;AN000; + INCLUDE GRCTRL.EXT ;; ;AN000; + INCLUDE GRPARSE.EXT ;; ;AN000; + INCLUDE GRPARMS.EXT ;; ;AN000; + INCLUDE GRMSG.EQU ;; ;AN000; + ;; ;AN000; +MSG_UTILNAME ;; Identify ourself to Message retriever.;AN000; + ;; Include messages ;AN000; +MSG_SERVICES ;; ;AN000; +MSG_SERVICES ;; ;AN000; +MSG_SERVICES ;AN000; +.LIST ;; ;AN000; + ;; ;AN000; +PUBLIC GRAPHICS_INSTALL ;; ;AN000; +PUBLIC TEMP_SHARED_DATA_PTR ;; ;AN000; +PUBLIC PRINTER_TYPE_PARM ;; ;AN000; +PUBLIC PRINTER_TYPE_LENGTH ;; ;AN000; +PUBLIC PROFILE_PATH ;; ;AN000; +PUBLIC PRINTBOX_ID_PTR ;; ;AN000; +PUBLIC PRINTBOX_ID_LENGTH ;; ;AN000; +PUBLIC DEFAULT_BOX ;; ;AN000; +PUBLIC LCD_BOX ;; ;AN000; +PUBLIC NB_FREE_BYTES ;; ;AN000; +PUBLIC SYSDISPMSG ;; ;AN000; +PUBLIC DISP_ERROR ;; ;AN000; +PUBLIC INSTALLED ;; ;AN000; +PUBLIC ERROR_DEVICE ;; ;AN000; +PUBLIC STDERR ;; ;AN000; +PUBLIC STDOUT ;; ;AN000; +PUBLIC RESIDENT_SHARED_DATA_SIZE ;; ;AN000; + ;; ;AN000; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;AN000; +;; ;AN000; +;; Install Variables ;AN000; +;; ;AN000; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;AN000; + ;; ;AN000; +NO EQU 0 ;; ;AN000; +YES EQU 1 ;; ;AN000; +INSTALLED DB NO ;; YES if GRAPHICS already installed ;AN000; + ;; ;AN000; + ;; ;AN000; +BYTES_AVAIL_PSP_OFF EQU 6 ;; Word number 6 of the PSP is the ;AN000; + ;; number of bytes available in the ;AN000; + ;; current segment ;AN000; + ;; ;AN000; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;AN000; +;; ;AN000; +;; GRLOAD (PROFILE LOADING) INPUT PARMS: ;AN000; +;; ;AN000; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;AN000; +PRINTER_TYPE_PARM DB "GRAPHICS",9 DUP(0) ; Printer type ;AN000; + ;; (default=GRAPHICS) ;AN000; +PRINTER_TYPE_LENGTH DB 17 ;; Printer type maximum length of ASCIIZ ;AN000; +PROFILE_PATH DB 128 DUP(0) ;; Profile name with full path ;AN000; + ;; (Max size for ASCIIZ is 128) ;AN000; +PRINTBOX_ID_PTR DW DEFAULT_BOX ;; Offset of ASCIIZ string containing ;AN000; +DEFAULT_BOX DB "STD",14 DUP(0); the printbox id. (DEFAULT = STD) ;AN000; +LCD_BOX DB "LCD",14 DUP(0); ASCIIZ string for the LCD printboxID;AN000; +PRINTBOX_ID_LENGTH DB 17 ;; Max. length for the printbox id. ;AN000; + ;; ASCIIZ string ;AN000; +NB_FREE_BYTES DW ? ;; Number of bytes available in our ;AN000; + ;; resident segment ;AN000; +RESIDENT_SHARED_DATA_SIZE DW ? ;; Size in bytes of the RESIDENT Shared ;AN000; + ;; data area (if GRAPHICS already ;AN000; + ;; installed). ;AN000; +END_OF_RESIDENT_CODE DW ? ;; Offset of the end of the code that ;AN000; + ;; has to be made resident. ;AN000; +TEMP_SHARED_DATA_PTR DW ? ;; Offset of the temporary Shared area ;AN000; + ;; ;AN000; +ERROR_DEVICE DW STDERR ;; Device DISP_ERROR will output ;AN000; + ;; messages to (STDERR or STDOUT) ;AN000; +PAGE ;AN000; +;===============================================================================;AN000; +; ;AN000; +; GRAPHICS_INSTALL : INSTALL GRAPHICS.COM ;AN000; +; ;AN000; +;-------------------------------------------------------------------------------;AN000; +; ;AN000; +; INPUT: Command line parameters ;AN000; +; GRAPHICS profile - A file describing printer characteristics and ;AN000; +; attributes. ;AN000; +; ;AN000; +; OUTPUT: If first time invoked: ;AN000; +; INT 5 VECTOR and INT 2FH VECTOR are replaced; only the required ;AN000; +; code for printing the screen is made resident. ;AN000; +; else, ;AN000; +; The resident code is updated to reflect changes in printing ;AN000; +; options. ;AN000; +; ;AN000; +;-------------------------------------------------------------------------------;AN000; +;; ;AN000; +;; DESCRIPTION: ;AN000; +;; ;AN000; +;; This module intalls GRAPHICS code and data. ;AN000; +;; ;AN000; +;; An INT 2FH driver is also installed. ;AN000; +;; ;AN000; +;; If this driver is already present then, we assume GRAPHICS was installed ;AN000; +;; and do not install it again but, simply update the resident code. ;AN000; +;; ;AN000; +;; The resident code contains ONLY the code and data needed for Printing ;AN000; +;; the screen. The code needed is determined according to the command line ;AN000; +;; parameters and the information extracted from the printer profile. ;AN000; +;; ;AN000; +;; The printer profile is parsed according to the current hardware setting ;AN000; +;; and also to the command line options. The information extracted from ;AN000; +;; the profile is stored in a Data area shared between the installation ;AN000; +;; process and the Print Screen process. ;AN000; +;; ;AN000; +;; A temporary Shared Data Area is FIRST built at the end of the .COM file ;AN000; +;; Before building it, we verify that there is ;AN000; +;; enough memory left in the current segment. If not, the installation ;AN000; +;; process is aborted. ;AN000; +;; ;AN000; +;; This temporary Data area when completed will be copied over the ;AN000; +;; installation code. Therefore, the file comprising GRAPHICS must be ;AN000; +;; linked in a specific order with the installation modules being last. ;AN000; +;; ;AN000; +;; These modules will be overwritten by the Shared Data area and the EGA ;AN000; +;; dynamic save area before we exit and stay resident. ;AN000; +;; ;AN000; +;; The end of the resident code is the end of the Shared Data area, anything ;AN000; +;; else beyond that is not made resident. ;AN000; +;; ;AN000; +;; The pointer to the resident Shared Data area is declared within the ;AN000; +;; Interrupt 2Fh driver. This pointer is initialized by the installation ;AN000; +;; process and points to the shared data area at Print Screen time. ;AN000; +;; ;AN000; +;; Depending on the type of printer attached (i.e., Black and white or Color) ;AN000; +;; only one set of modules is made resident during the installation. ;AN000; +;; ;AN000; +;; The set of print modules required is copied over the previous one at ;AN000; +;; location "PRINT_MODULE_START". This location is declared within ;AN000; +;; GRCOLPRT which must be linked before GRBWPRT ;AN000; +;; ;AN000; +;; When copying one of the 2 sets of print modules we reserve enough space ;AN000; +;; for the larger of them. Therefore, if GRAPHICS is already installed but ;AN000; +;; is reinvoked with a different printer type which needs a bigger set of ;AN000; +;; modules: this new set of modules is simply recopied over the existing ;AN000; +;; one in the resident code. ;AN000; +;; ;AN000; +;; The Shared Data area is copied rigth after the set of modules that we keep ;AN000; +;; that is, over the unused set of modules. ;AN000; +;; ;AN000; +;; ;AN000; +;-------------------------------------------------------------------------------;AN000; +;; ;AN000; +;; Register Conventions: ;AN000; +;; BP - points to start of Temp Shared Data (Transiant code) ;AN000; +;; ;AN000; +;; Called By: ;AN000; +;; Entry point for GRAPHICS command processing. ;AN000; +;; ;AN000; +;; External Calls: ;AN000; +;; INT 2FH, LOAD_MESSAGES, LOAD_PROFILE, PARSE_PARMS ;AN000; +;; CHAIN_INTERRUPTS, COPY_SHARED_DATA, DISPLAY_MESSAGE ;AN000; +;; COPY_PRINT_MODULES ;AN000; +;; ;AN000; +;-------------------------------------------------------------------------------;AN000; +;; ;AN000; +;; LOGIC: ;AN000; +;; Load the message retriever ;AN000; +;; IF carry flag is set (incorrect DOS version) THEN ;AN000; +;; Issue message (COMMON1) ;AN000; +;; Exit ;AN000; +;; ENDIF ;AN000; +;; ;AN000; +;; Get number of bytes available in the segment from PSP (word 6) ;AN000; +;; /* This is needed since we construct a temporary Shared data area at the ;AN000; +;; of the .COM file */ ;AN000; +;; ;AN000; +;; /* Build Shared Data in temporary area */ ;AN000; +;; END_OF_RESIDENT_CODE := (end of .COM file) ;AN000; +;; NB_FREE_BYTES := Number of bytes availables ;AN000; +;; ;AN000; +;; CALL PARSE_PARMS ;AN000; +;; IF error THEN /* PARSE_PARMS will issue messages */ ;AN000; +;; Exit ;AN000; +;; ENDIF ;AN000; +;; ;AN000; +;; CALL LOAD_PROFILE ;AN000; +;; IF profile errors THEN ;AN000; +;; Exit /* LOAD_PROFILE will issue messages */ ;AN000; +;; ENDIF ;AN000; +;; ;AN000; +;; Issue INT 2FH Install Check call (AX=1500H) ;AN000; +;; /* INT 2FH returns ES:[DI] pointing to the shared data area */ ;AN000; +;; IF already installed THEN ;AN000; +;; THEN ;AN000; +;; Move NO to PRINT_SCREEN_ALLOWED in resident Shared Data ;AN000; +;; SHARED_DATA_AREA_PTR := DI ;AN000; +;; ELSE ;AN000; +;; MOV PRINT_SCREEN_ALLOWED,NO ;AN000; +;; CALL CHAIN_INTERRUPTS /* Install INT 5 and INT 2FH vectors */ ;AN000; +;; ES := Our segment ;AN000; +;; ENDIF ;AN000; +;; /* Keep only Print Black and White or Print Color: */ ;AN000; +;; CALL COPY_PRINT_MODULES ;AN000; +;; /* COPY_SHARED_DATA will terminate & stay resident */ ;AN000; +;; Set up registers for copy & terminate call ;AN000; +;; /* reserve enough memory to handle any printer in the profile*/ ;AN000; +;; jump to COPY_SHARED_DATA module ;AN000; +;; ELSE ;AN000; +;; /* Shared Data has been built in place */ ;AN000; +;; move YES to PRINT_SCREEN_ALLOWED ;AN000; +;; Return to DOS ;AN000; +;; ENDIF ;AN000; +;; ;AN000; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;AN000; +GRAPHICS_INSTALL PROC NEAR ; ;AN000; + ;AN000; +;-------------------------------------------------------------------------------;AN000; +; Load the error messages ;AN000; +;-------------------------------------------------------------------------------;AN000; + CALL SYSLOADMSG ; Load messages ;AN000; + .IF C ; If error when loading messages ;AN000; + .THEN ; then, ;AN000; + MOV CX,0 ; CX := No substitution in message ;AN000; + MOV AX,1 ; AX := msg nb. for "Invalid DOS version" ;AN000; + CALL DISP_ERROR ; Display error message ;AN000; + JMP ERROR_EXIT ; and quit ;AN000; + .ENDIF ;AN000; + ;AN000; +;-------------------------------------------------------------------------------;AN000; +; Get offset of where to build the TEMPORARY Shared Data area (always built) ;AN000; +;-------------------------------------------------------------------------------;AN000; + MOV BP,OFFSET LIMIT ; Build it at the end of this .COM file ;AN000; + ; (LIMIT = the offset of the last byte ;AN000; + ; of the last .OBJ file linked with ;AN000; + ; GRAPHICS) ;AN000; + MOV TEMP_SHARED_DATA_PTR,BP ; ;AN000; + ;AN000; +;-------------------------------------------------------------------------------;AN000; +; Determine if GRAPHICS is already installed; get the resident segment value ;AN000; +;-------------------------------------------------------------------------------;AN000; + MOV AH,PRT_SCR_2FH_NUMBER ; Call INT 2FH (the Multiplex interrupt) ;AN000; + XOR AL,AL ; for Print Screen handler ;AN000; + INT 2FH ; ;AN000; + ;AN000; + .IF ; IF already installed ;AN000; + .THEN ; then, ;AN000; + ;----------------------------------------------------------------------------;AN000; + ; GRAPHICS is already installed: Get pointer to the EXISTING Shared Data area;AN000; + ;----------------------------------------------------------------------------;AN000; + MOV INSTALLED,YES ; Say it's installed ;AN000; + MOV AX,ES ; Get the segment and offset of the ;AN000; + MOV SHARED_DATA_AREA_PTR,DI; resident Shared Data area. ;AN000; + MOV RESIDENT_CODE_SEG,AX ; (returned in ES:DI) ;AN000; + ; Disable print screen because we will ;AN000; + MOV ES:PRINT_SCREEN_ALLOWED,NO ; be updating the resident code. ;AN000; + .ELSE ; ELSE, not installed: ;AN000; + ;------------------------------------------------------------------------ ;AN000; + ; GRAPHICS is NOT installed: RESIDENT shared data area is in OUR segment ;AN000; + ;------------------------------------------------------------------------ ;AN000; + PUSH CS ; The Shared Data area will be in our ;AN000; + POP RESIDENT_CODE_SEG ; segment. ;AN000; + .ENDIF ;AN000; + ;AN000; +;-------------------------------------------------------------------------------;AN000; +; Determine in AX how many bytes are available for building the TEMPORARY SHARED;AN000; +; DATA AREA: ;AN000; +;-------------------------------------------------------------------------------;AN000; + MOV AX,ES:BYTES_AVAIL_PSP_OFF;AX := Number of bytes availables in ;AN000; + ; the current segment (as indicated in PSP);AN000; + .IF > ; If there is no bytes available past ;AN000; + .THEN ; the end of our .COM file ;AN000; + XOR AX,AX ; then, AX := 0 bytes available ;AN000; + .ELSE ; ;AN000; + SUB AX,OFFSET LIMIT ; else, AX := Number of FREE bytes ;AN000; + .ENDIF ; in this segment ;AN000; + ;AN000; +;---AX = Number of bytes in our segment available for building the Temp Shared ;AN000; +;---data area. ;AN000; +;---IF ALREADY INSTALLED: Get the size of the existing Shared data area. ;AN000; +;---Since the temporary shared data area will be copied over the resident ;AN000; +;---shared data area, we do not want to build it any bigger than the one ;AN000; +;---it will overwrite. Therefore we do not give to LOAD_PROFILE more space ;AN000; +;---than the size of the existing Shared data area. ;AN000; + .IF ; If already installed then, ;AN000; + .THEN ;AN000; + PUSH CS:RESIDENT_CODE_SEG ; ES:[DI] := Resident Shared data area ;AN000; + POP ES ; ;AN000; + MOV DI,SHARED_DATA_AREA_PTR ; ;AN000; + MOV CX,ES:[DI].SD_TOTAL_SIZE ; CX := Size of the existing Shared area ;AN000; + MOV RESIDENT_SHARED_DATA_SIZE,CX ; Save size for LOAD_PROFILE ;AN000; + .IF ; If AX > size of existing SDA ;AN000; + MOV AX,CX ; then, AX := Size of existing Shared area ;AN000; + .ENDIF ; ;AN000; + .ENDIF ;AN000; + ; NB_FREE_BYTES := Number of bytes ;AN000; + MOV NB_FREE_BYTES,AX ; available for ;AN000; + ; building the TEMPORARY shared area ;AN000; +;-------------------------------------------------------------------------------;AN000; +; Parse the command line parameters ;AN000; +;-------------------------------------------------------------------------------;AN000; + MOV BYTE PTR CS:[BP].SWITCHES,0 ; Init. the command line switches ;AN000; + PUSH CS ; Set ES to segment containing the PSP ;AN000; + POP ES ;AN000; + CALL PARSE_PARMS ; Set switches in the Temp. Shared Area ;AN000; + .IF C ; If error when parsing the command ;AN000; + .THEN ; line then, EXIT ;AN000; + JMP ERROR_EXIT ;AN000; + .ENDIF ;AN000; + ;AN000; +;-------------------------------------------------------------------------------;AN000; +; Parse the printer profile - Build the temporary Shared data area ;AN000; +;-------------------------------------------------------------------------------;AN000; + CALL LOAD_PROFILE ; Builds profile info in Temporary Shared ;AN000; + ; Data ;AN000; + .IF C ; If error when loading the profile ;AN000; + .THEN ; then, EXIT ;AN000; + JMP ERROR_EXIT ;AN000; + .ENDIF ;AN000; + ;AN000; +;-------------------------------------------------------------------------------;AN000; +; Check if /B was specified with a BLACK and WHITE printer:(invalid combination);AN000; +;-------------------------------------------------------------------------------;AN000; + .IF AND ;AN000; + .IF ;AN000; + .THEN ;AN000; + MOV AX,INVALID_B_SWITCH ; Error := /B invalid with B&W prt. ;AN000; + MOV CX,0 ; No substitution ;AN000; + CALL DISP_ERROR ; Display error message ;AN000; + JMP ERROR_EXIT ; and quit ;AN000; + .ENDIF ;AN000; + ;AN000; +;-------------------------------------------------------------------------------;AN000; +; ;AN000; +; RELOCATE THE TEMPORARY SHARED DATA AREA AND THE SET OF REQUIRED PRINT MODULES ;AN000; +; ;AN000; +; (Discard the set of print modules not needed with the printer attached and ;AN000; +; discard all the code not used at print screen time). ;AN000; +; ;AN000; +; If GRAPHICS is already installed then, we copy the ;AN000; +; Shared Data area and the print modules over the previous ones installed in ;AN000; +; resident memory. ;AN000; +; ;AN000; +; If we are installed for the first time then, we copy those over the ;AN000; +; installation modules before we exit and stay resident. ;AN000; +; ;AN000; +; A temporaty Shared Data area is always created even if a resident one ;AN000; +; already exist (it is then, copied over), a set of print modules is recopied ;AN000; +; only if needed. ;AN000; +; ;AN000; +; NOTE: END_OF_RESIDENT_CODE points to the first location over which code ;AN000; +; may be relocated. After data or code is relocated, END_OF_RESIDENT_CODE;AN000; +; is updated and points to the next available location for copying code ;AN000; +; that will stay resident. ;AN000; +;-------------------------------------------------------------------------------;AN000; +;-------------------------------------------------------------------------------;AN000; +; Initialize the pointer to the next available location for resident code: ;AN000; +;-------------------------------------------------------------------------------;AN000; + .IF ; If not installed ;AN000; + .THEN ; then, ;AN000; + MOV END_OF_RESIDENT_CODE,OFFSET PRINT_MODULE_START ;AN000; + .ENDIF ; we make everything up to the print ;AN000; + ; modules resident code. ;AN000; +;-------------------------------------------------------------------------------;AN000; +; Keep only the set of print modules that is needed: ;AN000; +;-------------------------------------------------------------------------------;AN000; + CALL COPY_PRINT_MODULES ; Updates END_OF_RESIDENT_CODE ;AN000; +;-------------------------------------------------------------------------------;AN000; +; Replace the interrupt vectors and install the EGA dynamic area (if needed) ;AN000; +;-------------------------------------------------------------------------------;AN000; + .IF ; If not already installed ;AN000; + .THEN ; then, ;AN000; +;------Release evironment vector ;AN002; + CALL RELEASE_ENVIRONMENT ; release unneeded environment vector ;AN002; +;------Replace the interrupt vectors ;AN000; + MOV PRINT_SCREEN_ALLOWED,NO ; Disable Print Screen ;AN000; + CALL CHAIN_INTERRUPTS ; Replace the interrupt vectors ;AN000; + ; (END_OF_RESIDENT_CODE is updated) ;AN000; + CALL DET_HW_CONFIG ; Find what display adapter we got ;AN000; + .IF ;If EGA is present ;AN000; + .THEN ; then, ;AN000; + CALL INST_EGA_SAVE_AREA ; Install the EGA dynamic save area ;AN000; + .ENDIF ; (END_OF_RESIDENT_CODE is updated) ;AN000; +;------Calculate the size of the resident code ;AN000; + MOV DX,END_OF_RESIDENT_CODE ; DX := End of resident code ;AN000; + ADD DX,CS:[BP].SD_TOTAL_SIZE; Add size of Shared Data area ;AN000; + MOV CL,4 ; ;AN000; + SHR DX,CL ; convert to paragraphs ;AN000; + INC DX ; and add 1 ;AN000; +;------Set AX to DOS exit function call - (COPY_SHARED_DATA will exit to DOS) ;AN000; + MOV AH,31H ; Function call to terminate but stay ;AN000; + XOR AL,AL ; resident ;AN000; + .ELSE ;AN000; + MOV AH,4CH ; Function call to terminate ;AN000; + XOR AL,AL ; (EXIT to calling process) ;AN000; + .ENDIF ;AN000; + ;AN000; +;-------------------------------------------------------------------------------;AN000; +; Copy the temporary shared data area in the resident code ;AN000; +;-------------------------------------------------------------------------------;AN000; + MOV CX,CS:[BP].SD_TOTAL_SIZE; CX := MOVSB count for COPY_SHARED_DATA ;AN000; + MOV SI,BP ; DS:SI := Temporary Shared data area ;AN000; + PUSH RESIDENT_CODE_SEG ; ES:DI := Resident Shared data area: ;AN000; + POP ES ; ;AN000; + .IF ; If not installed ;AN000; + .THEN ; then, ;AN000; + MOV DI,END_OF_RESIDENT_CODE; DI := End of resident code ;AN000; + MOV BP,DI ; BP := New resident Shared data area ;AN000; + MOV SHARED_DATA_AREA_PTR,DI; Update pointer to resident Shar. area ;AN000; + .ELSE ; else, ;AN000; + MOV DI,SHARED_DATA_AREA_PTR ; DI := Existing Shared data area ;AN000; + MOV BP,DI ; BP = DI:= Existing Shared data area ;AN000; + .ENDIF ;AN000; + JMP COPY_SHARED_DATA ; Jump to proc that copies area in new ;AN000; + ; part of memory and exits to DOS ;AN000; +ERROR_EXIT: ;AN000; + .IF ; If we are already installed, re-enable ;AN000; + MOV ES,RESIDENT_CODE_SEG ; print screens ;AN000; + MOV ES:PRINT_SCREEN_ALLOWED,YES ;AN000; + .ENDIF ; ;AN000; + ; ;AN000; + MOV AH,4CH ; Function call to terminate ;AN000; + MOV AL,1 ; (EXIT to calling process) ;AN000; + INT 21H ;AN000; +GRAPHICS_INSTALL ENDP ;AN000; + ;AN000; +PAGE ;AN000; +;===============================================================================;AN000; +; ;AN000; +; INST_EGA_SAVE_AREA : INSTALL A DYNAMIC SAVE AREA FOR THE EGA PALETTE REGISTERS;AN000; +; ;AN000; +;-------------------------------------------------------------------------------;AN000; +; ;AN000; +; INPUT: DS = Data segment for our code ;AN000; +; END_OF_RESIDENT_CODE = Offset of the end of the resident code ;AN000; +; ;AN000; +; OUTPUT: END_OF_RESIDENT_CODE is updated to point to the end of the code ;AN000; +; that will stay resident. ;AN000; +; SAVE_AREA_PTR in BIOS segment is updated. ;AN000; +; ;AN000; +;-------------------------------------------------------------------------------;AN000; +;; ;AN000; +;; Data Structures Referenced: ;AN000; +;; Shared Data Area ;AN000; +;; ;AN000; +;; Description: ;AN000; +;; ************* The EGA Dynamic Save Area will be built over top ;AN000; +;; ** NOTE ** of the profile loading modules (file GRLOAD.ASM) ;AN000; +;; ************* to avoid having to relocate this area just before ;AN000; +;; terminating. This is safe since the maximum memory used is ;AN000; +;; 288 bytes and the profile loading modules are MUCH larger than ;AN000; +;; this. So GRLOAD.ASM MUST be linked before GRINST.ASM and after ;AN000; +;; GRPRINT.ASM. ;AN000; +;; ;AN000; +;; BIOS will update the dynamic save area whenener it's aware the palette ;AN000; +;; registers have been updated. ;AN000; +;; ;AN000; +;; BIOS 4A8H BIOS SAVE EGA DYNAMIC ;AN000; +;; POINTER: POINTER TABLE SAVE AREA ;AN000; +;; Ŀ Ŀ (16 first bytes are the 16 ;AN000; +;; *> EGA palette registers) ;AN000; +;; Ĵ Ŀ ;AN000; +;; *>Ĵ ;AN000; +;; Ĵ Ĵ ;AN000; +;; Ĵ ;AN000; +;; Ĵ . ;AN000; +;; . ;AN000; +;; Ĵ . 256 bytes ;AN000; +;; . ;AN000; +;; Ĵ . ;AN000; +;; Ĵ ;AN000; +;; Ĵ Ĵ ;AN000; +;; Ĵ ;AN000; +;; Ĵ Ĵ ;AN000; +;; Ĵ ;AN000; +;; ;AN000; +;; ;AN000; +;; Called By: ;AN000; +;; GRAPHICS_INSTALL ;AN000; +;; ;AN000; +;; External Calls: ;AN000; +;; ;AN000; +;; Logic: ;AN000; +;; IF EGA Dynamic Save Area NOT established THEN ;AN000; +;; /* Required since default table is in ROM */ ;AN000; +;; IF Save Table is in ROM ;AN000; +;; Replicate all the Save Area Table in resident RAM just before ;AN000; +;; the Shared Data Area ;AN000; +;; ENDIF ;AN000; +;; Allocate 256 bytes for EGA Dynamic Save Area just before the ;AN000; +;; Shared Data Area ;AN000; +;; Update END_OF_RESIDENT_CODE ;AN000; +;; ENDIF ;AN000; +;; RETURN ;AN000; +;; ;AN000; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;AN000; + ;; ;AN000; +BIOS_SAVE_PTR EQU 4A8H ;; Offset of the BIOS Save Ptr area ;AN000; +SAVE_AREA_LEN EQU 8*4 ;; There are 8 pointers in the Save area ;AN000; +EGA_DYNAMIC_LEN EQU 256 ;; Length of the EGA dynamic save area ;AN000; +; Standard default colours for the Enhanced Graphics Adapter: (rgbRGB values) ;AN000; +; The following table is necessary in order to initialize the EGA DYNAMIC ;AN000; +; SAVE AREA when creating it. ;AN000; +EGA_DEFAULT_COLORS DB 00h ;; Black ;AN000; + DB 01h ;; Blue ;AN000; + DB 02h ;; Green ;AN000; + DB 03h ;; Cyan ;AN000; + DB 04h ;; Red ;AN000; + DB 05h ;; Magenta ;AN000; + DB 14h ;; Brown ;AN000; + DB 07h ;; White ;AN000; + DB 38h ;; Dark Grey ;AN000; + DB 39h ;; Light Blue ;AN000; + DB 3Ah ;; Light Green ;AN000; + DB 3Bh ;; Light Cyan ;AN000; + DB 3Ch ;; Light Red ;AN000; + DB 3Dh ;; Light Magenta ;AN000; + DB 3Eh ;; Yellow ;AN000; + DB 3Fh ;; Bright white ;AN000; + DB 00h ;; OVERSCAN register ;AN000; + ;AN000; +INST_EGA_SAVE_AREA PROC NEAR ;AN000; +PUSH AX ;AN000; +PUSH CX ;AN000; +PUSH DX ;AN000; +PUSH SI ;AN000; +PUSH DI ;AN000; +PUSH ES ;AN000; +;-------------------------------------------------------------------------------;AN000; +; Get the BIOS save pointer table ;AN000; +;-------------------------------------------------------------------------------;AN000; +XOR AX,AX ; ES := segment 0 ;AN000; +MOV ES,AX ;AN000; +LES SI,ES:DWORD PTR BIOS_SAVE_PTR ; ES:[SI] =Current BIOS save table ;AN000; +.IF < EQ 0> AND ; IF the dynamic save are pointer is ;AN000; +.IF < EQ 0> ; null then, it's not defined ;AN000; +.THEN ; and we have to define it: ;AN000; + ;---------------------------------------------------------------------------;AN000; + ; The Dynamic EGA save area is NOT DEFINED: ;AN000; + ;---------------------------------------------------------------------------;AN000; + MOV BYTE PTR ES:[SI]+4,0FFH ; Try to write a byte in the table ;AN000; + PUSH AX ; (PUSH AX, POP AX used to create a ;AN000; + POP AX ; small delay) ;AN000; + .IF < NE 0FFH>;If we can't read our byte back then, ;AN000; + .THEN ; the Save Ptrs table is in ROM ;AN000; + ;------------------------------------------------------------------------;AN000; + ; The Save pointer table is in ROM; ;AN000; + ; Copy the BIOS save pointer table from ROM to within our .COM file ;AN000; + ;------------------------------------------------------------------------;AN000; + PUSH ES ; DS:SI := Offset of BIOS save ptrs table ;AN000; + POP DS ; ;AN000; + PUSH CS ; ES:DI := The next available location ;AN000; + POP ES ; for installing resident code ;AN000; + MOV DI,CS:END_OF_RESIDENT_CODE ; within our .COM file ;AN000; + MOV CS:OUR_SAVE_TAB_OFF,DI ; ;AN000; + MOV CX,SAVE_AREA_LEN ; CX := Length of the table to copy ;AN000; + REP MOVSB ; Replicate the Save Table ;AN000; + PUSH CS ;AN000; + POP DS ; Reestablish our data segment ;AN000; + ;------------------------------------------------------------------------;AN000; + ; Adjust END_OF_RESIDENT_CODE to the next offset available for copying ;AN000; + ; resident code and data. ;AN000; + ;------------------------------------------------------------------------;AN000; + ADD END_OF_RESIDENT_CODE,SAVE_AREA_LEN ;AN000; + ;------------------------------------------------------------------------;AN000; + ; Set the pointer in OUR Save ptr table to our EGA dynamic save area ;AN000; + ; which we create right after the Save pointer table. ;AN000; + ;------------------------------------------------------------------------;AN000; + MOV DI,OUR_SAVE_TAB_OFF ; DS:[DI] := Our BIOS save ptr tab ;AN000; + MOV AX,END_OF_RESIDENT_CODE; Store its offset ;AN000; + MOV DS:[DI]+4,AX ; ;AN000; + MOV WORD PTR DS:[DI]+6,DS ; Store its segment ;AN000; + ;------------------------------------------------------------------------;AN000; + ; Initialize our DYNAMIC SAVE AREA with the 16 standard EGA colors ;AN000; + ;------------------------------------------------------------------------;AN000; + ;AN000; + LEA SI,EGA_DEFAULT_COLORS ; DS:[SI] := EGA 16 Default colors ;AN000; + MOV DI,END_OF_RESIDENT_CODE ; ES:[DI] := DYNAMIC SAVE AREA ;AN000; + MOV CX,17 ; CX := Number of colors ;AN000; + REP MOVSB ; Initialize the Dynamic save area ;AN000; + ;------------------------------------------------------------------------;AN000; + ; Set the BIOS Save Pointer to our table of Save pointers: ;AN000; + ;------------------------------------------------------------------------;AN000; + CLI ;AN000; + XOR AX,AX ; ES:BIOS_SAVE_PTR := Our save table: ;AN000; + MOV ES,AX ;AN000; + MOV AX,OUR_SAVE_TAB_OFF ;AN000; + MOV ES:BIOS_SAVE_PTR,AX ;AN000; + MOV ES:BIOS_SAVE_PTR+2,DS ;AN000; + STI ;AN000; + .ELSE ; ELSE save pointer table is in RAM ;AN000; + ;------------------------------------------------------------------------;AN000; + ; ELSE, the BIOS save pointer table is in RAM: ;AN000; + ;------------------------------------------------------------------------;AN000; + ;------------------------------------------------------------------------;AN000; + ; Set the pointer in THEIR Save ptr table to OUR EGA dynamic save area ;AN000; + ;------------------------------------------------------------------------;AN000; + MOV WORD PTR ES:[SI]+6,DS ; ES:[SI] = The existing table in RAM ;AN000; + MOV AX,END_OF_RESIDENT_CODE ;AN000; + MOV ES:[SI]+4,AX ;AN000; + .ENDIF ; ENDIF save pointer table is in ROM ;AN000; + ;-----------------------------------------------------------------------------;AN000; + ; Adjust END_OF_RESIDENT_CODE to the next offset available for copying ;AN000; + ; resident code and data. ;AN000; + ;-----------------------------------------------------------------------------;AN000; + ADD END_OF_RESIDENT_CODE,EGA_DYNAMIC_LEN ;AN000; +.ENDIF ;AN000; +POP ES ;AN000; +POP DI ;AN000; +POP SI ;AN000; +POP DX ;AN000; +POP CX ;AN000; +POP AX ;AN000; + ;AN000; +RET ;AN000; +OUR_SAVE_TAB_OFF DW ? ;AN000; +INST_EGA_SAVE_AREA ENDP ;AN000; +PAGE ;AN000; +;===============================================================================;AN000; +; ;AN000; +; CHAIN_INTERRUPTS : INSTALL INT 5 AND INT 2FH VECTORS ;AN000; +; ;AN000; +;-------------------------------------------------------------------------------;AN000; +; ;AN000; +; INPUT: DS = Data segment for our code ;AN000; +; END_OF_RESIDENT_CODE = Offset of the end of the resident code ;AN000; +; ;AN000; +; OUTPUT: OLD_INT_2FH (within INT_2FH_DRIVER) ;AN000; +; BIOS_INT_5H (within PRT_SCR module) ;AN000; +; END_OF_RESIDENT_CODE is updated to point to the end of the code ;AN000; +; that will stay resident. ;AN000; +; SAVE_AREA_PTR in BIOS segment is updated if an EGA adapter is found ;AN000; +; ;AN000; +;-------------------------------------------------------------------------------;AN000; +;; ;AN000; +;; Data Structures Referenced: ;AN000; +;; Shared Data Area ;AN000; +;; ;AN000; +;; Description: ;AN000; +;; Install Interrupts 5 and 2FH. The old vectors are saved. ;AN000; +;; ;AN000; +;; Called By: ;AN000; +;; GRAPHICS_INSTALL ;AN000; +;; ;AN000; +;; External Calls: ;AN000; +;; DOS INT 21H Replace vector AH=25h ;AN000; +;; DOS INT 21H Get vector AH=35h ;AN000; +;; ;AN000; +;; Logic: ;AN000; +;; Save interrupt 5 vector in BIOS_INT_5H ;AN000; +;; Point interrupt 5 to PRT_SCR module ;AN000; +;; Save interrupt 2FH vector in BIOS_INT_2FH ;AN000; +;; Point interrupt 2FH to INT_2FH_DRIVER module ;AN000; +;; RETURN ;AN000; +;; ;AN000; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;AN000; + ;; ;AN000; +CHAIN_INTERRUPTS PROC NEAR ;; ;AN000; + PUSH ES ;AN000; + PUSH BX ;AN000; + ;AN000; +;-------------------------------------------------------------------------------;AN000; +; Replace INTERRUPT 5 vector ;AN000; +;-------------------------------------------------------------------------------;AN000; + MOV AH,35H ; Get vector for ;AN000; + MOV AL,5 ; interrupt 5 request ;AN000; + INT 21H ; Call DOS ;AN000; + ;AN000; + MOV BIOS_INT_5H,BX ; Save the old vector ;AN000; + MOV BIOS_INT_5H+2,ES ;AN000; + ;AN000; + MOV DX,OFFSET PRT_SCR ; DS:DX := Offset of our Print Screen ;AN000; + ;AN000; + MOV AH,25H ; Replace vector for ;AN000; + MOV AL,5 ; interrupt 5 request ;AN000; + INT 21H ; Call DOS ;AN000; + ;AN000; +;-------------------------------------------------------------------------------;AN000; +; Replace INTERRUPT 2FH vector ;AN000; +;-------------------------------------------------------------------------------;AN000; + MOV AH,35H ; Get vector for ;AN000; + MOV AL,2FH ; interrupt 2FH request ;AN000; + INT 21H ; Call DOS ;AN000; + ;AN000; + MOV WORD PTR OLD_INT_2FH,BX ; Save the old vector ;AN000; + MOV WORD PTR OLD_INT_2FH+2,ES ;AN000; + ;AN000; + MOV DX,OFFSET INT_2FH_DRIVER; DS:DX := Offset of our 2FH handler ;AN000; + ;AN000; + MOV AH,25H ; Replace vector for ;AN000; + MOV AL,2FH ; interrupt 2FH request ;AN000; + INT 21H ; Call DOS ;AN000; + ;AN000; + POP BX ;AN000; + POP ES ;AN000; + RET ;AN000; +CHAIN_INTERRUPTS ENDP ;AN000; + ;AN000; +;===============================================================================;AN000; +; ;AN000; +; COPY_PRINT_MODULES: COPY THE SET OF PRINT MODULES NEEDED OVER THE PREVIOUS ONE;AN000; +; ;AN000; +;-------------------------------------------------------------------------------;AN000; +; ;AN000; +; INPUT: BP = Offset of the temporary Shared Data area ;AN000; +; END_OF_RESIDENT_CODE = Location of the set of COLOR modules ;AN000; +; (if first time installed) ;AN000; +; CS:[BP].PRINTER_TYPE = Printer type NEEDED ;AN000; +; RESIDENT_CODE_SEG = Segment containing the resident code ;AN000; +; ;AN000; +; OUTPUT: END_OF_RESIDENT_CODE = End of the print modules IS UPDATED ;AN000; +; (If first time installed) ;AN000; +; ;AN000; +;-------------------------------------------------------------------------------;AN000; +;; ;AN000; +;; Data Structures Referenced: ;AN000; +;; Control Variables ;AN000; +;; Shared Data Area ;AN000; +;; ;AN000; +;; Description: ;AN000; +;; This module trashes one set of print modules (Color or Black & White) ;AN000; +;; depending on the type of printer attached. Since the Shared Data ;AN000; +;; (resident version) will reside immediately after the print modules, ;AN000; +;; END_OF_RESIDENT_CODE will be set by this modules. ;AN000; +;; ;AN000; +;; The set of COLOR modules is already at the rigth located when installing ;AN000; +;; GRAPHICS for the first time. This is true since, the color modules are ;AN000; +;; linked before the black and white modules. ;AN000; +;; ;AN000; +;; Therefore, if we are installing GRAPHICS for the first time and we need ;AN000; +;; the color modules then, we do not need to relocate any print modules. ;AN000; +;; ;AN000; +;; When installing GRAPHICS again we first check what is the resident set, ;AN000; +;; we recopy a new set only if needed. ;AN000; +;; ;AN000; +;; Called By: ;AN000; +;; GRAPHICS_INSTALL ;AN000; +;; ;AN000; +;; Logic: ;AN000; +;; IF color printer THEN ;AN000; +;; SI := Offset of BW_PRINT_MODULES ;AN000; +;; ELSE ;AN000; +;; SI := Offset of COLOR_PRINT_MODULES ;AN000; +;; ENDIF ;AN000; +;; REP MOVSB ; Copy the set of modules ;AN000; +;; END_OF_RESIDENT_CODE := end of the set of modules ;AN000; +;; RETURN ;AN000; +;; ;AN000; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;AN000; +COPY_PRINT_MODULES PROC NEAR ;AN000; + PUSH AX ;AN000; + PUSH BX ;AN000; + PUSH CX ;AN000; + PUSH SI ;AN000; + PUSH DI ;AN000; + PUSH ES ;AN000; + ;AN000; +;-------------------------------------------------------------------------------;AN000; +; Determine if we need to relocate the set of print modules, if so, set the ;AN000; +; source address (DS:SI), the destination address (ES:DI) and the number of ;AN000; +; bytes to copy (CX). ;AN000; +;-------------------------------------------------------------------------------;AN000; + PUSH CS:RESIDENT_CODE_SEG ; ES := Segment containing the resident ;AN000; + POP ES ; code (Where to copy modules) ;AN000; + MOV DI,OFFSET PRINT_MODULE_START ; ES:[DI] := Resident print modules ;AN000; + ;AN000; + .IF ; IF not installed ;AN000; + .THEN ; THEN, ;AN000; + ; We relocate the print modules ;AN000; + ; at the end of the resident code: ;AN000; + ; (this is where the color set is) ;AN000; + .IF ; IF we don't want the color set ;AN000; + .THEN ; THEN, ;AN000; + MOV NEED_NEW_PRINT_MODULES,YES ; Say we need new modules ;AN000; + MOV SI,OFFSET PRINT_BW_APA ; DS:[SI] := Black and white modules;AN000; + MOV CX,LEN_OF_BW_MODULES ; CX := Length of B&W modules ;AN000; + .ENDIF ; ;AN000; + ;AN000; + .ELSE ; ELSE, (We are already installed) ;AN000; + MOV BX,SHARED_DATA_AREA_PTR ; BX := Offset of Shared Data area ;AN000; + MOV AL,ES:[BX].PRINTER_TYPE ; AL := Type of the resident set ;AN000; + .IF ; IF resident set is not the one ;AN000; + .THEN ; we need THEN, ;AN000; + MOV NEED_NEW_PRINT_MODULES,YES ; Say we need a new set. ;AN000; + .IF ; IF its color we need then, ;AN000; + MOV SI,OFFSET PRINT_COLOR ; DS:[SI] := Color set ;AN000; + MOV CX,LEN_OF_COLOR_MODULES ; CX := Length of color mod. ;AN000; + .ELSE ; ELSE ;AN000; + MOV SI,OFFSET PRINT_BW_APA ; DS:[SI] := B&W set ;AN000; + MOV CX,LEN_OF_BW_MODULES ; CX := Length of B&W mod. ;AN000; + .ENDIF ; ENDIF we need the color set ;AN000; + .ENDIF ; ENDIF we need a new set ;AN000; + .ENDIF ; ENDIF we are not installed ;AN000; + ;AN000; + ;AN000; +;-------------------------------------------------------------------------------;AN000; +; If needed: Copy the required set of print modules ;AN000; +;-------------------------------------------------------------------------------;AN000; + .IF ;AN000; + .THEN ;AN000; + CLD ; Clear the direction flag ;AN000; + REP MOVSB ; Copy the set of print modules ;AN000; + .ENDIF ; ENDIF needs to copy the print modules ;AN000; + ;AN000; +;-------------------------------------------------------------------------------;AN000; +; Set END_OF_RESIDENT_CODE pointer to the end of the print modules: ;AN000; +; (Reserve enough space to store the larger set of modules on a ;AN000; +; subsequent install) ;AN000; +;-------------------------------------------------------------------------------;AN000; + .IF ; IF first time installed ;AN000; + .THEN ; THEN, ;AN000; + MOV CX,LEN_OF_COLOR_MODULES ; Adjust END_OF_RESIDENT_CODE to ;AN000; + .IF ; contains the larger set of modules. ;AN000; + .THEN ; ;AN000; + ADD END_OF_RESIDENT_CODE,LEN_OF_COLOR_MODULES ;AN000; + .ELSE ;AN000; + ADD END_OF_RESIDENT_CODE,LEN_OF_BW_MODULES ;AN000; + .ENDIF ; ;AN000; + .ENDIF ;AN000; + ;AN000; + POP ES ;AN000; + POP DI ;AN000; + POP SI ;AN000; + POP CX ;AN000; + POP BX ;AN000; + POP AX ;AN000; + RET ;AN000; +NEED_NEW_PRINT_MODULES DB NO ; True if print modules needed must be ;AN000; + ; copied over the other set of print ;AN000; + ; modules ;AN000; +COPY_PRINT_MODULES ENDP ;AN000; + ;AN002; +PAGE ;AN002; +;===============================================================================;AN002; +; ;AN002; +; PROCEDURE_NAME: RELEASE_ENVIRONMENT ;AN002; +; ;AN002; +; INPUT: None. ;AN002; +; ;AN002; +; OUTPUT: Environment vector released. ;AN002; +; ;AN002; +;-------------------------------------------------------------------------------;AN002; +RELEASE_ENVIRONMENT PROC NEAR ;AN002; + PUSH AX ; save regs ;AN002; + PUSH BX ;AN002; + PUSH ES ;AN002; + MOV AH,62H ; function for get the PSP segment ;AN002; + INT 21H ; invoke INT 21h ;AN002; + MOV ES,BX ; BX contains PSP segment - put in ES ;AN002; + MOV BX,WORD PTR ES:[2CH] ; get segment of environmental vector ;AN002; + MOV ES,BX ; place segment in ES for Free Memory ;AN002; + MOV AH,49H ; Free Allocated Memory function call ;AN002; + INT 21H ; invoke INT 21h ;AN002; + POP ES ; restore regs ;AN002; + POP BX ;AN002; + POP AX ;AN002; + RET ;AN002; +RELEASE_ENVIRONMENT ENDP ;AN002; + ;AN000; +PAGE ;AN000; +;===============================================================================;AN000; +; ;AN000; +; PROCEDURE_NAME: DISP_ERROR ;AN000; +; ;AN000; +; INPUT: AX := GRAPHICS message number (documented in GRMSG.EQU) ;AN000; +; CX := Number of substitutions (Needed by SYSDISPMSG) ;AN000; +; DS:[SI] := Substitution list (needed only if CX <> 0) ;AN000; +; ;AN000; +; OUTPUT: Error message is displayed on STANDARD ERROR OUTPUT (STDERR) ;AN000; +; ;AN000; +;-------------------------------------------------------------------------------;AN000; +DISP_ERROR PROC NEAR ;AN000; + PUSH BX ;AN000; + PUSH DI ;AN000; + PUSH SI ;AN000; + PUSH BP ;AN000; + ;AN000; + MOV BX,ERROR_DEVICE ; Issue message to standard error ;AN000; + XOR DL,DL ; No input ;AN000; + MOV DH,UTILITY_MSG_CLASS;It's one of our messages ;AN000; + CALL SYSDISPMSG ; display error message ;AN000; + ;AN000; + POP BP ;AN000; + POP SI ;AN000; + POP DI ;AN000; + POP BX ;AN000; + RET ;AN000; +DISP_ERROR ENDP ;AN000; + +include msgdcl.inc ;AN000; + ;AN000; +CODE ENDS ;AN000; + END ;AN000; diff --git a/v4.0/src/CMD/GRAPHICS/GRINST.EXT b/v4.0/src/CMD/GRAPHICS/GRINST.EXT new file mode 100644 index 0000000..75b8137 --- /dev/null +++ b/v4.0/src/CMD/GRAPHICS/GRINST.EXT @@ -0,0 +1,43 @@ +.XLIST ;AN000; +PAGE ,132 ;AN000; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;AN000; +;; DOS - GRAPHICS Command +;; (C) Copyright 1988 Microsoft +;; ;AN000; +;; File Name: GRINST.EXT ;AN000; +;; ---------- ;AN000; +;; ;AN000; +;; Description: ;AN000; +;; ------------ ;AN000; +;; External declarations for code and data defined in ;AN000; +;; GRINIT.ASM ;AN000; +;; ;AN000; +;; Change History: ;AN000; +;; --------------- ;AN000; +;; ;AN000; +;; ;AN000; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;AN000; + ;; ;AN000; + EXTRN GRAPHICS_INSTALL:NEAR ;; ;AN000; + EXTRN SYSDISPMSG:NEAR ;; ;AN000; + EXTRN DISP_ERROR:NEAR ;; ;AN000; + EXTRN TEMP_SHARED_DATA_PTR:WORD ;; ;AN000; + ;; ;AN000; + EXTRN PRINTER_TYPE_PARM:BYTE ;; ;AN000; + EXTRN PRINTER_TYPE_LENGTH:BYTE ;; ;AN000; + EXTRN INSTALLED:BYTE ;; ;AN000; + EXTRN PROFILE_PATH:BYTE ;; ;AN000; + EXTRN PRINTBOX_ID_PTR:WORD ;; ;AN000; + EXTRN PRINTBOX_ID_LENGTH:BYTE ;; ;AN000; + EXTRN DEFAULT_BOX:BYTE ;; ;AN000; + EXTRN LCD_BOX:BYTE ;; ;AN000; + EXTRN ERROR_DEVICE:WORD ;; ;AN000; + ;; ;AN000; + EXTRN STDERR:ABS ;; ;AN000; + EXTRN STDOUT:ABS ;; ;AN000; + ;; ;AN000; + EXTRN NB_FREE_BYTES:WORD ;; ;AN000; + EXTRN RESIDENT_SHARED_DATA_SIZE:WORD;; ;AN000; + ;; ;AN000; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;AN000; +.LIST ;AN000; diff --git a/v4.0/src/CMD/GRAPHICS/GRINT2FH.ASM b/v4.0/src/CMD/GRAPHICS/GRINT2FH.ASM new file mode 100644 index 0000000..b195c25 --- /dev/null +++ b/v4.0/src/CMD/GRAPHICS/GRINT2FH.ASM @@ -0,0 +1,146 @@ + PAGE ,132 ;AN000; + TITLE DOS - GRAPHICS Command - Interrupt 2FH Driver ;AN000; + ;AN000; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;AN000; +;; DOS - GRAPHICS Command +;; (C) Copyright 1988 Microsoft +;; ;AN000; +;; File Name: GRINT2FH.ASM ;AN000; +;; ---------- ;AN000; +;; ;AN000; +;; Description: ;AN000; +;; ------------ ;AN000; +;; This file contains the Interrupt 2FH driver. ;AN000; +;; ;AN000; +;; Documentation Reference: ;AN000; +;; ------------------------ ;AN000; +;; OASIS High Level Design ;AN000; +;; OASIS GRAPHICS I1 Overview ;AN000; +;; ;AN000; +;; Procedures Contained in This File: ;AN000; +;; ---------------------------------- ;AN000; +;; INT_2FH_DRIVER - Interrupt 2FH driver ;AN000; +;; ;AN000; +;; Include Files Required: ;AN000; +;; ----------------------- ;AN000; +;; GRLOAD.EXT - Externals for profile load ;AN000; +;; GRCTRL.EXT - Externals for print screen control ;AN000; +;; GRPRINT.EXT - Externals for print modules ;AN000; +;; GRCPSD.EXT - Externals for COPY_SHARED_DATA module ;AN000; +;; ;AN000; +;; External Procedure References: ;AN000; +;; ------------------------------ ;AN000; +;; Calls next Int 2FH handler in the chain. ;AN000; +;; ;AN000; +;; Linkage Instructions: ;AN000; +;; -------------------- ;AN000; +;; Refer to GRAPHICS.ASM ;AN000; +;; ;AN000; +;; Change History: ;AN000; +;; --------------- ;AN000; +;; ;AN000; +;; ;AN000; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;AN000; + ;; ;AN000; + ;; ;AN000; +CODE SEGMENT PUBLIC 'CODE' ;; ;AN000; + ASSUME CS:CODE,DS:CODE ;; ;AN000; + ;; ;AN000; + PUBLIC OLD_INT_2FH ;; ;AN000; + PUBLIC INT_2FH_DRIVER ;; ;AN000; + PUBLIC PRT_SCR_2FH_NUMBER ;; ;AN000; + PUBLIC RESIDENT_CODE_SEG ;; ;AN000; + PUBLIC SHARED_DATA_AREA_PTR ;; ;AN000; + ;; ;AN000; + ;; ;AN000; +.XLIST ;AN000; +INCLUDE STRUC.INC ;AN000; +INCLUDE GRINST.EXT ;AN000; +INCLUDE GRCTRL.EXT ;AN000; +INCLUDE GRCPSD.EXT ;AN000; +.LIST ;AN000; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;AN000; +;; ;AN000; +;; Module: INT_2FH_DRIVER ;AN000; +;; ;AN000; +;; Description: ;AN000; +;; Respond to GRAPHICS Int 2FH calls. ;AN000; +;; The following calls are handled: ;AN000; +;; ;AN000; +;; AL = 0 Install Check ;AN000; +;; ;AN000; +;; Invoked By: ;AN000; +;; INT 2FH instruction. ;AN000; +;; ;AN000; +;; Modules Called: ;AN000; +;; Lower level INT 2FH handlers. ;AN000; +;; ;AN000; +;; Input Registers: ;AN000; +;; Install Check - AH=15H AL=0 ;AN000; +;; ;AN000; +;; ;AN000; +;; Output Registers: ;AN000; +;; Install Check: IF GRAPHICS installed ;AN000; +;; AH=FFH AL=FFH ;AN000; +;; ES : DI points to Shared Data Area ;AN000; +;; ELSE ;AN000; +;; AH=15H AL=0 ;AN000; +;; ;AN000; +;; Logic: ;AN000; +;; IF AH=15H THEN ;AN000; +;; IF AL=0 THEN ;AN000; +;; AH,AL := -1 ;AN000; +;; ES : DI := SHARED_DATA_AREA_PTR ;AN000; +;; ENDIF ;AN000; +;; IRET ;AN000; +;; ELSE ;AN000; +;; IF OLD_INT_2FH is a valid pointer THEN ;AN000; +;; Jump to Old Int 2FH ;AN000; +;; ELSE ;AN000; +;; IRET ;AN000; +;; ENDIF ;AN000; +;; ENDIF ;AN000; +;; ;AN000; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;AN000; + ;AN000; +INT_2FH_DRIVER PROC NEAR ;AN000; + JMP INT_2FH ;AN000; +PRT_SCR_2FH_NUMBER EQU 15H ; 2FH Multiplex interrupt number ;AN000; + ; assigned to Print Screen. ;AN000; +OLD_INT_2FH DD ? ; Pointer to next 2FH interrupt handler ;AN000; +RESIDENT_CODE_SEG DW ? ; Segment for installed stuff ;AN000; +SHARED_DATA_AREA_PTR DW ? ; Offset of the start of the ;AN000; + ; Shared Data Area ;AN000; + ;AN000; +INT_2FH: ;AN000; +;-------------------------------------------------------------------------------;AN000; +; Verify if the 2FH Interrupt call is for our interrupt handler: ;AN000; +;-------------------------------------------------------------------------------;AN000; + .IF AND;If 2FH call is for us ;AN000; + .IF ; and request is "Get install state" ;AN000; + .THEN ; then, ;AN000; +;-------------------------------------------------------------------------------;AN000; +; Yes: return results ;AN000; +;-------------------------------------------------------------------------------;AN000; + MOV DI,CS:SHARED_DATA_AREA_PTR ; ES:DI := Pointer to shared ;AN000; + PUSH CS:RESIDENT_CODE_SEG ; data area ;AN000; + POP ES ; ;AN000; + MOV AH,0FFH ; AL and AH := "We are installed" ;AN000; + MOV AL,AH ; ;AN000; + IRET ; Return to interrupted process ;AN000; +;-------------------------------------------------------------------------------;AN000; +; No, pass control to next 2FH interrupt handler: ;AN000; +;-------------------------------------------------------------------------------;AN000; + .ELSE ; else, this call is not for us: ;AN000; + .IF < NE 0> AND ;if there is another ;AN000; + .IF < NE 0> ; 2FH driver ;AN000; + .THEN ; below us then, ;AN000; + JMP CS:OLD_INT_2FH ; pass control to it ;AN000; + .ELSE ; else, there is nobody to pass ;AN000; + IRET ; control to, just return. ;AN000; + .ENDIF ; END If there is a driver below us.;AN000; + .ENDIF ; END If this call is for us. ;AN000; +INT_2FH_DRIVER ENDP ;AN000; + ;AN000; +CODE ENDS ;AN000; + END ;AN000; diff --git a/v4.0/src/CMD/GRAPHICS/GRINT2FH.EXT b/v4.0/src/CMD/GRAPHICS/GRINT2FH.EXT new file mode 100644 index 0000000..54d69c2 --- /dev/null +++ b/v4.0/src/CMD/GRAPHICS/GRINT2FH.EXT @@ -0,0 +1,26 @@ +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;AN000; +;; DOS - GRAPHICS Command +;; (C) Copyright 1988 Microsoft +;; ;AN000; +;; File Name: GRINT2FH.EXT ;AN000; +;; ---------- ;AN000; +;; ;AN000; +;; Description: ;AN000; +;; ------------ ;AN000; +;; External declarations for code and data defined in ;AN000; +;; GRINT2FH.ASM ;AN000; +;; ;AN000; +;; Change History: ;AN000; +;; --------------- ;AN000; +;; ;AN000; +;; ;AN000; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;AN000; + ;; ;AN000; + EXTRN OLD_INT_2FH:DWORD ;; ;AN000; + EXTRN INT_2FH_DRIVER:NEAR ;; ;AN000; + EXTRN PRT_SCR_2FH_NUMBER:ABS ;; ;AN000; + EXTRN SHARED_DATA_AREA_PTR:WORD ;AN000; + EXTRN RESIDENT_CODE_SEG:WORD ;AN000; + ;; ;AN000; + ;; ;AN000; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;AN000; diff --git a/v4.0/src/CMD/GRAPHICS/GRLOAD.ASM b/v4.0/src/CMD/GRAPHICS/GRLOAD.ASM new file mode 100644 index 0000000..dd16ca4 --- /dev/null +++ b/v4.0/src/CMD/GRAPHICS/GRLOAD.ASM @@ -0,0 +1,840 @@ + PAGE ,132 ;AN000; + TITLE DOS - GRAPHICS Command - Profile Load Modules ;AN000; + ;AN000; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;AN000; +;; DOS - GRAPHICS Command +;; (C) Copyright 1988 Microsoft +;; ;AN000; +;; File Name: GRLOAD.ASM ;AN000; +;; ---------- ;AN000; +;; ;AN000; +;; Description: ;AN000; +;; ------------ ;AN000; +;; This file contains the modules used to load the ;AN000; +;; GRAPHICS profile into resident memory. ;AN000; +;; ;AN000; +;; ************* The EGA Dynamic Save Area will be built (by ;AN000; +;; ** NOTE ** CHAIN_INTERRUPTS in file GRINST.ASM) over top of these ;AN000; +;; ************* modules to avoid having to relocate this save just before ;AN000; +;; terminating. This is safe since the maximum memory used is ;AN000; +;; 288 bytes and the profile loading modules are MUCH larger than ;AN000; +;; this. So GRLOAD.ASM MUST be linked before GRINST.ASM and after ;AN000; +;; GRPRINT.ASM. ;AN000; +;; ;AN000; +;; ;AN000; +;; Documentation Reference: ;AN000; +;; ------------------------ ;AN000; +;; PLACID Functional Specifications ;AN000; +;; OASIS High Level Design ;AN000; +;; OASIS GRAPHICS I1 Overview ;AN000; +;; ;AN000; +;; Procedures Contained in This File: ;AN000; +;; ---------------------------------- ;AN000; +;; LOAD_PROFILE - Main module for profile loading ;AN000; +;; ;AN000; +;; Include Files Required: ;AN000; +;; ----------------------- ;AN000; +;; ?????????? - Externals for profile loading modules ;AN000; +;; ;AN000; +;; External Procedure References: ;AN000; +;; ------------------------------ ;AN000; +;; None ;AN000; +;; ;AN000; +;; Linkage Instructions: ;AN000; +;; --------------------- ;AN000; +;; Refer to GRAPHICS.ASM ;AN000; +;; ;AN000; +;; Change History: ;AN000; +;; --------------- ;AN000; +;; ;AN000; +;; ;AN000; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;AN000; + ;; ;AN000; + ;; ;AN000; +CODE SEGMENT PUBLIC 'CODE' BYTE ;; ;AN000; + ;; ;AN000; + INCLUDE STRUC.INC ;; ;AN000; + INCLUDE GRINST.EXT ;; Bring in external declarations ;AN000; + ;; for transient command processing ;AN000; + INCLUDE GRSHAR.STR ;; ;AN000; + INCLUDE GRPARSE.EXT ;; ;AN000; + INCLUDE GRLOAD2.EXT ;; ;AN000; + INCLUDE GRLOAD3.EXT ;; ;AN000; + INCLUDE GRMSG.EQU ;; ;AN000; + ;; ;AN000; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;AN000; +;; ;AN000; +;; Public Symbols ;AN000; +;; ;AN000; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;AN000; + ;; ;AN000; + PUBLIC LOAD_PROFILE ;AN000; + PUBLIC GROW_SHARED_DATA ;AN000; + PUBLIC BLOCK_START ;AN000; + PUBLIC BLOCK_END ;AN000; + PUBLIC FIRST_BLOCK ;AN000; + PUBLIC MAX_BLOCK_END ;AN000; + PUBLIC GROUPS_DONE ;AN000; + PUBLIC STMTS_DONE ;AN000; + PUBLIC STMTS_DONE ;AN000; + PUBLIC PTD_FOUND ;AN000; + PUBLIC BUILD_STATE ;AN000; + PUBLIC STMT_ERROR ;AN000; + PUBLIC FILE_ERROR ;AN000; + PUBLIC PARSE_ERROR ;AN000; + PUBLIC END_OF_FILE ;AN000; + PUBLIC MEM_OVERFLOW ;AN000; + PUBLIC STMT_BUFFER ;AN000; + PUBLIC CUR_STMT ;AN000; + PUBLIC PREV_STMT ;AN000; + PUBLIC PRT_BOX_ERROR ;AN000; + ;; ;AN000; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;AN000; + ;; ;AN000; + ASSUME CS:CODE,DS:CODE ;; ;AN000; + ;; ;AN000; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;AN000; + ;; ;AN000; + ;; ;AN000; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;AN000; +;; ;AN000; +;; Profile Load Variables ;AN000; +;; ;AN000; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;AN000; + ;; ;AN000; +NO EQU 0 ;; ;AN000; +YES EQU 1 ;; ;AN000; + ;; ;AN000; + ;; ;AN000; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;AN000; +;; ;AN000; +;; Module Name: ;AN000; +;; LOAD_PROFILE ;AN000; +;; ;AN000; +;; Input Parameters: ;AN000; +;; DS,ES,SS - points to our transient segment ;AN000; +;; ;AN000; +;; Output Parameters: ;AN000; +;; Temporary Shared Data Area ;AN000; +;; Carry flag set if errors in profile. ;AN000; +;; ;AN000; +;; Data Structures Referenced: ;AN000; +;; Shared Data Area ;AN000; +;; Profile Load Variables ;AN000; +;; ;AN000; +;; Description: ;AN000; +;; Build the profile information in the Temporary Shared Data Area. ;AN000; +;; The information will be built for the printer type parsed off ;AN000; +;; the command line. ALL Printer Type Descriptions will be ;AN000; +;; parsed to issue error messages and determine the maximum ;AN000; +;; amount of resident memory required for initial load. ;AN000; +;; The Shared Data Area begins with a fixed length section ;AN000; +;; and then has several variable length sections. PROFILE_BUILD_PTR ;AN000; +;; is used to build the variable length sections by serving ;AN000; +;; as a running pointer to the sections as they are built. ;AN000; +;; ;AN000; +;; Register Usage: ;AN000; +;; BP - points to beginning of Temp Shared Data ;AN000; +;; ;AN000; +;; Called By: ;AN000; +;; GRAPHICS_INSTALL ;AN000; +;; ;AN000; +;; External Calls: ;AN000; +;; PARSE_PRINTER, PARSE_DISPLAYMODE, PARSE_SETUP, PARSE_RESTORE ;AN000; +;; PARSE_PRINTBOX, PARSE_GRAPHICS, PARSE_COLORSELECT, ;AN000; +;; PARSE_COLORPRINT, GET_STATEMENT ;AN000; +;; SYSPARSE ;AN000; +;; ;AN000; +;; Logic: ;AN000; +;; IF profile path not specified THEN ;AN000; +;; PROFILE_PATH := "GRAPHICS.PRO" /* Current directory */ ;AN000; +;; Open profile using PROFILE_PATH ;AN000; +;; IF error during open THEN ;AN000; +;; PROFILE_PATH := ARG(V0) with "GRAPHICS.COM" replaced ;AN000; +;; by "GRAPHICS.PRO" ;AN000; +;; Open profile using PROFILE_PATH ;AN000; +;; IF error during open THEN ;AN000; +;; Issue "Cannot find profile" msg ;AN000; +;; Set carry flag ;AN000; +;; RETURN ;AN000; +;; ENDIF ;AN000; +;; ENDIF ;AN000; +;; ELSE ;AN000; +;; Open profile using specified path ;AN000; +;; IF error during open THEN ;AN000; +;; Issue "Cannot find profile" msg ;AN000; +;; Set carry flag ;AN000; +;; RETURN ;AN000; +;; ENDIF ;AN000; +;; ENDIF ;AN000; +;; /* don't start building until we find our printer type*/ ;AN000; +;; PARSE_MODE := NOBUILD ;AN000; +;; MAX_BUILD_PTR := 0 ;AN000; +;; CALL GROW_SHARED_DATA(PROFILE-BUILD_PTR,size of FIXED PART ;AN000; +;; of Shared Data Area) ;AN000; +;; WHILE (not end of file) AND (no I/O error) DO ;AN000; +;; CALL GET_STATEMENT ;AN000; +;; IF I/O error THEN ;AN000; +;; Issue error message ;AN000; +;; ELSE ;AN000; +;; CALL SYSPARSE to parse the statement verb ;AN000; +;; IF verb found THEN ;AN000; +;; IF invalid verb THEN ;AN000; +;; Issue error message ;AN000; +;; PARSE_MODE := ERROR ;AN000; +;; ELSE ;AN000; +;; CASE statement verb ;AN000; +;; PRINTER: ;AN000; +;; CALL PARSE_PRINTER ;AN000; +;; DISPLAYMODE: ;AN000; +;; CALL PARSE_DISPLAYMODE ;AN000; +;; PRINTBOX: ;AN000; +;; CALL PARSE_PRINTBOX ;AN000; +;; SETUP: ;AN000; +;; CALL PARSE_SETUP ;AN000; +;; RESTORE: ;AN000; +;; CALL PARSE_RESTORE ;AN000; +;; GRAPHICS: ;AN000; +;; CALL PARSE_GRAPHICS ;AN000; +;; COLORPRINT: ;AN000; +;; CALL PARSE_COLORPRINT ;AN000; +;; COLORSELECT: ;AN000; +;; CALL PARSE_COLORSELECT ;AN000; +;; ENDCASE ;AN000; +;; IF error on statement THEN ;AN000; +;; IF OVERFLOW bit set in RETURN_CODE THEN ;AN000; +;; Issue "Insufficient memory" message ;AN000; +;; RETURN to caller ;AN000; +;; ELSE ;AN000; +;; IF MISSING bit set in RETURN_CODE THEN ;AN000; +;; Issue "required statement missing" message ;AN000; +;; ENDIF ;AN000; +;; IF INVALID bit set in RETURN_CODE THEN ;AN000; +;; Issue "statement invalid" message ;AN000; +;; ENDIF ;AN000; +;; IF SEQUENCE bit set in RETURN_CODE THEN ;AN000; +;; Issue "out of sequence" message ;AN000; +;; ENDIF ;AN000; +;; display the statement in error ;AN000; +;; ENDIF ;AN000; +;; PARSE_MODE := ERROR ;AN000; +;; ENDIF ;AN000; +;; ENDIF ;AN000; +;; ENDIF ;AN000; +;; ENDIF ;AN000; +;; ENDWHILE ;AN000; +;; ;AN000; +;; /* Check length of last PTD */ ;AN000; +;; IF PROFILE_BUILD_PTR > MAX_BUILD_PTR THEN ;AN000; +;; MAX_BUILD_PTR := PROFILE_BUILD_PTR ;AN000; +;; ENDIF ;AN000; +;; ;AN000; +;; /* Make sure all required statements were in previous */ ;AN000; +;; /* Printer Type Description */ ;AN000; +;; /* Must have completed PRINTER, DISPLAYMODE, PRINTBOX and */ ;AN000; +;; /* GRAPHICS statements */ ;AN000; +;; IF PRT+DISP+BOX+GR bits not all set in STMTS_DONE THEN ;AN000; +;; Issue "required statement missing" message ;AN000; +;; Display "END OF FILE." ;AN000; +;; ENDIF ;AN000; +;; ;AN000; +;; IF errors during build THEN ;AN000; +;; set carry flag ;AN000; +;; ELSE ;AN000; +;; SD_TOTAL_SIZE := MAX_BUILD_PTR - TEMP_SHARED_DATA_PTR ;AN000; +;; ENDIF ;AN000; +;; RETURN ;AN000; +;; ;AN000; +;; ;AN000; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;AN000; + ;; ;AN000; +FILE_NOT_FOUND EQU 2 ;; DOS Int21H error codes ;AN000; +PATH_NOT_FOUND EQU 3 ;; ;AN000; + ;; ;AN000; +SUBLIST LABEL BYTE ;; Message substituion list for stmt # ;AN000; + DB 11 ;; sublist size ;AN000; + DB 0 ;; ;AN000; + DW STMT_NUM ;; \ Dword pointer to item ;AN000; +SUBLIST_SEG DW ? ;; / ;AN000; + DB 1 ;; Substitution # ;AN000; +;; Flag format a0sstttt ;; ;AN000; + DB 00100001B ;; Unsigned binary word - left align ;AN000; +;;;; DB 00000000B ;; charcater ;AN000; + DB 0 ;; max field width ;AN000; + DB 1 ;; min width width ;AN000; + DB ' ' ;; pad characeter ;AN000; + ;; ;AN000; +STMT_NUM DW 0 ;; ;AN000; + ;; ;AN000; + ;; ;AN000; +FILE_ERROR DB 0 ;; Error opening or reading PROFILE ;AN000; +PARSE_ERROR DB 0 ;; Syntax errors in PROFILE ;AN000; +END_OF_FILE DB 0 ;; 1 if end of file ;AN000; +MEM_OVERFLOW DB 0 ;; 1 if insufficient memory ;AN000; + ;; ;AN000; +STMT_ERROR DB 0 ;; Error flag for individual stmt errors ;AN000; +MISSING EQU 1 ;; Required statement missing ;AN000; +INVALID EQU 2 ;; Invalid statement format ;AN000; +SEQUENCE EQU 4 ;; Statement out of sequence ;AN000; + ;; ;AN000; +DEFAULT_PATH DB "GRAPHICS.PRO",0 ;; ;AN000; +BUFFER DB 64 DUP("$") ;; ;AN000; + ;; ;AN000; +HANDLE DW 0 ;; Profile handle ;AN000; + ;; ;AN000; +BUILD_STATE DB 0 ;; 1 if we are currently building ;AN000; + ;; data. 0 means syntax checking ;AN000; + ;; only ;AN000; + ;; ;AN000; + ;; Keep track of whether this PTD ;AN000; + ;; matches the type requested ;AN000; +PTD_FOUND DB 0 ;; Values are NO (0), YES (1) and ;AN000; +PROCESSED EQU 2 ;; PROCESSED (2) ;AN000; + ;; ;AN000; +VERB DB 0 ;; PTR into VERB_JMP_TAB ;AN000; + ;; ;AN000; +VERB_JMP_TAB LABEL WORD ;; ;AN000; + DW OFFSET PARSE_PRINTER ;; ;AN000; + DW OFFSET PARSE_DISPLAYMODE ;; ;AN000; + DW OFFSET PARSE_PRINTBOX ;; ;AN000; + DW OFFSET PARSE_SETUP ;; ;AN000; + DW OFFSET PARSE_RESTORE ;; ;AN000; + DW OFFSET PARSE_GRAPHICS ;; ;AN000; + DW OFFSET PARSE_COLORPRINT ;; ;AN000; + DW OFFSET PARSE_COLORSELECT ;; ;AN000; + DW OFFSET PARSE_DARKADJUST ;; ;AN000; + ;; ;AN000; +STMTS_DONE DW 0 ;; ;AN000; +GROUPS_DONE DW 0 ;; ;AN000; +PREV_STMT DW 0 ;; ;AN000; +CUR_STMT DW 0 ;; ;AN000; + ;; ;AN000; +PRT EQU 1 ;; Bit masks for STMTS_DONE and ;AN000; +DISP EQU 2 ;; GROUPS_DONE. There is one ;AN000; +BOX EQU 4 ;; bit for each statement except ;AN000; +GR EQU 8 ;; DARKADJUST ;AN000; +SET EQU 10H ;; ;AN000; +REST EQU 20H ;; ;AN000; +COLS EQU 40H ;; ;AN000; +COLP EQU 80H ;; ;AN000; +DARK EQU 100H ;; ;AN000; + ;; ;AN000; +BLOCK_START DW ? ;; Extents of the variable size block ;AN000; +BLOCK_END DW ? ;; currently being built ;AN000; + ;; These are relative to the ;AN000; + ;; start of the Shared Data Area ;AN000; + ;; so the area can be relocated ;AN000; +MAX_BLOCK_END DW 0 ;; End of largest PTD contained ;AN000; + ;; in profile ;AN000; +FIRST_BLOCK DW ? ;; Pointer to first variable block ;AN000; + ;; (end of fixed part) ;AN000; +PRT_BOX_ERROR DB 0 ;; ;AN000; + ;; ;AN000; +LOAD_PROFILE PROC NEAR ;; ;AN000; + ;; ;AN000; + PUSH CS ;; ;AN000; + POP SUBLIST_SEG ;; setup segment for message sublist ;AN000; + ;; ;AN000; + CALL OPEN_FILE ;; ;AN000; + .IF ;; Check for error during open ;AN000; + STC ;; ;AN000; + RET ;; ;AN000; + .ENDIF ;; ;AN000; + ;; ;AN000; + MOV BP,TEMP_SHARED_DATA_PTR ;; BP points to START of Shared Data ;AN000; + MOV AX,SIZE SHARED_DATA_AREA_STR ;; size of fixed part of Shared Data ;AN000; + MOV BLOCK_END,0 ;; Initialize BLOCK_START,BLOCK_END ;AN000; + MOV [BP].DARKADJUST_VALUE,0 ;; Init some values in the fixed ;AN000; + MOV [BP].NUM_PRT_COLOR,0 ;; area ;AN000; + MOV [BP].COLORPRINT_PTR,-1 ;; ;AN000; + MOV [BP].NUM_PRT_BANDS,0 ;; ;AN000; + MOV [BP].COLORSELECT_PTR,-1 ;; ;AN000; + MOV [BP].PRINTER_TYPE,BLACK_WHITE ;; ;AN000; + CALL GROW_SHARED_DATA ;; to the first byte after the ;AN000; + ;; fixed part of Shared Data ;AN000; + MOV AX,BLOCK_END ;; Variable size data will be built ;AN000; + MOV BLOCK_START,AX ;; starting at BLOCK_START ;AN000; + MOV FIRST_BLOCK,AX ;; Save start of variable data ;AN000; + ;; ;AN000; + MOV SI,BUFFER_PTR ;; Set up SI for GET_BYTE ;AN000; + CALL GET_BYTE ;; Get first byte from file ;AN000; + MOV NEXT_BYTE,AL ;; and store it ;AN000; + MOV BUFFER_PTR,SI ;; Save SI for next GET_BYTE ;AN000; + .WHILE AND ;; Keep parsing until end of file or ;AN000; + .WHILE ;; file error occurs ;AN000; + MOV STMT_ERROR,0 ;; Clear parse error flags ;AN000; + CALL GET_STATEMENT ;; Get next profile statement ;AN000; + INC STMT_NUM ;; ;AN000; + .IF NC ;; Carry flag set if get unsuccessful ;AN000; + CALL PARSE_VERB ;; Index into verb jump table returned ;AN000; + ;; in BX ;AN000; + .IF THEN ;; AX=0 if there is a recognized ;AN000; + MOV AX,CUR_STMT ;; ;AN000; + MOV PREV_STMT,AX ;; Save last statement verb ;AN000; + CALL VERB_JMP_TAB[BX] ;; statement to parse ;AN000; + .ELSEIF THEN ;; ;AN000; + OR STMT_ERROR,INVALID ;; ;AN000; + MOV PARSE_ERROR,YES ;; ;AN000; + MOV BUILD_STATE,NO ;; ;AN000; + .ENDIF ;; ;AN000; + .IF ;; An error was detected ;AN000; + CALL SHOW_PARSE_ERROR ;; ;AN000; + MOV PARSE_ERROR,YES ;; ;AN000; + MOV STMT_ERROR,0 ;; ;AN000; + .ENDIF ;; ;AN000; + .ENDIF ;; ;AN000; + .ENDWHILE ;; ;AN000; + ;; ;AN000; + .IF ;; Must have at least one PRINTER ;AN000; + CALL TERMINATE_DISPLAYMODE ;; Terminate the last PRINTER and ;AN000; + CALL TERMINATE_PRINTER ;; DISPLAYMODE sections ;AN000; + .ELSE ;; ;AN000; + OR STMT_ERROR,MISSING ;; ;AN000; + .ENDIF ;; ;AN000; + .IF ;; ;AN000; + CALL SHOW_PARSE_ERROR ;; Issue Profile syntax messages ;AN000; + .ENDIF ;; ;AN000; + ;; ;AN000; + ;; ;AN000; + MOV AX,3E00H ;; Close the file ;AN000; + MOV BX,HANDLE ;; ;AN000; + INT 21H ;; ;AN000; + ;; ;AN000; + .IF ;; ;AN000; + MOV AX,SYNTAX_ERRORS ;; Issue "Syntax errors found in ;AN000; + MOV CX,0 ;; profile" message. ;AN000; + CALL DISP_ERROR ;; ;AN000; + .ENDIF ;; ;AN000; + ;; ;AN000; + .IF ;; Did we find the requested printer ;AN000; + MOV AX,INVALID_PRT ;; type? If not issue error ;AN000; + MOV CX,0 ;; message. ;AN000; + CALL DISP_ERROR ;; ;AN000; + MOV PARSE_ERROR,YES ;; ;AN000; + .ENDIF ;; ;AN000; + ;; ;AN000; + .IF OR ;; ;AN000; + .IF OR ;; ;AN000; + .IF ;; Set carry flag if profile load ;AN000; + STC ;; was unsuccessful ;AN000; + .ELSE ;; ;AN000; + .IF ;; Everthing else was OK BUT we ran ;AN000; + .IF ;; out of memory!!! ;AN000; + MOV AX,NB_FREE_BYTES ;; ;AN000; + .IF ;AN000; + MOV AX,NO_MEMORY ;; We ran out of physical memory! ;AN000; + .ELSE ;; ;AN000; + MOV AX,UNABLE_RELOAD ;; Allocated shared data is too small ;AN000; + .ENDIF ;; ;AN000; + .ELSE ;; ;AN000; + MOV AX,NO_MEMORY ;; We ran out of physical memory ;AN000; + .ENDIF ;; ;AN000; + MOV CX,0 ;; ;AN000; + CALL DISP_ERROR ;; ;AN000; + STC ;; Indicate unsuccessful ;AN000; + .ELSE ;; ;AN000; + MOV AX,MAX_BLOCK_END ;; Extent of largest PRINTER section ;AN000; + MOV [BP].SD_TOTAL_SIZE,AX ;; we parsed. ;AN000; + CLC ;; SUCCESSFUL LOAD!!!! ;AN000; + .ENDIF ;; ;AN000; + .ENDIF ;; ;AN000; + ;; ;AN000; + RET ;; ;AN000; + ;; ;AN000; +LOAD_PROFILE ENDP ;; ;AN000; + ;; ;AN000; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;AN000; +;; ;AN000; +;; Module Name: ;AN000; +;; SHOW_PARSE_ERROR ;AN000; +;; ;AN000; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;AN000; + ;; ;AN000; +CARRAIGE_RET EQU 13 ;; ;AN000; +LINE_FEED EQU 10 ;; ;AN000; + ;; ;AN000; +SHOW_PARSE_ERROR PROC ;; ;AN000; + ;; ;AN000; + MOV ERROR_DEVICE,STDOUT ;; profile syntax messages to STDOUT ;AN000; + ;; ;AN000; + .IF ;AN000; + PUSH SI ;; ;AN000; + MOV AX,MISSING_STMT ;; ;AN000; + MOV CX,1 ;; ;AN000; + MOV SI,OFFSET SUBLIST ;; ;AN000; + CALL DISP_ERROR ;; ;AN000; + POP SI ;; ;AN000; + .ENDIF ;; ;AN000; + .IF ;AN000; + PUSH SI ;; ;AN000; + MOV AX,INVALID_STMT ;; ;AN000; + MOV CX,1 ;AN000; + MOV SI,OFFSET SUBLIST ;; ;AN000; + CALL DISP_ERROR ;; ;AN000; + POP SI ;; ;AN000; + .ENDIF ;; ;AN000; + .IF ;AN000; + PUSH SI ;; ;AN000; + MOV AX,OUT_SEQ_STMT ;; ;AN000; + MOV CX,1 ;AN000; + MOV SI,OFFSET SUBLIST ;; ;AN000; + CALL DISP_ERROR ;; ;AN000; + POP SI ;; ;AN000; + .ENDIF ;; ;AN000; + ;; ;AN000; + MOV DI,STMT_END_INDEX ;; ;AN000; + MOV STMT_BUFFER[DI],'$' ;; For display ;AN000; + MOV AH,9 ;; ;AN000; + MOV DX,OFFSET STMT_BUFFER ;AN000; + INT 21H ;; ;AN000; + MOV DL,CARRIAGE_RET ;; ;AN000; + MOV AH,2 ;; ;AN000; + INT 21H ;; ;AN000; + MOV DL,LINE_FEED ;; ;AN000; + MOV AH,2 ;; ;AN000; + INT 21H ;; ;AN000; + ;; ;AN000; + MOV ERROR_DEVICE,STDERR ;; reset to STDERR ;AN000; + ;; ;AN000; + RET ;; ;AN000; + ;; ;AN000; +SHOW_PARSE_ERROR ENDP ;; ;AN000; + ;; ;AN000; + ;; ;AN000; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;AN000; +;; ;AN000; +;; Module Name: ;AN000; +;; OPEN_FILE ;AN000; +;; ;AN000; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;AN000; + ;; ;AN000; + ;; ;AN000; +OPEN_FILE PROC NEAR ;; ;AN000; + ;; ;AN000; + .IF ;; If a path was specified then ;AN000; + MOV DX,OFFSET PROFILE_PATH ;; try and open it ;AN000; + MOV AX,3D00H ;; ;AN000; + INT 21H ;; Open it ;AN000; + .IF C ;; Open error if carry flag set ;AN000; + .IF OR ;; Check for error other than ;AN000; + .IF ;; file not found ;AN000; + MOV AX,PROFILE_NOT_FOUND ;; ;AN000; + MOV CX,0 ;; ;AN000; + CALL DISP_ERROR ;; Issue "File not found" common msg ;AN000; + MOV FILE_ERROR,YES ;; ;AN000; + .ELSE ;; ;AN000; + CALL FILE_ERROR_PROC ;; Issue "Open error" ;AN000; + .ENDIF ;; ;AN000; + .ELSE ;; ;AN000; + MOV HANDLE,AX ;; ;AN000; + .ENDIF ;; File opened OK ;AN000; + .ELSE ;; No path parameter ;AN000; + MOV DX,OFFSET DEFAULT_PATH ;; Try and open "GRAPHICS.PRO" ;AN000; + MOV AX,3D00H ;; ;AN000; + INT 21H ;; Open it ;AN000; + .IF C ;; Open error if carry flag set ;AN000; + .IF OR ;; Check for file not found error ;AN000; + .IF ;; ;AN000; + CALL COPY_ARGV0 ;; ;AN000; + MOV DX,OFFSET PROFILE_PATH ;; Try and open "GRAPHICS.PRO" in ;AN000; + MOV AX,3D00H ;; ARGV0 directory ;AN000; + INT 21H ;; ;AN000; + .IF C ;; Issue "File not found" common msg ;AN000; + .IF OR ;AN000; + .IF ;AN000; + MOV AX,PROFILE_NOT_FOUND ;; ;AN000; + MOV CX,0 ;; ;AN000; + CALL DISP_ERROR ;; Issue "File not found"common MSG;AN000; + MOV FILE_ERROR,YES ;; ;AN000; + .ELSE ;; ;AN000; + CALL FILE_ERROR_PROC ;; Issue "Open error" ;AN000; + .ENDIF ;; ;AN000; + .ELSE ;; ;AN000; + MOV HANDLE,AX ;; ;AN000; + .ENDIF ;; File opened OK ;AN000; + .ELSE ;; ;AN000; + CALL FILE_ERROR_PROC ;; Issue "Open error" ;AN000; + .ENDIF ;; ;AN000; + .ELSE ;; ;AN000; + MOV HANDLE,AX ;; ;AN000; + .ENDIF ;; ;AN000; + .ENDIF ;; ;AN000; + ;; ;AN000; + RET ;; ;AN000; +OPEN_FILE ENDP ;; ;AN000; + ;; ;AN000; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;AN000; +;; ;AN000; +;; Module Name: ;AN000; +;; COPY_ARGV0 ;AN000; +;; ;AN000; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;AN000; + ;; ;AN000; + ;; ;AN000; +COPY_ARGV0 PROC ;; ;AN000; + ;; ;AN000; + PUSH ES ;; ;AN000; + PUSH DI ;; ;AN000; + PUSH SI ;; ;AN000; + ;; ;AN000; + MOV DI,2CH ;; Locate environment string ;AN000; + MOV ES,[DI] ;; ;AN000; + XOR SI,SI ;; ;AN000; + .WHILE < NE 0> ;; ;AN000; + INC SI ;; ;AN000; + .ENDWHILE ;; ;AN000; + ADD SI,4 ;; ;AN000; + LEA DI,PROFILE_PATH ;; Move string to work area ;AN000; + .REPEAT ;; ;AN000; + MOV AL,ES:[SI] ;; ;AN000; + MOV [DI],AL ;; ;AN000; + INC SI ;; ;AN000; + INC DI ;; ;AN000; + .UNTIL < EQ 0> ;; ;AN000; + MOV BYTE PTR [DI],0 ;; ;AN000; + MOV BYTE PTR [DI]-3,"P" ;; Change COM to PRO ;AN000; + MOV BYTE PTR [DI]-2,"R" ;; ;AN000; + MOV BYTE PTR [DI]-1,"O" ;; ;AN000; + ;; ;AN000; + POP SI ;; ;AN000; + POP DI ;; ;AN000; + POP ES ;; ;AN000; + RET ;; ;AN000; + ;; ;AN000; +COPY_ARGV0 ENDP ;; ;AN000; + ;; ;AN000; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;AN000; +;; ;AN000; +;; Module Name: ;AN000; +;; FILE_ERROR_PROC ;AN000; +;; ;AN000; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;AN000; + ;; ;AN000; + ;; ;AN000; +FILE_ERROR_PROC PROC ;; ;AN000; + MOV AX,FILE_ERRORS ;; ;AN000; + MOV CX,0 ;; ;AN000; + CALL DISP_ERROR ;; ;AN000; + MOV FILE_ERROR,YES ;; ;AN000; + RET ;; ;AN000; +FILE_ERROR_PROC ENDP ;; ;AN000; + ;; ;AN000; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;AN000; +;; ;AN000; +;; Module Name: ;AN000; +;; GET_STATEMENT ;AN000; +;; ;AN000; +;; Input Parameters: ;AN000; +;; NONE ;AN000; +;; ;AN000; +;; Output Parameters: ;AN000; +;; PROFILE_LINE ;AN000; +;; RETURN CODE : 0 - successfull read ;AN000; +;; : 1 - end of file ;AN000; +;; : 2 - error during read ;AN000; +;; ;AN000; +;; ;AN000; +;; Data Structures Referenced: ;AN000; +;; ;AN000; +;; Description: ;AN000; +;; Get a statement from the profile. ;AN000; +;; The file read in 512 byte buffers and parsed into ;AN000; +;; lines by the presence of a carriage return at the end of each line. ;AN000; +;; ;AN000; +;; Called By: ;AN000; +;; LOAD_PROFILE ;AN000; +;; ;AN000; +;; External Calls: ;AN000; +;; NONE ;AN000; +;; ;AN000; +;; Logic: ;AN000; +;; FOUND := FALSE ;AN000; +;; RETURN_CODE := 0 ;AN000; +;; WHILE NOT FOUND DO ;AN000; +;; IF end of buffer THEN ;AN000; +;; Read next profile record into buffer ;AN000; +;; IF successful read THEN ;AN000; +;; point to first byte in buffer ;AN000; +;; ELSE ;AN000; +;; IF end of file THEN ;AN000; +;; Close profile ;AN000; +;; RETURN_CODE := 1 ;AN000; +;; FOUND := TRUE ;AN000; +;; ELSE ;AN000; +;; RETURN_CODE := 2 ;AN000; +;; FOUND := TRUE ;AN000; +;; ENDIF ;AN000; +;; ENDIF ;AN000; +;; ENDIF ;AN000; +;; copy byte to PROFILE_LINE ;AN000; +;; IF byte in buffer is a CR THEN ;AN000; +;; FOUND := TRUE ;AN000; +;; ENDIF ;AN000; +;; ENDWHILE ;AN000; +;; RETURN ;AN000; +;; ;AN000; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;AN000; + ;; ;AN000; +FOUND DB 0 ;; ;AN000; + ;; ;AN000; +CARRIAGE_RET EQU 13 ;; ;AN000; +LINE_FEED EQU 10 ;; ;AN000; +NEXT_BYTE DB 0 ;; Save area for byte just read ;AN000; +BUFFER_SIZE EQU 512 ;; ;AN000; +FILE_BUFFER DB 512 DUP(0) ;; ;AN000; +BUFFER_PTR DW 512 ;; ;AN000; +BUFFER_END DW 512 ;; ;AN000; +STMT_BUFFER DB 255 DUP(0) ;; ;AN000; + DB ? ;; In case we have to insert a CR ;AN000; + DB ? ;; and a LF ;AN000; + DB ? ;; Too put the "$" for displaying the ;AN000; + ;; line. ;AN000; + ;; ;AN000; +STMT_END_INDEX DW ? ;; ;AN000; +MAX_STMT_LEN EQU 255 ;; ;AN000; +CR_FOUND DB 0 ;; 1 if we found a line terminator ;AN000; + ;; ;AN000; +GET_STATEMENT PROC ;; ;AN000; + ;; ;AN000; + MOV FOUND,NO ;; ;AN000; + MOV STMT_ERROR,0 ;; Clear error flags ;AN000; + XOR DI,DI ;; Index for extracted statement ;AN000; + MOV SI,BUFFER_PTR ;; Init file buffer ptr ;AN000; + ;; ;AN000; + MOV AL,NEXT_BYTE ;; Restore current byte ;AN000; + MOV CR_FOUND,NO ;; ;AN000; + ;; ;AN000; + ;; ;AN000; + .WHILE AND ;; Keep parsing until we find a stmt ;AN000; + .WHILE AND ;; or a file error occurs ;AN000; + .WHILE ;; or we reach end of file ;AN000; + .IF ;; ;AN000; + .IF ;; Return the line feed as well ;AN000; + .IF ;; Truncate lines longer than MAX ;AN000; + MOV STMT_BUFFER[DI],AL ;; MOVE TO statement buffer ;AN000; + INC DI ;; Point to next byte in file buffr ;AN000; + .ELSE ;; ;AN000; + OR STMT_ERROR,INVALID ;; Line has been truncated > ERROR ;AN000; + MOV PARSE_ERROR,YES ;; ;AN000; + MOV BUILD_STATE,NO ;; ;AN000; + .ENDIF ;; ;AN000; + CALL GET_BYTE ;; Get the first byte of next statement ;AN000; + .ENDIF ;; ;AN000; + MOV FOUND,YES ;; Time to leave this WHILE ;AN000; + MOV NEXT_BYTE,AL ;; Save the byte we just read ;AN000; + .ELSE ;; ;AN000; + .IF ;; Truncate lines longer than MAX ;AN000; + MOV STMT_BUFFER[DI],AL ;; move byte to statement buffer ;AN000; + INC DI ;; Point to next byte in file buffer ;AN000; + .ELSE ;; ;AN000; + OR STMT_ERROR,INVALID ;; Line has been truncated > ERROR ;AN000; + MOV PARSE_ERROR,YES ;; ;AN000; + MOV BUILD_STATE,NO ;; ;AN000; + .ENDIF ;; ;AN000; + .IF ;; Found a line terminator ;AN000; + MOV CR_FOUND,YES ;; Indicate carriage return found ;AN000; + .ENDIF ;; and go through once more to ;AN000; + CALL GET_BYTE ;; check for a line feed ;AN000; + .ENDIF ;; ;AN000; + .ENDWHILE ;; ;AN000; + ;; ;AN000; + .IF AND ;; ;AN000; + .IF ;; ;AN000; + MOV STMT_BUFFER[DI],CARRIAGE_RET ;; ;AN000; + MOV STMT_BUFFER[DI+1],LINE_FEED ;; ;AN000; + INC DI ;; ;AN000; + INC DI ;; ;AN000; + .ENDIF ;; ;AN000; + MOV STMT_END_INDEX,DI ;; ;AN000; + MOV BUFFER_PTR,SI ;; Save buffer ptr for next time ;AN000; + ;; ;AN000; + .IF ;; ;AN000; + .IF ;; Clear carry if we read something ;AN000; + STC ;; and no file error occured otherwise ;AN000; + .ELSE ;; set carry indicating unsuccessful ;AN000; + CLC ;; get. ;AN000; + .ENDIF ;; ;AN000; + .ELSE ;; ;AN000; + .IF ;; ;AN000; + STC ;; ;AN000; + .ELSE ;; ;AN000; + CLC ;; ;AN000; + .ENDIF ;; ;AN000; + .ENDIF ;; ;AN000; + RET ;; ;AN000; + ;; ;AN000; +GET_STATEMENT ENDP ;; ;AN000; + ;; ;AN000; + ;; ;AN000; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;AN000; +;; ;AN000; +;; Module Name: ;AN000; +;; GET_BYTE ;AN000; +;; ;AN000; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;AN000; + ;; ;AN000; +GET_BYTE PROC ;; ;AN000; + ;; ;AN000; + .IF ;; If buffer empty do another read ;AN000; + MOV AH,3FH ;; ;AN000; + MOV DX,OFFSET FILE_BUFFER ;; ;AN000; + MOV CX,BUFFER_SIZE ;; ;AN000; + MOV BX,HANDLE ;; ;AN000; + INT 21H ;; ;AN000; + .IF C ;; Carry set by DOS if file error ;AN000; + CALL FILE_ERROR_PROC ;; ;AN000; + .ELSE ;; ;AN000; + .IF ;; End of file if AX=0 ;AN000; + MOV END_OF_FILE,YES ;; ;AN000; + MOV AH,3EH ;; Close the file ;AN000; + MOV BX,HANDLE ;; ;AN000; + INT 21H ;; ;AN000; + .ELSE ;; ;AN000; + MOV BUFFER_END,AX ;; Number of bytes read ;AN000; + XOR SI,SI ;; Buffer pointer := 0 ;AN000; + .ENDIF ;; ;AN000; + .ENDIF ;; ;AN000; + .ENDIF ;; ;AN000; + ;; ;AN000; + .IF OR ;; ;AN000; + .IF ;; ;AN000; + STC ;; Unsuccessful get ;AN000; + .ELSE ;; ;AN000; + .IF < EQ 1AH> ;; cHECK for EOF marker ;AN000; + MOV END_OF_FILE,YES ;; ;AN000; + STC ;; ;AN000; + .ELSE ;; ;AN000; + MOV AL,FILE_BUFFER[SI] ;; Return byte in AL ;AN000; + INC SI ;; ;AN000; + CLC ;; Successful get ;AN000; + .ENDIF ;; ;AN000; + .ENDIF ;; ;AN000; + RET ;; ;AN000; + ;; ;AN000; +GET_BYTE ENDP ;; ;AN000; + ;; ;AN000; + ;; ;AN000; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;AN000; +;; ;AN000; +;; Module Name: ;AN000; +;; GROW_SHARED_DATA ;AN000; +;; ;AN000; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;AN000; + ;; ;AN000; +GROW_SHARED_DATA PROC ;; ;AN000; + PUSH BX ;; ;AN000; + ADD BLOCK_END,AX ;; Grow the current block by AX ;AN000; + MOV BX,BLOCK_END ;; ;AN000; + .IF ;; Check for overflow ;AN000; + MOV BUILD_STATE,NO ;; Stop building shared data ;AN000; + MOV MEM_OVERFLOW,YES ;; ;AN000; + .ENDIF ;; ;AN000; + POP BX ;; ;AN000; + RET ;; ;AN000; +GROW_SHARED_DATA ENDP ;; ;AN000; + ;; ;AN000; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;AN000; + ;AN000; +CODE ENDS ;; ;AN000; + END ;AN000; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;AN000; diff --git a/v4.0/src/CMD/GRAPHICS/GRLOAD.EXT b/v4.0/src/CMD/GRAPHICS/GRLOAD.EXT new file mode 100644 index 0000000..ab48e9a --- /dev/null +++ b/v4.0/src/CMD/GRAPHICS/GRLOAD.EXT @@ -0,0 +1,55 @@ +.XLIST ;AN000; + ;AN000; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;AN000; +;; DOS - GRAPHICS Command +;; (C) Copyright 1988 Microsoft +;; ;AN000; +;; File Name: GRLOAD.EXT ;AN000; +;; ---------- ;AN000; +;; ;AN000; +;; Description: ;AN000; +;; ------------ ;AN000; +;; External declarations for code and data defined in ;AN000; +;; GRLOAD.ASM ;AN000; +;; ;AN000; +;; Change History: ;AN000; +;; --------------- ;AN000; +;; ;AN000; +;; ;AN000; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;AN000; + ;; ;AN000; + EXTRN LOAD_PROFILE:NEAR ;; ;AN000; + EXTRN GROW_SHARED_DATA:NEAR ;; ;AN000; + EXTRN BLOCK_START:WORD ;AN000; + EXTRN BLOCK_END:WORD ;AN000; + EXTRN FIRST_BLOCK:WORD ;AN000; + EXTRN MAX_BLOCK_END:WORD ;AN000; + EXTRN GROUPS_DONE:WORD ;AN000; + EXTRN STMTS_DONE:WORD ;AN000; +PRT EQU 1 ;; ;AN000; +DISP EQU 2 ;; ;AN000; +BOX EQU 4 ;; ;AN000; +GR EQU 8 ;; ;AN000; +SET EQU 10H ;; ;AN000; +REST EQU 20H ;; ;AN000; +COLS EQU 40H ;; ;AN000; +COLP EQU 80H ;; ;AN000; +DARK EQU 100H ;; ;AN000; + EXTRN PTD_FOUND:BYTE ;AN000; + PROCESSED EQU 2 ;; ;AN000; + EXTRN BUILD_STATE:BYTE ;AN000; + EXTRN STMT_ERROR:BYTE ;AN000; +MISSING EQU 1 ;; Required statement missing ;AN000; +INVALID EQU 2 ;; Invalid statement format ;AN000; +SEQUENCE EQU 4 ;; Statement out of sequence ;AN000; + EXTRN FILE_ERROR:BYTE ;AN000; + EXTRN PARSE_ERROR:BYTE ;AN000; + EXTRN END_OF_FILE:BYTE ;AN000; + EXTRN MEM_OVERFLOW:BYTE ;AN000; + EXTRN STMT_BUFFER:BYTE ;AN000; + EXTRN CUR_STMT:WORD ;AN000; + EXTRN PREV_STMT:WORD ;AN000; + EXTRN PRT_BOX_ERROR:BYTE ;AN000; + ;; ;AN000; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;AN000; +.LIST ;AN000; diff --git a/v4.0/src/CMD/GRAPHICS/GRLOAD2.ASM b/v4.0/src/CMD/GRAPHICS/GRLOAD2.ASM new file mode 100644 index 0000000..68041ba --- /dev/null +++ b/v4.0/src/CMD/GRAPHICS/GRLOAD2.ASM @@ -0,0 +1,910 @@ + PAGE ,132 ;AN000; + TITLE DOS - GRAPHICS Command - Profile Load Modules #2 ;AN000; + ;AN000; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;AN000; +;; DOS - GRAPHICS Command +;; (C) Copyright 1988 Microsoft +;; ;AN000; +;; File Name: GRLOAD.ASM ;AN000; +;; ---------- ;AN000; +;; ;AN000; +;; Description: ;AN000; +;; ------------ ;AN000; +;; This file contains the modules used to load the ;AN000; +;; GRAPHICS profile into resident memory. ;AN000; +;; ;AN000; +;; ************* The EGA Dynamic Save Area will be built (by ;AN000; +;; ** NOTE ** CHAIN_INTERRUPTS in file GRINST.ASM) over top of these ;AN000; +;; ************* modules to avoid having to relocate this save just before ;AN000; +;; terminating. This is safe since the maximum memory used is ;AN000; +;; 288 bytes and the profile loading modules are MUCH larger than ;AN000; +;; this. So GRLOAD.ASM MUST be linked before GRINST.ASM and after ;AN000; +;; GRPRINT.ASM. ;AN000; +;; ;AN000; +;; ;AN000; +;; Documentation Reference: ;AN000; +;; ------------------------ ;AN000; +;; PLACID Functional Specifications ;AN000; +;; OASIS High Level Design ;AN000; +;; OASIS GRAPHICS I1 Overview ;AN000; +;; ;AN000; +;; Procedures Contained in This File: ;AN000; +;; ---------------------------------- ;AN000; +;; LOAD_PROFILE - Main module for profile loading ;AN000; +;; ;AN000; +;; Include Files Required: ;AN000; +;; ----------------------- ;AN000; +;; ?????????? - Externals for profile loading modules ;AN000; +;; ;AN000; +;; External Procedure References: ;AN000; +;; ------------------------------ ;AN000; +;; None ;AN000; +;; ;AN000; +;; Linkage Instructions: ;AN000; +;; --------------------- ;AN000; +;; Refer to GRAPHICS.ASM ;AN000; +;; ;AN000; +;; Change History: ;AN000; +;; --------------- ;AN000; +;; ;AN000; +;; ;AN000; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;AN000; + ;; ;AN000; + ;; ;AN000; +CODE SEGMENT PUBLIC 'CODE' BYTE ;; ;AN000; + ;; ;AN000; + INCLUDE STRUC.INC ;; ;AN000; + INCLUDE GRINST.EXT ;; Bring in external declarations ;AN000; + ;; for transient command processing ;AN000; + INCLUDE GRSHAR.STR ;; ;AN000; + INCLUDE GRMSG.EQU ;; ;AN000; + INCLUDE GRINST.EXT ;; ;AN000; + INCLUDE GRLOAD.EXT ;; ;AN000; + INCLUDE GRPARSE.EXT ;; ;AN000; + INCLUDE GRPATTRN.STR ;; ;AN000; + INCLUDE GRPATTRN.EXT ;; ;AN000; + ;; ;AN000; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;AN000; +;; ;AN000; +;; Public Symbols ;AN000; +;; ;AN000; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;AN000; + ;; ;AN000; + PUBLIC PARSE_VERB ;; ;AN000; + PUBLIC PARSE_PRINTER ;; ;AN000; + PUBLIC PARSE_DISPLAYMODE ;; ;AN000; + PUBLIC PARSE_PRINTBOX ;; ;AN000; + PUBLIC PARSE_SETUP ;; ;AN000; + PUBLIC PARSE_RESTORE ;; ;AN000; + PUBLIC TERMINATE_DISPLAYMODE ;; ;AN000; + PUBLIC TERMINATE_PRINTER ;; ;AN000; + PUBLIC CUR_PRINTER_TYPE ;; ;AN000; + ;; ;AN000; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;AN000; + ;; ;AN000; + ASSUME CS:CODE,DS:CODE ;; ;AN000; + ;; ;AN000; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;AN000; + ;; ;AN000; + ;; ;AN000; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;AN000; +;; ;AN000; +;; Profile Load Variables ;AN000; +;; ;AN000; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;AN000; + ;; ;AN000; +NO EQU 0 ;; ;AN000; +YES EQU 1 ;; ;AN000; + ;; ;AN000; +RESULT_BUFFER LABEL BYTE ;; general purpose result buffer ;AN000; + DB ? ;; operand type ;AN000; +RESULT_TAG DB 0 ;; operand tag ;AN000; + DW ? ;; pointer to synonym/keyword ;AN000; +RESULT_VAL DB ?,?,?,? ;; returned numeric value ;AN000; + ;; ;AN000; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;AN000; +;; ;AN000; +;; Module Name: ;AN000; +;; TERMINATE_DISPLAYMODE ;AN000; +;; ;AN000; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;AN000; + ;; ;AN000; + ;; ;AN000; +TERMINATE_DISPLAYMODE PROC ;; ;AN000; + ;; ;AN000; + MOV AX,STMTS_DONE ;; ;AN000; + .IF AND ;; For the matched PTD ;AN000; + .IF AND ;; issue "Invalid parm value" ;AN000; + .IF ;; message if PRINTBOX ID not ;AN000; + ;; matched in each DISPLAYMODE section ;AN000; + PUSH AX ;; Save STMT_DONE flags ;AN000; + MOV AX,INVALID_PB ;; ;AN000; + MOV CX,0 ;; ;AN000; + CALL DISP_ERROR ;; ;AN000; + MOV BUILD_STATE,NO ;; ;AN000; + MOV PRT_BOX_ERROR,YES ;; Issue this message only once ;AN000; + POP AX ;; ;AN000; + .ENDIF ;; ;AN000; + AND AX,GR ;; Check for missing statements is last ;AN000; + .IF ;; DISPLAYMODE section: ;AN000; + OR STMT_ERROR,MISSING ;; GRAPHICS stmt is required ;AN000; + MOV PARSE_ERROR,YES ;; ;AN000; + MOV BUILD_STATE,NO ;; ;AN000; + .ENDIF ;; ;AN000; + ;; ;AN000; + ;; ;AN000; + ;; ;AN000; + RET ;; ;AN000; + ;; ;AN000; +TERMINATE_DISPLAYMODE ENDP ;; ;AN000; + ;; ;AN000; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;AN000; +;; ;AN000; +;; Module Name: ;AN000; +;; TERMINATE_PRINTER ;AN000; +;; ;AN000; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;AN000; + ;; ;AN000; +TERMINATE_PRINTER PROC ;; ;AN000; + ;; ;AN000; + MOV AX,BLOCK_END ;; ;AN000; + .IF ;; Keep track of the largest PRINTER ;AN000; + MOV MAX_BLOCK_END,AX ;; section so we can allow space for ;AN000; + .ENDIF ;; reload with a different printer ;AN000; + ;; type. ;AN000; + ;; ;AN000; + ;; Check for missing statements ;AN000; + MOV AX,STMTS_DONE ;; ;AN000; + AND AX,DISP ;; At least one DISPLAYMODE ;AN000; + .IF ;; must have been found in last ;AN000; + OR STMT_ERROR,MISSING ;; PRINTER section ;AN000; + MOV PARSE_ERROR,YES ;; ;AN000; + MOV BUILD_STATE,NO ;; ;AN000; + .ENDIF ;; ;AN000; + ;; ;AN000; + RET ;; ;AN000; + ;; ;AN000; +TERMINATE_PRINTER ENDP ;; ;AN000; + ;; ;AN000; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;AN000; +;; ;AN000; +;; Module Name: ;AN000; +;; PARSE_PRINTER ;AN000; +;; ;AN000; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;AN000; + ;; ;AN000; +PRINTER_PARSE_PARMS LABEL WORD ;; Parser control blocks ;AN000; + DW PRINTER_P ;; ;AN000; + DB 2 ;; # of lists ;AN000; + DB 0 ;; # items in delimeter list ;AN000; + DB 1 ;; # items in end-of-line list ;AN000; + DB ';' ;; ';' used for comments ;AN000; + ;; ;AN000; +PRINTER_P DB 0,1 ;; Required, max parms ;AN000; + DW PRINTER_P1 ;; ;AN000; + DB 0 ;; # Switches ;AN000; + DB 0 ;; # keywords ;AN000; + ;; ;AN000; +PRINTER_P1 DW 2000H ;; simple string ;AN000; + DW 0002H ;; Capitalize using character table ;AN000; + DW RESULT_BUFFER ;; Result buffer ;AN000; + DW PRINTER_P1V ;; Value list ;AN000; + DB 0 ;; Synomyms ;AN000; + ;; ;AN000; +PRINTER_P1V DB 3 ;; # of value lists ;AN000; + DB 0 ;; # of range numerics ;AN000; + DB 0 ;; # of discrete numerics ;AN000; + DB 1 ;; # of strings ;AN000; + DB 1 ;; tag: index into verb jump table ;AN000; +PRINTER_P1V1 DW ? ;; string offset ;AN000; + ;; ;AN000; + ;; ;AN000; +CUR_PRINTER_TYPE DB 0 ;; Type of printer currently being ;AN000; + ;; parsed: 1-color 2-b&w ;AN000; + ;; ;AN000; +PARSE_PRINTER PROC ;; ;AN000; + ;; ;AN000; + MOV CUR_STMT,PRT ;; ;AN000; + MOV CUR_PRINTER_TYPE,BLACK_WHITE ;; Assume black & white until we hit ;AN000; + ;; a COLORPRINT ;AN000; + ;; ;AN000; + .IF ;; If not the first PRINTER section ;AN000; + CALL TERMINATE_DISPLAYMODE ;; then clean up the last one and ;AN000; + CALL TERMINATE_PRINTER ;; the last DISPLAYMODE section. ;AN000; + .ENDIF ;; ;AN000; + ;; ;AN000; + MOV AX,FIRST_BLOCK ;; ;AN000; + MOV BLOCK_START,AX ;; Reset block pointers to start ;AN000; + MOV BLOCK_END,AX ;; of variable area ;AN000; + ;; ;AN000; + MOV STMTS_DONE,PRT ;; Clear all bits except for PRT ;AN000; + MOV GROUPS_DONE,0 ;; Clear ;AN000; + ;; ;AN000; + .IF ;; PRINTER statement marks the end of ;AN000; + MOV PTD_FOUND,PROCESSED ;; the previous PTD ;AN000; + MOV BUILD_STATE,NO ;; Stop building shared data ;AN000; + .ENDIF ;; ;AN000; + ;; ;AN000; + MOV CL,TAB_DIR_NB_ENTRIES ;; Reset the pattern table copy ;AN000; + XOR CH,CH ;; pointers. These pointers ;AN000; + MOV BX,OFFSET TAB_DIRECTORY ;; are established when a pattern ;AN000; + .REPEAT ;; table is copied to the shared ;AN000; + MOV [BX].TAB_COPY,-1 ;; data area. Initially they ;AN000; + ADD BX,SIZE TAB_ENTRY ;; are -1. ;AN000; + .LOOP ;; ;AN000; + ;; ;AN000; + MOV AX,OFFSET PRINTER_TYPE_PARM ;; Store printer type from command ;AN000; + MOV PRINTER_P1V1,AX ;; line in value list ;AN000; + MOV DI,OFFSET PRINTER_PARSE_PARMS ;; parse parms ;AN000; + ;; SI => the line to parse ;AN000; + XOR DX,DX ;; ;AN000; + ;; ;AN000; + .REPEAT ;; ;AN000; + XOR CX,CX ;; Don't worry about number of operands ;AN000; + CALL SYSPARSE ;; ;AN000; + .IF ;; Syntax error is the only thing ;AN000; + OR STMT_ERROR,INVALID ;; which can go wrong ;AN000; + MOV PARSE_ERROR,YES ;; ;AN000; + MOV BUILD_STATE,NO ;; ;AN000; + .ENDIF ;; ;AN000; + .UNTIL OR ;; ;AN000; + .UNTIL ;; ;AN000; + ;; Printer type parm matched one coded ;AN000; + ;; on the PRINTER statement ;AN000; + .IF ;; ;AN000; + .IF ;; ;AN000; + MOV PTD_FOUND,YES ;; If the printer type matches and ;AN000; + .IF AND ;; no errors have been found yet ;AN000; + .IF AND ;; ;AN000; + .IF ;; ;AN000; + MOV BUILD_STATE,YES ;; then start building the shared ;AN000; + .ENDIF ;; data ;AN000; + .ENDIF ;; ;AN000; + .ELSE ;; No match ;AN000; + MOV BUILD_STATE,NO ;; ;AN000; + .IF ;; Error during parse ;AN000; + OR STMT_ERROR,INVALID ;; set error flag for caller ;AN000; + MOV PARSE_ERROR,YES ;; set error flag for caller ;AN000; + .ENDIF ;; ;AN000; + .ENDIF ;; ;AN000; + ;; ;AN000; + RET ;AN000; + ;; ;AN000; +PARSE_PRINTER ENDP ;AN000; + ;AN000; + ;; ;AN000; + ;; ;AN000; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;AN000; +;; ;AN000; +;; Module Name: ;AN000; +;; PARSE_DISPLAYMODE ;AN000; +;; ;AN000; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;AN000; + ;; ;AN000; +DISPMODE_PARSE_PARMS LABEL WORD ;; Parser control blocks ;AN000; + DW DISPMODE_P ;; ;AN000; + DB 2 ;; # of lists ;AN000; + DB 0 ;; # items in delimeter list ;AN000; + DB 1 ;; # items in end-of-line list ;AN000; + DB ';' ;; ';' used for comments ;AN000; + ;; ;AN000; +DISPMODE_P DB 0,1 ;; Required, max parms ;AN000; + DW DISPMODE_P1 ;; ;AN000; + DB 0 ;; # Switches ;AN000; + DB 0 ;; # keywords ;AN000; + ;; ;AN000; +DISPMODE_P1 DW 8000H ;; Numeric ;AN000; + DW 0 ;; No Capitalize ;AN000; + DW RESULT_BUFFER ;; Result buffer ;AN000; + DW DISPMODE_P1V ;; Value list ;AN000; + DB 0 ;; Synomyms ;AN000; + ;; ;AN000; +DISPMODE_P1V DB 1 ;; # of value lists ;AN000; + DB 1 ;; # of range numerics ;AN000; + DB 1 ;; tag ;AN000; + DD 0,19 ;; range 0..19 ;AN000; + ;; ;AN000; + ;; ;AN000; + ;; ;AN000; +PARSE_DISPLAYMODE PROC ;; ;AN000; + ;; ;AN000; + MOV CUR_STMT,DISP ;; ;AN000; + ;; Check for a preceeding PRINTER ;AN000; + .IF ;; ;AN000; + OR STMT_ERROR,MISSING ;; ;AN000; + MOV PARSE_ERROR,YES ;; ;AN000; + MOV BUILD_STATE,NO ;; ;AN000; + .ENDIF ;; ;AN000; + ;; ;AN000; + ;; ;AN000; + .IF ;; If first DISPLAYMODE... ;AN000; + .IF ;; ;AN000; + MOV AX,BLOCK_END ;; ;AN000; + MOV [BP].DISPLAYMODE_PTR,AX ;; Set pointer to first DISPLAYMODE ;AN000; + MOV BLOCK_START,AX ;; New block starts after last one ;AN000; + .ENDIF ;; ;AN000; + .ELSE ;; ;AN000; + CALL TERMINATE_DISPLAYMODE ;; If not the first DISPLAYMODE then ;AN000; + ;; clean up the last one. ;AN000; + MOV DI,BLOCK_START ;; DI=pointer to DISPLAYMODE block just ;AN000; + MOV AX,BLOCK_END ;; built ;AN000; + .IF ;; ;AN000; + MOV [BP+DI].NEXT_DISP_MODE,AX ;; Add new block to DISPLAYMODE chain ;AN000; + .ENDIF ;; ;AN000; + MOV BLOCK_START,AX ;; New block starts after last one ;AN000; + .ENDIF ;; ;AN000; + ;; ;AN000; + MOV AX,SIZE DISPLAYMODE_STR ;; Allocate space for new DISPLAYMODE ;AN000; + CALL GROW_SHARED_DATA ;; block ;AN000; + .IF ;; ;AN000; + MOV DI,BLOCK_START ;; Start of new block ;AN000; + MOV [BP+DI].NUM_SETUP_ESC,0 ;; SETUP, RESTORE are optional so set ;AN000; + MOV [BP+DI].NUM_RESTORE_ESC,0 ;; to defaults ;AN000; + MOV [BP+DI].SETUP_ESC_PTR,-1 ;; ;AN000; + MOV [BP+DI].RESTORE_ESC_PTR,-1 ;; ;AN000; + MOV [BP+DI].BOX_WIDTH,0 ;; ;AN000; + MOV [BP+DI].BOX_HEIGHT,0 ;; ;AN000; + MOV [BP+DI].PRINT_OPTIONS,0 ;; Default to NO print options ;AN000; + MOV [BP+DI].NUM_DISP_MODE,0 ;; Get ready to INC this sucker ;AN000; + MOV [BP+DI].NEXT_DISP_MODE,-1 ;; This is the last DISPLAYMODE for now! ;AN000; + MOV AX,BLOCK_END ;; ;AN000; + MOV [BP+DI].DISP_MODE_LIST_PTR,AX;; Start mode list at end of new block ;AN000; + .ENDIF ;; ;AN000; + ;; ;AN000; + OR STMTS_DONE,DISP ;; Indicate DISPLAYMODE found ;AN000; + AND STMTS_DONE,NOT (BOX+GR+SET+REST) ;; Reset flags for PRINTBOX, GRAPHICS ;AN000; + ;; stmts found ;AN000; + AND GROUPS_DONE,NOT (GR+SET+REST) ;; Reset flags for GRAPHICS, SETUP, ;AN000; + ;; RESTORE groups processed ;AN000; + MOV DI,OFFSET DISPMODE_PARSE_PARMS ;; parse parms ;AN000; + ;; SI => the line to parse ;AN000; + XOR DX,DX ;; ;AN000; + .REPEAT ;; ;AN000; + XOR CX,CX ;; ;AN000; + CALL SYSPARSE ;; ;AN000; + .IF ;; If mode is valid ;AN000; + PUSH AX ;; ;AN000; + MOV AX,1 ;; Add a mode to the list ;AN000; + CALL GROW_SHARED_DATA ;; Update block end ;AN000; + .IF ;; ;AN000; + PUSH DI ;; ;AN000; + MOV DI,BLOCK_START ;; ;AN000; + INC [BP+DI].NUM_DISP_MODE ;; Bump number of modes in list ;AN000; + MOV DI,BLOCK_END ;; ;AN000; + MOV AL,RESULT_VAL ;; Get mode from result buffer ;AN000; + MOV [BP+DI-1],AL ;; Store the mode at end of list ;AN000; + POP DI ;; ;AN000; + .ENDIF ;; ;AN000; + POP AX ;; ;AN000; + .ELSE ;; ;AN000; + .IF ;; ;AN000; + OR STMT_ERROR,INVALID ;; Mode is invalid ;AN000; + MOV PARSE_ERROR,YES ;; ;AN000; + MOV BUILD_STATE,NO ;; ;AN000; + .ENDIF ;; ;AN000; + .ENDIF ;; ;AN000; + .UNTIL ;; ;AN000; + ;; ;AN000; + RET ;AN000; + ;; ;AN000; +PARSE_DISPLAYMODE ENDP ;AN000; + ;AN000; + ;; ;AN000; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;AN000; +;; ;AN000; +;; Module Name: ;AN000; +;; PARSE_SETUP ;AN000; +;; ;AN000; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;AN000; + ;; ;AN000; +SETUP_PARSE_PARMS LABEL WORD ;; Parser control blocks ;AN000; + DW SETUP_P ;; ;AN000; + DB 2 ;; # of lists ;AN000; + DB 0 ;; # items in delimeter list ;AN000; + DB 1 ;; # items in end-of-line list ;AN000; + DB ';' ;; ';' used for comments ;AN000; + ;; ;AN000; +SETUP_P DB 0,1 ;; Required, max parms ;AN000; + DW SETUP_P1 ;; ;AN000; + DB 0 ;; # Switches ;AN000; + DB 0 ;; # keywords ;AN000; + ;; ;AN000; +SETUP_P1 DW 08000H ;; Numeric ;AN000; + DW 0 ;; nO Capitalize ;AN000; + DW RESULT_BUFFER ;; Result buffer ;AN000; + DW SETUP_P1V ;; Value list ;AN000; + DB 0 ;; Synomyms ;AN000; + ;; ;AN000; + ;; ;AN000; +SETUP_P1V DB 1 ;; # of value lists ;AN000; + DB 1 ;; # of range numerics ;AN000; + DB 1 ;; tag ;AN000; + DD 0,255 ;; range 0..255 ;AN000; + ;; ;AN000; + ;; ;AN000; +PARSE_SETUP PROC ;; ;AN000; + ;; ;AN000; + MOV CUR_STMT,SET ;; ;AN000; + .IF ;; DISPLAYMODE must preceed this ;AN000; + OR STMT_ERROR,MISSING ;; ;AN000; + MOV PARSE_ERROR,YES ;; ;AN000; + MOV BUILD_STATE,NO ;; ;AN000; + .ENDIF ;; ;AN000; + ;; ;AN000; + .IF ;; Check for previous group of SETUP ;AN000; + OR STMT_ERROR,SEQUENCE ;; stmts ;AN000; + MOV PARSE_ERROR,YES ;; ;AN000; + MOV BUILD_STATE,NO ;; ;AN000; + .ENDIF ;; ;AN000; + ;; ;AN000; + .IF ;; If first SETUP... ;AN000; + .IF ;; ;AN000; + MOV DI,BLOCK_START ;; ;AN000; + MOV AX,BLOCK_END ;; ;AN000; + MOV [BP+DI].SETUP_ESC_PTR,AX ;; Set pointer to SETUP seq ;AN000; + MOV [BP+DI].NUM_SETUP_ESC,0 ;; Init sequence size ;AN000; + .ENDIF ;; ;AN000; + .ENDIF ;; ;AN000; + ;; ;AN000; + OR STMTS_DONE,SET ;; Indicate SETUP found ;AN000; + .IF THEN ;; Terminate any preceeding groups ;AN000; + MOV AX,PREV_STMT ;; except for SETUP group ;AN000; + OR GROUPS_DONE,AX ;; ;AN000; + .ENDIF ;; ;AN000; + ;; ;AN000; + MOV DI,OFFSET SETUP_PARSE_PARMS ;; parse parms ;AN000; + ;; SI => the line to parse ;AN000; + XOR DX,DX ;; ;AN000; + .REPEAT ;; ;AN000; + XOR CX,CX ;; ;AN000; + CALL SYSPARSE ;; ;AN000; + .IF ;; If esc byte is valid ;AN000; + PUSH AX ;; ;AN000; + MOV AX,1 ;; Add a byte to the sequence ;AN000; + CALL GROW_SHARED_DATA ;; Update block end ;AN000; + .IF ;; ;AN000; + PUSH DI ;; ;AN000; + MOV DI,BLOCK_START ;; ;AN000; + INC [BP+DI].NUM_SETUP_ESC ;; Bump number of bytes in sequence ;AN000; + MOV DI,BLOCK_END ;; ;AN000; + MOV AL,RESULT_VAL ;; Get esc byte from result buffer ;AN000; + MOV [BP+DI-1],AL ;; Store at end of sequence ;AN000; + POP DI ;; ;AN000; + .ENDIF ;; ;AN000; + POP AX ;; ;AN000; + .ELSE ;; ;AN000; + .IF ;; ;AN000; + OR STMT_ERROR,INVALID ;; parm is invalid ;AN000; + MOV PARSE_ERROR,YES ;; ;AN000; + MOV BUILD_STATE,NO ;; ;AN000; + .ENDIF ;; ;AN000; + .ENDIF ;; ;AN000; + .UNTIL NEAR ;; ;AN000; + RET ;; ;AN000; + ;; ;AN000; +PARSE_SETUP ENDP ;; ;AN000; + ;AN000; + ;; ;AN000; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;AN000; +;; ;AN000; +;; Module Name: ;AN000; +;; PARSE_RESTORE ;AN000; +;; ;AN000; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;AN000; + ;; ;AN000; +RESTORE_PARSE_PARMS LABEL WORD ;; Parser control blocks ;AN000; + DW RESTORE_P ;; ;AN000; + DB 2 ;; # of lists ;AN000; + DB 0 ;; # items in delimeter list ;AN000; + DB 1 ;; # items in end-of-line list ;AN000; + DB ';' ;; ';' used for comments ;AN000; + ;; ;AN000; +RESTORE_P DB 0,1 ;; Required, max parms ;AN000; + DW RESTORE_P1 ;; ;AN000; + DB 0 ;; # Switches ;AN000; + DB 0 ;; # keywords ;AN000; + ;; ;AN000; +RESTORE_P1 DW 08000H ;; Numeric ;AN000; + DW 0 ;; nO Capitalize ;AN000; + DW RESULT_BUFFER ;; Result buffer ;AN000; + DW RESTORE_P1V ;; Value list ;AN000; + DB 0 ;; Synomyms ;AN000; + ;; ;AN000; + ;; ;AN000; +RESTORE_P1V DB 1 ;; # of value lists ;AN000; + DB 1 ;; # of range numerics ;AN000; + DB 1 ;; tag ;AN000; + DD 0,255 ;; range 0..255 ;AN000; + ;; ;AN000; + ;; ;AN000; +PARSE_RESTORE PROC ;; ;AN000; + ;; ;AN000; + MOV CUR_STMT,SET ;; ;AN000; + .IF ;; DISPLAYMODE must preceed this ;AN000; + OR STMT_ERROR,MISSING ;; ;AN000; + MOV PARSE_ERROR,YES ;; ;AN000; + MOV BUILD_STATE,NO ;; ;AN000; + .ENDIF ;; ;AN000; + ;; ;AN000; + .IF ;; Check for previous group of RESTORE ;AN000; + OR STMT_ERROR,SEQUENCE ;; stmts ;AN000; + MOV PARSE_ERROR,YES ;; ;AN000; + MOV BUILD_STATE,NO ;; ;AN000; + .ENDIF ;; ;AN000; + ;; ;AN000; + .IF ;; If first RESTORE... ;AN000; + .IF ;; ;AN000; + MOV DI,BLOCK_START ;; ;AN000; + MOV AX,BLOCK_END ;; ;AN000; + MOV [BP+DI].RESTORE_ESC_PTR,AX ;; Set pointer to RESTORE seq ;AN000; + MOV [BP+DI].NUM_RESTORE_ESC,0 ;; Init sequence size ;AN000; + .ENDIF ;; ;AN000; + .ENDIF ;; ;AN000; + ;; ;AN000; + OR STMTS_DONE,REST ;; Indicate RESTORE found ;AN000; + .IF THEN ;; Terminate any preceeding groups ;AN000; + MOV AX,PREV_STMT ;; except for RESTORE group ;AN000; + OR GROUPS_DONE,AX ;; ;AN000; + .ENDIF ;; ;AN000; + ;; ;AN000; + MOV DI,OFFSET RESTORE_PARSE_PARMS ;; parse parms ;AN000; + ;; SI => the line to parse ;AN000; + XOR DX,DX ;; ;AN000; + .REPEAT ;; ;AN000; + XOR CX,CX ;; ;AN000; + CALL SYSPARSE ;; ;AN000; + .IF ;; If esc byte is valid ;AN000; + PUSH AX ;; ;AN000; + MOV AX,1 ;; Add a byte to the sequence ;AN000; + CALL GROW_SHARED_DATA ;; Update block end ;AN000; + .IF ;; ;AN000; + PUSH DI ;; ;AN000; + MOV DI,BLOCK_START ;; ;AN000; + INC [BP+DI].NUM_RESTORE_ESC ;; Bump number of bytes in sequence ;AN000; + MOV DI,BLOCK_END ;; ;AN000; + MOV AL,RESULT_VAL ;; Get esc byte from result buffer ;AN000; + MOV [BP+DI-1],AL ;; Store at end of sequence ;AN000; + POP DI ;; ;AN000; + .ENDIF ;; ;AN000; + POP AX ;; ;AN000; + .ELSE ;; ;AN000; + .IF ;; ;AN000; + OR STMT_ERROR,INVALID ;; parm is invalid ;AN000; + MOV PARSE_ERROR,YES ;; ;AN000; + MOV BUILD_STATE,NO ;; ;AN000; + .ENDIF ;; ;AN000; + .ENDIF ;; ;AN000; + .UNTIL NEAR ;; ;AN000; + RET ;; ;AN000; + ;; ;AN000; +PARSE_RESTORE ENDP ;; ;AN000; + ;AN000; + ;; ;AN000; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;AN000; +;; ;AN000; +;; Module Name: ;AN000; +;; PARSE_PRINTBOX ;AN000; +;; ;AN000; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;AN000; + ;; ;AN000; +PRINTBOX_PARSE_PARMS LABEL WORD ;; Parser control blocks ;AN000; + DW PRINTBOX_P ;; ;AN000; + DB 2 ;; # of lists ;AN000; + DB 0 ;; # items in delimeter list ;AN000; + DB 1 ;; # items in end-of-line list ;AN000; + DB ';' ;; ';' used for comments ;AN000; + ;; ;AN000; +PRINTBOX_P DB 1,4 ;; Required, max parms ;AN000; + DW PRINTBOX_P0 ;; LCD/STD ;AN000; + DW PRINTBOX_P1 ;; width ;AN000; + DW PRINTBOX_P1 ;; height ;AN000; + DW PRINTBOX_P2 ;; rotate ;AN000; + DB 0 ;; # Switches ;AN000; + DB 0 ;; # keywords ;AN000; + ;; ;AN000; +PRINTBOX_P0 DW 2000H ;; sTRING - display type ;AN000; + DW 2 ;; Capitalize ;AN000; + DW RESULT_BUFFER ;; Result buffer ;AN000; + DW PRINTBOX_P0V ;; Value list ;AN000; + DB 0 ;; Synomyms ;AN000; + ;; ;AN000; +PRINTBOX_P0V DB 3 ;; # of value lists ;AN000; + DB 0 ;; # of range numerics ;AN000; + DB 0 ;; # of discrete numerics ;AN000; + DB 1 ;; # of strings ;AN000; + DB 1 ;; tag ;AN000; +PRINTBOX_P0V1 DW ? ;; string ;AN000; + ;; ;AN000; +PRINTBOX_P1 DW 8001H ;; Numeric - BOX DIMENSIONS ;AN000; + DW 0 ;; No Capitalize ;AN000; + DW RESULT_BUFFER ;; Result buffer ;AN000; + DW PRINTBOX_P1V ;; Value list ;AN000; + DB 0 ;; Synomyms ;AN000; + ;; ;AN000; +PRINTBOX_P1V DB 1 ;; # of value lists ;AN000; + DB 1 ;; # of range numerics ;AN000; + DB 1 ;; tag ;AN000; + DD 1,9 ;; range 1..9 ;AN000; + ;; ;AN000; + ;; ;AN000; +PRINTBOX_P2 DW 2001H ;; sTRING - ROTATE PARM ;AN000; + DW 2 ;; Capitalize ;AN000; + DW RESULT_BUFFER ;; Result buffer ;AN000; + DW PRINTBOX_P2V ;; Value list ;AN000; + DB 0 ;; Synomyms ;AN000; + ;; ;AN000; +PRINTBOX_P2V DB 3 ;; # of value lists ;AN000; + DB 0 ;; # of range numerics ;AN000; + DB 0 ;; # of discrete numerics ;AN000; + DB 1 ;; # of strings ;AN000; + DB 1 ;; tag ;AN000; + DW ROTATE_STR ;; string ;AN000; +ROTATE_STR DB 'ROTATE',0 ;; ;AN000; + ;; ;AN000; + ;; ;AN000; +PROF_BOX_W DB 0 ;; Box width and height extracted from ;AN000; +PROF_BOX_H DB 0 ;; the profile ;AN000; +PRINTBOX_MATCH DB 0 ;; ;AN000; + ;; ;AN000; + ;; ;AN000; +PARSE_PRINTBOX PROC ;; ;AN000; + ;; ;AN000; + MOV PRINTBOX_MATCH,NO ;; Start out assuming the PRINTBOX ID ;AN000; + MOV PROF_BOX_W,0 ;; does not match the one requested ;AN000; + MOV PROF_BOX_H,0 ;; ;AN000; + MOV CUR_STMT,BOX ;; ;AN000; + .IF ;; DISPLAYMODE must preceed PRINTBOX ;AN000; + OR STMT_ERROR,MISSING ;; ;AN000; + MOV PARSE_ERROR,YES ;; ;AN000; + MOV BUILD_STATE,NO ;; ;AN000; + .ENDIF ;; ;AN000; + ;; Multiple PRINTBOX stmts may be coded ;AN000; + ;; We must decide if this one ;AN000; + ;; matches the requested display type ;AN000; + ;; If not, ignore the statement ;AN000; + MOV DI,OFFSET PRINTBOX_PARSE_PARMS ;; parse parms ;AN000; + ;; SI => the line to parse ;AN000; + XOR DX,DX ;; ;AN000; + XOR CX,CX ;; ;AN000; + ;; ;AN000; + MOV AX,PRINTBOX_ID_PTR ;; Insert requested display type in ;AN000; + MOV PRINTBOX_P0V1,AX ;; parser value list ;AN000; + CALL SYSPARSE ;; PARSE display type ;AN000; + .IF ;; If ID matches then set this flag. ;AN000; + MOV PRINTBOX_MATCH,YES ;; ;AN000; + OR STMTS_DONE,BOX ;; Indicate PRINTBOX found ;AN000; + MOV AX,PREV_STMT ;; Terminate any preceeding groups ;AN000; + OR GROUPS_DONE,AX ;; ;AN000; + .ENDIF ;; ;AN000; + ;; ;AN000; + ;; ;AN000; + ;; ;AN000; + CALL SYSPARSE ;; PARSE horizontal dimension ;AN000; + .IF ;; ;AN000; + MOV BL,RESULT_VAL ;; ;AN000; + MOV PROF_BOX_W,BL ;; Save in local var ;AN000; + .ELSE ;; ;AN000; + .IF ;; ;AN000; + JMP PRINTBOX_DONE ;; ;AN000; + .ELSE ;; ;AN000; + OR STMT_ERROR,INVALID ;; ;AN000; + MOV PARSE_ERROR,YES ;; ;AN000; + MOV BUILD_STATE,NO ;; ;AN000; + .ENDIF ;; ;AN000; + .ENDIF ;; ;AN000; + ;; ;AN000; + CALL SYSPARSE ;; PARSE vertical dimension ;AN000; + .IF ;; ;AN000; + MOV BL,RESULT_VAL ;; ;AN000; + MOV PROF_BOX_H,BL ;; Save in local var ;AN000; + .ELSE ;; ;AN000; + .IF ;; ;AN000; + JMP PRINTBOX_DONE ;; ;AN000; + .ELSE ;; ;AN000; + OR STMT_ERROR,INVALID ;; ;AN000; + MOV PARSE_ERROR,YES ;; ;AN000; + MOV BUILD_STATE,NO ;; ;AN000; + .ENDIF ;; ;AN000; + .ENDIF ;; ;AN000; + ;; ;AN000; + CALL SYSPARSE ;; Parse ROTATE parm ;AN000; + .IF ;; ;AN000; + .IF AND ;; ;AN000; + .IF ;; ;AN000; + PUSH DI ;; ;AN000; + MOV DI,BLOCK_START ;; ;AN000; + OR [BP+DI].PRINT_OPTIONS,ROTATE ;; ;AN000; + POP DI ;; ;AN000; + .ENDIF ;; ;AN000; + .ELSE ;; ;AN000; + .IF ;; ;AN000; + JMP PRINTBOX_DONE ;; ;AN000; + .ELSE ;; ;AN000; + OR STMT_ERROR,INVALID ;; ;AN000; + MOV PARSE_ERROR,YES ;; ;AN000; + MOV BUILD_STATE,NO ;; ;AN000; + .ENDIF ;; ;AN000; + .ENDIF ;; ;AN000; + ;; ;AN000; + CALL SYSPARSE ;; CHECK FOR EXTRA PARMS ;AN000; + .IF ;; ;AN000; + OR STMT_ERROR,INVALID ;; ;AN000; + MOV PARSE_ERROR,YES ;; ;AN000; + MOV BUILD_STATE,NO ;; ;AN000; + .ENDIF ;; ;AN000; + ;; ;AN000; + ;; ;AN000; +PRINTBOX_DONE: ;; ;AN000; + ;; ;AN000; + .IF AND ;; Store the PRINTBOX dimensions ;AN000; + .IF ;; ;AN000; + PUSH DI ;; in the DISPLAYMODE block ;AN000; + MOV DI,BLOCK_START ;; ;AN000; + MOV AL,PROF_BOX_W ;; ;AN000; + MOV [BP+DI].BOX_WIDTH,AL ;; ;AN000; + MOV AL,PROF_BOX_H ;; ;AN000; + MOV [BP+DI].BOX_HEIGHT,AL ;; ;AN000; + POP DI ;; ;AN000; + .ENDIF ;; ;AN000; + ;; If we have a B&W printer then ;AN000; + ;; load the grey patterns for the ;AN000; + ;; requested print box size. ;AN000; + .IF NEAR ;AN000; + ;; ;AN000; + .IF AND NEAR ;; Dimensions could also be 0 if the ;AN000; + .IF NEAR ;; printbox ID does not apply to this;AN000; + ;; displaymode, so don't try for ;AN000; + ;; a pattern! ;AN000; + MOV BX,OFFSET TAB_DIRECTORY ;; ;AN000; + MOV CL,TAB_DIR_NB_ENTRIES ;; ;AN000; + XOR CH,CH ;; ;AN000; + MOV DI,BLOCK_START ;; ;AN000; + MOV AL,PROF_BOX_W ;; Requested box width ;AN000; + MOV AH,PROF_BOX_H ;; Requested box height ;AN000; + .REPEAT ;; ;AN000; + .IF <[BX].BOX_W_PAT EQ AL> AND ;; ;AN000; + .IF <[BX].BOX_H_PAT EQ AH> ;; ;AN000; + .LEAVE ;; ;AN000; + .ELSE ;; ;AN000; + ADD BX,SIZE TAB_ENTRY ;; ;AN000; + .ENDIF ;; ;AN000; + .LOOP ;; ;AN000; + .IF ;; ;AN000; + OR STMT_ERROR,INVALID ;; Unsupported box size ;AN000; + MOV PARSE_ERROR,YES ;; ;AN000; + MOV BUILD_STATE,NO ;; ;AN000; + .ELSE NEAR ;; Box size OK - pattern tab found ;AN000; + .IF <[BX].TAB_COPY NE -1> ;; Pointer is NOT null if the table ;AN000; + MOV AX,[BX].TAB_COPY ;; has already been copied to ;AN000; + ;; the shared data area. ;AN000; + .IF AND ;; Point to the copy. ;AN000; + .IF ;; Establish pointer to table ONLY ;AN000; + MOV [BP+DI].PATTERN_TAB_PTR,AX ;; if the PB ID matched. ;AN000; + MOV AL,[BX].NB_INT ;; Number of table entries (intensitie;AN000; + MOV [BP+DI].NUM_PATTERNS,AL ;; ;AN000; + .ENDIF ;; ;AN000; + .ELSE ;; Otherwise we have to copy it. ;AN000; + ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;AN000; + ;; Copy the table even if the printbox ID didn't match! ;AN000; + ;; This is a simple way to reserve enough space to allow reloading ;AN000; + ;; with a different PRINTBOX ID specified on the command line. ;AN000; + ;; This scheme avoids storing ;AN000; + ;; duplicate tables but may reserve slightly more space ;AN000; + ;; (probably only a hundred bytes or so) than ;AN000; + ;; could ever be required. The optimal solution (too ;AN000; + ;; complicated!) would involve keeping running totals for each ;AN000; + ;; PRINTBOX ID coded. ;AN000; + ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;AN000; + ;; ;AN000; + MOV DI,BLOCK_END ;; Copy it onto the end of the ;AN000; + ;; current block ;AN000; + MOV DX,DI ;; Save start addr of the copy ;AN000; + MOV [BX].TAB_COPY,DX ;; Store ptr to copy in the directory ;AN000; + MOV AX,[BX].TAB_SIZE ;; ;AN000; + CALL GROW_SHARED_DATA ;; Allocate room for the table ;AN000; + .IF ;; ;AN000; + MOV CX,AX ;; Number of bytes to copy ;AN000; + PUSH SI ;; Save parse pointer ;AN000; + MOV SI,[BX].TAB_OFFSET ;; Source pointer ;AN000; + ADD DI,BP ;; make DI an absolute pointer (dest) ;AN000; + REP MOVSB ;; Move it! ;AN000; + POP SI ;; ;AN000; + .IF ;; Establish pointer to table ONLY ;AN000; + MOV DI,BLOCK_START ;; Establish pointer in DISPLAYMODE;AN000; + MOV [BP+DI].PATTERN_TAB_PTR,DX ;; info ;AN000; + MOV AL,[BX].NB_INT ;; Number of table entries (intens);AN000; + MOV [BP+DI].NUM_PATTERNS,AL ;; ;AN000; + .ENDIF ;; ;AN000; + .ENDIF ;; ;AN000; + .ENDIF ;; ;AN000; + .ENDIF ;; ;AN000; + .ENDIF ;; ;AN000; + .ENDIF ;; ;AN000; + RET ;; ;AN000; + ;; ;AN000; + ;; ;AN000; +PARSE_PRINTBOX ENDP ;AN000; + ;AN000; + ;; ;AN000; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;AN000; +;; ;AN000; +;; Module Name: ;AN000; +;; PARSE_VERB ;AN000; +;; ;AN000; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;AN000; + ;; ;AN000; +VERB_PARSE_PARMS LABEL WORD ;; Parser control blocks to parse verb ;AN000; + DW VERB_P ;; Parser control blocks to parse verb ;AN000; + DB 2 ;; # of lists ;AN000; + DB 0 ;; # items in delimeter list ;AN000; + DB 1 ;; # items in end-of-line list ;AN000; + DB ';' ;; ';' used for comments ;AN000; + ;; ;AN000; +VERB_P DB 0,1 ;; Required, max parms ;AN000; + DW VERB_P1 ;; ;AN000; + DB 0 ;; # Switches ;AN000; + DB 0 ;; # keywords ;AN000; + ;; ;AN000; +VERB_P1 DW 2000H ;; simple string ;AN000; + DW 0002H ;; Capitalize using character table ;AN000; + DW RESULT_BUFFER ;; Result buffer ;AN000; + DW VERB_P1V ;; Value list ;AN000; + DB 0 ;; Synomyms ;AN000; + ;; ;AN000; +VERB_P1V DB 3 ;; # of value lists ;AN000; + DB 0 ;; # of range numerics ;AN000; + DB 0 ;; # of discrete numerics ;AN000; + DB 9 ;; # of strings ;AN000; + DB 0 ;; tag: index into verb jump table ;AN000; + DW PRINTER_STRING ;; string offset ;AN000; + DB 2 ;; tag ;AN000; + DW DISPLAYMODE_STRING ;; string offset ;AN000; + DB 4 ;; tag ;AN000; + DW PRINTBOX_STRING ;; string offset ;AN000; + DB 6 ;; tag ;AN000; + DW SETUP_STRING ;; string offset ;AN000; + DB 8 ;; tag ;AN000; + DW RESTORE_STRING ;; string offset ;AN000; + DB 10 ;; tag ;AN000; + DW GRAPHICS_STRING ;; string offset ;AN000; + DB 12 ;; tag ;AN000; + DW COLORPRINT_STRING ;; string offset ;AN000; + DB 14 ;; tag ;AN000; + DW COLORSELECT_STRING ;; string offset ;AN000; + DB 16 ;; tag ;AN000; + DW DARKADJUST_STRING ;; string offset ;AN000; +PRINTER_STRING DB 'PRINTER',0 ;; ;AN000; +DISPLAYMODE_STRING DB 'DISPLAYMODE',0 ;; ;AN000; +PRINTBOX_STRING DB 'PRINTBOX',0 ;; ;AN000; +SETUP_STRING DB 'SETUP',0 ;; ;AN000; +RESTORE_STRING DB 'RESTORE',0 ;; ;AN000; +GRAPHICS_STRING DB 'GRAPHICS',0 ;; ;AN000; +COLORPRINT_STRING DB 'COLORPRINT',0 ;; ;AN000; +COLORSELECT_STRING DB 'COLORSELECT',0 ;; ;AN000; +DARKADJUST_STRING DB 'DARKADJUST',0 ;; ;AN000; + ;; ;AN000; + ;; ;AN000; +PARSE_VERB PROC ;; ;AN000; + ;; ;AN000; + MOV DI,OFFSET VERB_PARSE_PARMS ;; parse parms ;AN000; + MOV SI,OFFSET STMT_BUFFER ;; the line to parse ;AN000; + XOR DX,DX ;; ;AN000; + XOR CX,CX ;; ;AN000; + CALL SYSPARSE ;; ;AN000; + .IF ;; ;AN000; + MOV BL,RESULT_TAG ;; ;AN000; + XOR BH,BH ;; return tag in BX ;AN000; + .ELSE ;; ;AN000; + .IF ;; syntax error ;AN000; + OR STMT_ERROR,INVALID ;; set error flag for caller ;AN000; + .ENDIF ;; ;AN000; + .ENDIF ;; ;AN000; + RET ;AN000; +PARSE_VERB ENDP ;AN000; + ;; ;AN000; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;AN000; + ;AN000; +LIMIT LABEL NEAR ;; ;AN000; +CODE ENDS ;; ;AN000; + END ;AN000; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;AN000; diff --git a/v4.0/src/CMD/GRAPHICS/GRLOAD2.EXT b/v4.0/src/CMD/GRAPHICS/GRLOAD2.EXT new file mode 100644 index 0000000..7c4d04f --- /dev/null +++ b/v4.0/src/CMD/GRAPHICS/GRLOAD2.EXT @@ -0,0 +1,32 @@ +.XLIST ;AN000; + ;AN000; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;AN000; +;; DOS - GRAPHICS Command +;; (C) Copyright 1988 Microsoft +;; ;AN000; +;; File Name: GRINST.EXT ;AN000; +;; ---------- ;AN000; +;; ;AN000; +;; Description: ;AN000; +;; ------------ ;AN000; +;; External declarations for code and data defined in ;AN000; +;; GRLOAD.ASM ;AN000; +;; ;AN000; +;; Change History: ;AN000; +;; --------------- ;AN000; +;; ;AN000; +;; ;AN000; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;AN000; + ;; ;AN000; + EXTRN PARSE_VERB:NEAR ;; ;AN000; + EXTRN PARSE_PRINTER:NEAR ;; ;AN000; + EXTRN PARSE_DISPLAYMODE:NEAR ;; ;AN000; + EXTRN PARSE_PRINTBOX:NEAR ;; ;AN000; + EXTRN PARSE_SETUP:NEAR ;; ;AN000; + EXTRN PARSE_RESTORE:NEAR ;; ;AN000; + EXTRN TERMINATE_PRINTER:NEAR ;; ;AN000; + EXTRN TERMINATE_DISPLAYMODE:NEAR ;; ;AN000; + EXTRN CUR_PRINTER_TYPE:BYTE ;; ;AN000; + ;; ;AN000; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;AN000; +.LIST ;AN000; diff --git a/v4.0/src/CMD/GRAPHICS/GRLOAD3.ASM b/v4.0/src/CMD/GRAPHICS/GRLOAD3.ASM new file mode 100644 index 0000000..ce9d1d4 --- /dev/null +++ b/v4.0/src/CMD/GRAPHICS/GRLOAD3.ASM @@ -0,0 +1,729 @@ + PAGE ,132 ;AN000; + TITLE DOS - GRAPHICS Command - Profile Load Modules #2 ;AN000; + ;AN000; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;AN000; +;; DOS - GRAPHICS Command +;; (C) Copyright 1988 Microsoft +;; ;AN000; +;; File Name: GRLOAD.ASM ;AN000; +;; ---------- ;AN000; +;; ;AN000; +;; Description: ;AN000; +;; ------------ ;AN000; +;; This file contains the modules used to load the ;AN000; +;; GRAPHICS profile into resident memory. ;AN000; +;; ;AN000; +;; ************* The EGA Dynamic Save Area will be built (by ;AN000; +;; ** NOTE ** CHAIN_INTERRUPTS in file GRINST.ASM) over top of these ;AN000; +;; ************* modules to avoid having to relocate this save just before ;AN000; +;; terminating. This is safe since the maximum memory used is ;AN000; +;; 288 bytes and the profile loading modules are MUCH larger than ;AN000; +;; this. So GRLOAD.ASM MUST be linked before GRINST.ASM and after ;AN000; +;; GRPRINT.ASM. ;AN000; +;; ;AN000; +;; ;AN000; +;; Documentation Reference: ;AN000; +;; ------------------------ ;AN000; +;; PLACID Functional Specifications ;AN000; +;; OASIS High Level Design ;AN000; +;; OASIS GRAPHICS I1 Overview ;AN000; +;; ;AN000; +;; Procedures Contained in This File: ;AN000; +;; ---------------------------------- ;AN000; +;; LOAD_PROFILE - Main module for profile loading ;AN000; +;; ;AN000; +;; Include Files Required: ;AN000; +;; ----------------------- ;AN000; +;; ?????????? - Externals for profile loading modules ;AN000; +;; ;AN000; +;; External Procedure References: ;AN000; +;; ------------------------------ ;AN000; +;; None ;AN000; +;; ;AN000; +;; Linkage Instructions: ;AN000; +;; --------------------- ;AN000; +;; Refer to GRAPHICS.ASM ;AN000; +;; ;AN000; +;; Change History: ;AN000; +;; --------------- ;AN000; +;; ;AN000; +;; ;AN000; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;AN000; + ;; ;AN000; + ;; ;AN000; +CODE SEGMENT PUBLIC 'CODE' BYTE ;; ;AN000; + ;; ;AN000; + INCLUDE STRUC.INC ;; ;AN000; + INCLUDE GRINST.EXT ;; Bring in external declarations ;AN000; + ;; for transient command processing ;AN000; + INCLUDE GRSHAR.STR ;; ;AN000; + INCLUDE GRMSG.EQU ;; ;AN000; + INCLUDE GRINST.EXT ;; ;AN000; + INCLUDE GRLOAD.EXT ;; ;AN000; + INCLUDE GRLOAD2.EXT ;; ;AN000; + INCLUDE GRPARSE.EXT ;; ;AN000; + INCLUDE GRPATTRN.STR ;; ;AN000; + INCLUDE GRPATTRN.EXT ;; ;AN000; + ;; ;AN000; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;AN000; +;; ;AN000; +;; Public Symbols ;AN000; +;; ;AN000; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;AN000; + ;; ;AN000; + PUBLIC PARSE_GRAPHICS ;; ;AN000; + PUBLIC PARSE_COLORSELECT ;; ;AN000; + PUBLIC PARSE_COLORPRINT ;; ;AN000; + PUBLIC PARSE_DARKADJUST ;; ;AN000; + PUBLIC LIMIT ;; ;AN000; + ;; ;AN000; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;AN000; + ;; ;AN000; + ASSUME CS:CODE,DS:CODE ;; ;AN000; + ;; ;AN000; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;AN000; + ;; ;AN000; + ;; ;AN000; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;AN000; +;; ;AN000; +;; Profile Load Variables ;AN000; +;; ;AN000; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;AN000; + ;; ;AN000; +NO EQU 0 ;; ;AN000; +YES EQU 1 ;; ;AN000; + ;; ;AN000; +RESULT_BUFFER LABEL BYTE ;; general purpose result buffer ;AN000; + DB ? ;; operand type ;AN000; +RESULT_TAG DB 0 ;; operand tag ;AN000; + DW ? ;; pointer to synonym/keyword ;AN000; +RESULT_VAL DB ?,?,?,? ;; returned numeric value ;AN000; + ;; ;AN000; + ;; ;AN000; + ;; ;AN000; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;AN000; +;; ;AN000; +;; Module Name: ;AN000; +;; PARSE_GRAPHICS ;AN000; +;; ;AN000; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;AN000; + ;; ;AN000; +GRAPHICS_PARSE_PARMS LABEL WORD ;; Parser control blocks ;AN000; + DW GRAPHICS_P ;; ;AN000; + DB 2 ;; # of lists ;AN000; + DB 0 ;; # items in delimeter list ;AN000; + DB 1 ;; # items in end-of-line list ;AN000; + DB ';' ;; ';' used for comments ;AN000; + ;; ;AN000; +GRAPHICS_P DB 0,1 ;; Required, max parms ;AN000; + DW GRAPHICS_P1 ;; ;AN000; + DB 0 ;; # Switches ;AN000; + DB 0 ;; # keywords ;AN000; + ;; ;AN000; +GRAPHICS_P1 DW 0A000H ;; Numeric OR string ;AN000; + DW 2 ;; Capitalize ;AN000; + DW RESULT_BUFFER ;; Result buffer ;AN000; + DW GRAPHICS_P1V ;; Value list ;AN000; + DB 0 ;; Synomyms ;AN000; + ;; ;AN000; + ;; ;AN000; +GRAPHICS_P1V DB 3 ;; # of value lists ;AN000; + DB 1 ;; # of range numerics ;AN000; + DB 1 ;; tag ;AN000; + DD 0,255 ;; range 0..255 ;AN000; + DB 0 ;; 0 - no actual numerics ;AN000; + DB 2 ;; 2 STRING VALUES ;AN000; + DB 2 ;; tag ;AN000; + DW LOWCOUNT_STR ;; ptr ;AN000; + DB 3 ;; tag ;AN000; + DW HIGHCOUNT_STR ;; ptr ;AN000; + ;; ;AN000; +lowcount_str db 'LOWCOUNT',0 ;; ;AN000; +HIGHcount_str db 'HIGHCOUNT',0 ;; ;AN000; + ;; ;AN000; + ;; ;AN000; +LOWCOUNT_FOUND DB NO ;; ;AN000; +HIGHCOUNT_FOUND DB NO ;; ;AN000; + ;; ;AN000; + ;; ;AN000; +PARSE_GRAPHICS PROC ;; ;AN000; + ;; ;AN000; + MOV CUR_STMT,GR ;; ;AN000; + .IF ;; ;AN000; + OR STMT_ERROR,MISSING ;; ;AN000; + MOV PARSE_ERROR,YES ;; ;AN000; + MOV BUILD_STATE,NO ;; ;AN000; + .ENDIF ;; ;AN000; + ;; ;AN000; + .IF ;; ;AN000; + MOV DI,BLOCK_START ;; ;AN000; + MOV AX,BLOCK_END ;; ;AN000; + MOV [BP+DI].GRAPHICS_ESC_PTR,AX ;; Set pointer to GRAPHICS seq ;AN000; + MOV [BP+DI].NUM_GRAPHICS_ESC,0 ;; Init sequence size ;AN000; + .ENDIF ;; ;AN000; + ;; ;AN000; + MOV LOWCOUNT_FOUND,NO ;; Flags to indicate whether the LOW ;AN000; + MOV HIGHCOUNT_FOUND,NO ;; and HIGHCOUNT parms were found ;AN000; + ;; ;AN000; + OR STMTS_DONE,GR ;; Indicate GRAPHICS found ;AN000; + ;; ;AN000; + MOV AX,PREV_STMT ;; Terminate any preceeding groups ;AN000; + OR GROUPS_DONE,AX ;; ;AN000; + ;; ;AN000; + MOV DI,OFFSET GRAPHICS_PARSE_PARMS ;; parse parms ;AN000; + ;; SI => the line to parse ;AN000; + XOR DX,DX ;; ;AN000; + .REPEAT ;; ;AN000; + XOR CX,CX ;; ;AN000; + CALL SYSPARSE ;; ;AN000; + ;; ;AN000; + .IF NEAR ;; If PARM is valid ;AN000; + MOV BL,RESULT_TAG ;; ;AN000; + .SELECT ;; ;AN000; + .WHEN ;; Escape byte ;AN000; + PUSH AX ;; ;AN000; + MOV AX,1 ;; Add a byte to the sequence ;AN000; + CALL GROW_SHARED_DATA ;; Update block end ;AN000; + .IF ;; ;AN000; + PUSH DI ;; ;AN000; + MOV DI,BLOCK_START ;; ;AN000; + INC [BP+DI].NUM_GRAPHICS_ESC ;; Bump number of bytes in sequence ;AN000; + MOV DI,BLOCK_END ;; ;AN000; + MOV AL,RESULT_VAL ;; Get esc byte from result buffer ;AN000; + MOV [BP+DI-1],AL ;; Store at end of sequence ;AN000; + POP DI ;; ;AN000; + .ENDIF ;; ;AN000; + POP AX ;; ;AN000; + .WHEN ;; LOWCOUNT ;AN000; + .IF ;; ;AN000; + MOV LOWCOUNT_FOUND,YES ;; ;AN000; + PUSH AX ;; ;AN000; + MOV AX,1 ;; Add a byte to the sequence ;AN000; + CALL GROW_SHARED_DATA ;; Update block end ;AN000; + .IF ;; ;AN000; + PUSH DI ;; ;AN000; + MOV DI,BLOCK_START ;; ;AN000; + INC [BP+DI].NUM_GRAPHICS_ESC ;; Bump number of bytes in seq. ;AN000; + MOV AX,BLOCK_END ;; Save pointer to low byte ;AN000; + DEC AX ;; ;AN000; + MOV [BP+DI].LOW_BYT_COUNT_PTR,AX ;AN000; + MOV DI,AX ;; ;AN000; + MOV BYTE PTR[BP+DI],0 ;; Store 0 in place of count ;AN000; + POP DI ;; ;AN000; + .ENDIF ;; ;AN000; + POP AX ;; ;AN000; + ;; ;AN000; + .ELSE ;; ;AN000; + OR STMT_ERROR,INVALID ;; Duplicate LOWCOUNT parms ;AN000; + MOV PARSE_ERROR,YES ;; ;AN000; + MOV BUILD_STATE,NO ;; ;AN000; + .ENDIF ;; ;AN000; + .WHEN ;; HIGHCOUNT ;AN000; + .IF ;; ;AN000; + MOV HIGHCOUNT_FOUND,YES ;; ;AN000; + PUSH AX ;; ;AN000; + MOV AX,1 ;; Add a byte to the sequence ;AN000; + CALL GROW_SHARED_DATA ;; Update block end ;AN000; + .IF ;; ;AN000; + PUSH DI ;; ;AN000; + MOV DI,BLOCK_START ;; ;AN000; + INC [BP+DI].NUM_GRAPHICS_ESC ;; Bump number of bytes in sequen;AN000; + MOV AX,BLOCK_END ;; Save pointer to high byte ;AN000; + DEC AX ;; Block end always points 1 ahead ;AN000; + MOV [BP+DI].HGH_BYT_COUNT_PTR,AX ;AN000; + MOV DI,AX ;; ;AN000; + MOV BYTE PTR[BP+DI],0 ;; Store 0 in place of count ;AN000; + POP DI ;; ;AN000; + .ENDIF ;; ;AN000; + POP AX ;; ;AN000; + .ELSE ;; ;AN000; + OR STMT_ERROR,INVALID ;; Duplicate HIGHCOUNT parms ;AN000; + MOV PARSE_ERROR,YES ;; ;AN000; + MOV BUILD_STATE,NO ;; ;AN000; + .ENDIF ;; ;AN000; + .ENDSELECT ;; ;AN000; + .ELSE NEAR ;; ;AN000; + .IF ;; ;AN000; + OR STMT_ERROR,INVALID ;; parm is invalid ;AN000; + MOV PARSE_ERROR,YES ;; ;AN000; + MOV BUILD_STATE,NO ;; ;AN000; + .ENDIF ;; ;AN000; + .ENDIF ;; ;AN000; + .UNTIL NEAR ;; ;AN000; + ;; ;AN000; + .IF OR ;; ;AN000; + .IF ;; Missing LOWCOUNT/HIGHCOUNT parms ;AN000; + OR STMT_ERROR,INVALID ;; ;AN000; + MOV PARSE_ERROR,YES ;; ;AN000; + MOV BUILD_STATE,NO ;; ;AN000; + .ENDIF ;; ;AN000; + ;; ;AN000; + RET ;; ;AN000; + ;; ;AN000; +PARSE_GRAPHICS ENDP ;; ;AN000; + ;; ;AN000; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;AN000; +;; ;AN000; +;; Module Name: ;AN000; +;; PARSE_COLORSELECT ;AN000; +;; ;AN000; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;AN000; + ;; ;AN000; +COLORSELECT_PARSE_PARMS LABEL WORD ;; Parser control blocks ;AN000; + DW COLORSELECT_P ;; ;AN000; + DB 2 ;; # of lists ;AN000; + DB 0 ;; # items in delimeter list ;AN000; + DB 1 ;; # items in end-of-line list ;AN000; + DB ';' ;; ';' used for comments ;AN000; + ;; ;AN000; + ;; ;AN000; +COLORSELECT_P LABEL BYTE ;; ;AN000; +CS_NUM_REQ DB 1,1 ;; Required, max parms ;AN000; +COLORSELECT_PARM LABEL WORD ;; ;AN000; +CS_POSITIONAL DW ? ;; Pointer to our positional ;AN000; + DB 0 ;; # Switches ;AN000; + DB 0 ;; # keywords ;AN000; + ;; ;AN000; +COLORSELECT_P0 DW 2000H ;; sTRING - display type ;AN000; + DW 2 ;; Capitalize ;AN000; + DW RESULT_BUFFER ;; Result buffer ;AN000; + DW COLORSELECT_P0V ;; Value list ;AN000; + DB 0 ;; Synomyms ;AN000; + ;; ;AN000; +COLORSELECT_P0V DB 0 ;; # of value lists ;AN000; +; DB 0 ;; # of range numerics ;AN000; +; DB 0 ;; # of discrete numerics ;AN000; +; DB 1 ;; # of strings ;AN000; +; DB 1 ;; tag ;AN000; +;COLORSELECT_P0V1 DW ? ;; string ;AN000; + ;; ;AN000; +COLORSELECT_P1 DW 8001H ;; Numeric - escape sequence byte ;AN000; + DW 0 ;; No Capitalize ;AN000; + DW RESULT_BUFFER ;; Result buffer ;AN000; + DW COLORSELECT_P1V ;; Value list ;AN000; + DB 0 ;; Synomyms ;AN000; + ;; ;AN000; +COLORSELECT_P1V DB 1 ;; # of value lists ;AN000; + DB 1 ;; # of range numerics ;AN000; + DB 1 ;; tag ;AN000; + DD 1,255 ;; range 1..255 ;AN000; + ;; ;AN000; + ;; ;AN000; + ;; ;AN000; +SEQ_LENGTH_PTR DW 0 ;; Number of colorselect statements ;AN000; + ;; ;AN000; + ;; ;AN000; + ;; ;AN000; +PARSE_COLORSELECT PROC ;; ;AN000; + ;; ;AN000; + MOV CUR_STMT,COLS ;; ;AN000; + .IF ;; PRINTER statemnet must have been ;AN000; + OR STMT_ERROR,MISSING ;; processed ;AN000; + MOV PARSE_ERROR,YES ;; ;AN000; + MOV BUILD_STATE,NO ;; ;AN000; + .ENDIF ;; ;AN000; + ;; ;AN000; + .IF ;; DISDPLAYMODE and COLORPRINT stmts ;AN000; + OR STMT_ERROR,SEQUENCE ;; should NOT have been processed ;AN000; + MOV PARSE_ERROR,YES ;; ;AN000; + MOV BUILD_STATE,NO ;; ;AN000; + .ENDIF ;; ;AN000; + ;; ;AN000; + .IF ;; Check for a previous group of ;AN000; + OR STMT_ERROR,SEQUENCE ;; COLORSELECTS within this PTD ;AN000; + MOV PARSE_ERROR,YES ;; ;AN000; + MOV BUILD_STATE,NO ;; ;AN000; + .ENDIF ;; ;AN000; + ;; ;AN000; + .IF ;; If first COLORSELECT... ;AN000; + MOV NUM_BANDS,0 ;; Init number of COLORSELECT bands ;AN000; + .IF ;; Update count and pointer in the ;AN000; + MOV AX,BLOCK_END ;; Shared Data Area header ;AN000; + MOV [BP].COLORSELECT_PTR,AX ;; Set pointer to COLORSELECT info ;AN000; + MOV [BP].NUM_PRT_BANDS,0 ;; Init NUMBER OF COLORSELECTS ;AN000; + .ENDIF ;; ;AN000; + .ENDIF ;; ;AN000; + ;; ;AN000; + OR STMTS_DONE,COLS ;; Indicate found ;AN000; + .IF THEN ;; Terminate any preceeding groups ;AN000; + MOV AX,PREV_STMT ;; except for COLORSELECT ;AN000; + OR GROUPS_DONE,AX ;; ;AN000; + .ENDIF ;; ;AN000; + ;; ;AN000; + MOV AX,1 ;; Make room for sequence length field ;AN000; + CALL GROW_SHARED_DATA ;; ;AN000; + .IF ;; ;AN000; + INC [BP].NUM_PRT_BANDS ;; Inc number of selects ;AN000; + MOV DI,BLOCK_END ;; ;AN000; + MOV BYTE PTR [BP+DI-1],0 ;; Init sequence length field ;AN000; + LEA AX,[DI-1] ;; ;AN000; + MOV SEQ_LENGTH_PTR,AX ;; Save pointer to length of sequence ;AN000; + .ENDIF ;; ;AN000; + ;; ;AN000; + MOV DI,OFFSET COLORSELECT_PARSE_PARMS ;; parse parms ;AN000; + MOV CS_NUM_REQ,1 ;; Change to 1 required parameters ;AN000; + MOV AX,OFFSET COLORSELECT_P0 ;; Point to control block for the band ;AN000; + MOV CS_POSITIONAL,AX ;; ID. (Dealing with only 1 positional ;AN000; + ;; parameter at a time was the only way ;AN000; + ;; I could get SYSPARSE to handle ;AN000; + ;; the COLORSELECT syntax!) ;AN000; + ;; SI => the line to parse ;AN000; + XOR DX,DX ;; ;AN000; + XOR CX,CX ;; ;AN000; + ;; ;AN000; + CALL SYSPARSE ;; PARSE the band ID ;AN000; + .IF ;; ;AN000; + OR STMT_ERROR,INVALID ;; ;AN000; + MOV PARSE_ERROR,YES ;; ;AN000; + MOV BUILD_STATE,NO ;; ;AN000; + RET ;; statement. ;AN000; + .ENDIF ;; ;AN000; + ;; ;AN000; + PUSH ES ;; We got a band id........ ;AN000; + PUSH DI ;; ;AN000; + ;; ;AN000; + LES DI,DWORD PTR RESULT_VAL ;; Get pointer to the parsed band id ;AN000; + .IF < NE 0> ;; Make sure the band id is only ;AN000; + OR STMT_ERROR,INVALID ;; one byte long ;AN000; + MOV PARSE_ERROR,YES ;; ;AN000; + MOV BUILD_STATE,NO ;; ;AN000; + .ENDIF ;; ;AN000; + ;; ;AN000; + MOV BL,NUM_BANDS ;; ;AN000; + XOR BH,BH ;; ;AN000; + .IF THEN ;; Watch out for too many COLORSELECTs ;AN000; + OR STMT_ERROR,SEQUENCE ;; ;AN000; + MOV PARSE_ERROR,YES ;; ;AN000; + MOV BUILD_STATE,NO ;; ;AN000; + .ELSE ;; ;AN000; + SHL BX,1 ;; calc index to store band in value list;AN000; + MOV AL,ES:[DI] ;; get BAND ID FROM PARSEr ;AN000; + MOV BAND_VAL_LIST[BX],AL ;; ;AN000; + INC NUM_BANDS ;; bump number of bands ;AN000; + .ENDIF ;; ;AN000; + ;; ;AN000; + POP DI ;; ;AN000; + POP ES ;; ;AN000; + ;; ;AN000; + ;; ;AN000; + MOV AX,OFFSET COLORSELECT_P1 ;; Switch to numeric positional parm!!! ;AN000; + MOV CS_POSITIONAL,AX ;; ;AN000; + MOV CS_NUM_REQ,0 ;; Change to 0 required parameters ;AN000; + XOR DX,DX ;; PARSE the sequence of escape bytes ;AN000; + .REPEAT ;; ;AN000; + XOR CX,CX ;; ;AN000; + CALL SYSPARSE ;; ;AN000; + .IF ;; If esc byte is valid ;AN000; + PUSH AX ;; ;AN000; + MOV AX,1 ;; Add a byte to the sequence ;AN000; + CALL GROW_SHARED_DATA ;; Update block end ;AN000; + .IF ;; ;AN000; + PUSH DI ;; ;AN000; + MOV DI,SEQ_LENGTH_PTR ;; ;AN000; + INC byte ptr [BP+DI] ;; Bump number of bytes in sequence ;AN000; + MOV DI,BLOCK_END ;; ;AN000; + MOV AL,RESULT_VAL ;; Get esc byte from result buffer ;AN000; + MOV [BP+DI-1],AL ;; Store at end of sequence ;AN000; + POP DI ;; ;AN000; + .ENDIF ;; ;AN000; + POP AX ;; ;AN000; + .ELSE ;; ;AN000; + .IF ;; ;AN000; + OR STMT_ERROR,INVALID ;; parm is invalid ;AN000; + MOV PARSE_ERROR,YES ;; ;AN000; + MOV BUILD_STATE,NO ;; ;AN000; + .ENDIF ;; ;AN000; + .ENDIF ;; ;AN000; + .UNTIL NEAR ;; ;AN000; + ;; ;AN000; + ;; ;AN000; + RET ;; ;AN000; + ;; ;AN000; +PARSE_COLORSELECT ENDP ;; ;AN000; + ;; ;AN000; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;AN000; +;; ;AN000; +;; Module Name: ;AN000; +;; PARSE_COLORPRINT ;AN000; +;; ;AN000; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;AN000; + ;; ;AN000; +COLORPRINT_PARSE_PARMS LABEL WORD ;; Parser control blocks ;AN000; + DW COLORPRINT_P ;; ;AN000; + DB 2 ;; # of lists ;AN000; + DB 0 ;; # items in delimeter list ;AN000; + DB 1 ;; # items in end-of-line list ;AN000; + DB ';' ;; ';' used for comments ;AN000; + ;; ;AN000; + ;; ;AN000; +COLORPRINT_P LABEL BYTE ;; ;AN000; + DB 3,4 ;; Required,MAX ;AN000; + DW COLORPRINT_P0 ;; Numeric: Red value ;AN000; + DW COLORPRINT_P0 ;; Green value ;AN000; + DW COLORPRINT_P0 ;; Blue value ;AN000; + DW COLORPRINT_P1 ;; Band ID ... REPEATING ;AN000; + DB 0 ;; # Switches ;AN000; + DB 0 ;; # keywords ;AN000; + ;; ;AN000; +COLORPRINT_P0 DW 8000H ;; Numeric - RGB value ;AN000; + DW 0 ;; No Capitalize ;AN000; + DW RESULT_BUFFER ;; Result buffer ;AN000; + DW COLORPRINT_P0V ;; Value list ;AN000; + DB 0 ;; Synomyms ;AN000; + ;; ;AN000; +COLORPRINT_P0V DB 1 ;; # of value lists ;AN000; + DB 1 ;; # of range numerics ;AN000; + DB 1 ;; tag ;AN000; + DD 0,63 ;; range 0..63 ;AN000; + ;; ;AN000; +COLORPRINT_P1 DW 2001H ;; sTRING - Band ID ;AN000; + DW 2 ;; Capitalize ;AN000; + DW RESULT_BUFFER ;; Result buffer ;AN000; + DW COLORPRINT_P1V ;; Value list ;AN000; + DB 0 ;; Synomyms ;AN000; + ;; ;AN000; +COLORPRINT_P1V DB 3 ;; # of value lists ;AN000; + DB 0 ;; 0 - no range numerics ;AN000; + DB 0 ;; 0 - no actual numerics ;AN000; +NUM_BANDS DB 0 ;; number of band values ;AN000; + DB 01H ;; tag: TAGS ARE BAND MASKS ;AN000; + DW BAND_PTR_1 ;; ptr ;AN000; + DB 02H ;; tag ;AN000; + DW BAND_PTR_2 ;; ptr ;AN000; + DB 04H ;; tag ;AN000; + DW BAND_PTR_3 ;; ptr ;AN000; + DB 08H ;; tag ;AN000; + DW BAND_PTR_4 ;; ptr ;AN000; + DB 10H ;; tag ;AN000; + DW BAND_PTR_5 ;; ptr ;AN000; + DB 20H ;; tag ;AN000; + DW BAND_PTR_6 ;; ptr ;AN000; + DB 40H ;; tag ;AN000; + DW BAND_PTR_7 ;; ptr ;AN000; + DB 80H ;; tag ;AN000; + DW BAND_PTR_8 ;; ptr ;AN000; + ;; ;AN000; +MAX_BANDS EQU 8 ;; ;AN000; + ;; ;AN000; +BAND_VAL_LIST LABEL BYTE ;; ;AN000; +BAND_PTR_1 DB ?,0 ;; ;AN000; +BAND_PTR_2 DB ?,0 ;; ;AN000; +BAND_PTR_3 DB ?,0 ;; ;AN000; +BAND_PTR_4 DB ?,0 ;; ;AN000; +BAND_PTR_5 DB ?,0 ;; ;AN000; +BAND_PTR_6 DB ?,0 ;; ;AN000; +BAND_PTR_7 DB ?,0 ;; ;AN000; +BAND_PTR_8 DB ?,0 ;; ;AN000; + ;; ;AN000; + ;; ;AN000; +PARSE_COLORPRINT PROC ;; ;AN000; + ;; ;AN000; + MOV CUR_STMT,COLP ;; ;AN000; + .IF ;; PRINTER statemnet must have been ;AN000; + OR STMT_ERROR,MISSING ;; processed ;AN000; + MOV PARSE_ERROR,YES ;; ;AN000; + MOV BUILD_STATE,NO ;; ;AN000; + .ENDIF ;; ;AN000; + ;; ;AN000; + .IF ;; DISPLAYMODE stmts ;AN000; + OR STMT_ERROR,SEQUENCE ;; should NOT have been processed ;AN000; + MOV PARSE_ERROR,YES ;; ;AN000; + MOV BUILD_STATE,NO ;; ;AN000; + .ENDIF ;; ;AN000; + ;; ;AN000; + .IF ;; Check for a previous group of ;AN000; + OR STMT_ERROR,SEQUENCE ;; COLORPRINTS within this PTD ;AN000; + MOV PARSE_ERROR,YES ;; ;AN000; + MOV BUILD_STATE,NO ;; ;AN000; + .ENDIF ;; ;AN000; + ;; ;AN000; + MOV CUR_PRINTER_TYPE,COLOR ;; ;AN000; + ;; ;AN000; + .IF ;; If first COLORPRINT... ;AN000; + .IF ;; Update count and pointer in the ;AN000; + MOV AX,BLOCK_END ;; Shared Data Area header ;AN000; + MOV [BP].COLORPRINT_PTR,AX ;; Set pointer to COLORPRINT info ;AN000; + MOV [BP].PRINTER_TYPE,COLOR ;; ;AN000; + MOV [BP].NUM_PRT_COLOR,0 ;; Init NUMBER OF COLORPRINTS ;AN000; + .ENDIF ;; ;AN000; + .ENDIF ;; ;AN000; + ;; ;AN000; + .IF ;; ;AN000; + INC [BP].NUM_PRT_COLOR ;; Inc number of selects ;AN000; + .ENDIF ;; ;AN000; + ;; ;AN000; + OR STMTS_DONE,COLP ;; Indicate found ;AN000; + .IF THEN ;; Terminate any preceeding groups ;AN000; + MOV AX,PREV_STMT ;; except for COLORPRINT ;AN000; + OR GROUPS_DONE,AX ;; ;AN000; + .ENDIF ;; ;AN000; + ;; ;AN000; + MOV AX,BLOCK_END ;; Start a new block ;AN000; + MOV BLOCK_START,AX ;; ;AN000; + MOV AX,SIZE COLORPRINT_STR ;; Make room for COLORPRINT info ;AN000; + CALL GROW_SHARED_DATA ;; ;AN000; + ;; ;AN000; + MOV DI,OFFSET COLORPRINT_PARSE_PARMS ;; parse parms ;AN000; + ;; SI => the line to parse ;AN000; + XOR DX,DX ;; ;AN000; + XOR CX,CX ;; ;AN000; + ;; ;AN000; + CALL SYSPARSE ;; PARSE the RED value ;AN000; + .IF ;; ;AN000; + OR STMT_ERROR,INVALID ;; ;AN000; + MOV PARSE_ERROR,YES ;; ;AN000; + MOV BUILD_STATE,NO ;; ;AN000; + .ELSE ;; ;AN000; + .IF ;; ;AN000; + PUSH DI ;; ;AN000; + MOV DI,BLOCK_START ;; ;AN000; + MOV AL,RESULT_VAL ;; Store RED value in COLORPRINT info ;AN000; + MOV [BP+DI].RED,AL ;; ;AN000; + POP DI ;; ;AN000; + .ENDIF ;; ;AN000; + .ENDIF ;; ;AN000; + ;; ;AN000; + CALL SYSPARSE ;; PARSE the GREEN value ;AN000; + .IF ;; ;AN000; + OR STMT_ERROR,INVALID ;; ;AN000; + MOV PARSE_ERROR,YES ;; ;AN000; + MOV BUILD_STATE,NO ;; ;AN000; + .ELSE ;; ;AN000; + .IF ;; ;AN000; + PUSH DI ;; ;AN000; + MOV DI,BLOCK_START ;; ;AN000; + MOV AL,RESULT_VAL ;; Store GREEN value in COLORPRINT info ;AN000; + MOV [BP+DI].GREEN,AL ;; ;AN000; + POP DI ;; ;AN000; + .ENDIF ;; ;AN000; + .ENDIF ;; ;AN000; + ;; ;AN000; + CALL SYSPARSE ;; PARSE the BLUE value ;AN000; + .IF ;; ;AN000; + OR STMT_ERROR,INVALID ;; ;AN000; + MOV PARSE_ERROR,YES ;; ;AN000; + MOV BUILD_STATE,NO ;; ;AN000; + .ELSE ;; ;AN000; + .IF ;; ;AN000; + PUSH DI ;; ;AN000; + MOV DI,BLOCK_START ;; ;AN000; + MOV AL,RESULT_VAL ;; Store BLUE value in COLORPRINT info ;AN000; + MOV [BP+DI].BLUE,AL ;; ;AN000; + POP DI ;; ;AN000; + .ENDIF ;; ;AN000; + .ENDIF ;; ;AN000; + ;; ;AN000; + .IF ;; ;AN000; + PUSH DI ;; ;AN000; + MOV DI,BLOCK_START ;; ;AN000; + MOV [BP+DI].SELECT_MASK,0 ;; Initialize band select mask ;AN000; + POP DI ;; ;AN000; + .ENDIF ;; ;AN000; + XOR DX,DX ;; For each band found "OR" the item ;AN000; + .REPEAT ;; tag into the select mask ;AN000; + MOV CX,3 ;; Avoid getting too many parms error ;AN000; + CALL SYSPARSE ;; from parser ;AN000; + .IF ;; ;AN000; + .IF ;; ;AN000; + PUSH DI ;; ;AN000; + MOV DI,BLOCK_START ;; ;AN000; + MOV AL,RESULT_TAG ;; ;AN000; + OR [BP+DI].SELECT_MASK,AL ;; OR the mask for this band into the ;AN000; + ;; select mask for this color ;AN000; + POP DI ;; ;AN000; + .ENDIF ;; ;AN000; + .ELSE ;; ;AN000; + .IF ;; ;AN000; + OR STMT_ERROR,INVALID ;; parm is invalid ;AN000; + MOV PARSE_ERROR,YES ;; ;AN000; + MOV BUILD_STATE,NO ;; ;AN000; + .ENDIF ;; ;AN000; + .ENDIF ;; ;AN000; + .UNTIL NEAR ;; ;AN000; + ;; ;AN000; + RET ;; ;AN000; + ;; ;AN000; +PARSE_COLORPRINT ENDP ;; ;AN000; + ;; ;AN000; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;AN000; + ;; ;AN000; + ;; ;AN000; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;AN000; +;; ;AN000; +;; Module Name: ;AN000; +;; PARSE_DARKADJUST ;AN000; +;; ;AN000; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;AN000; + ;AN000; +DARKADJUST_PARSE_PARMS LABEL WORD ;; Parser control blocks ;AN000; + DW DARKADJUST_P ;; ;AN000; + DB 2 ;; # of lists ;AN000; + DB 0 ;; # items in delimeter list ;AN000; + DB 1 ;; # items in end-of-line list ;AN000; + DB ';' ;; ';' used for comments ;AN000; + ;; ;AN000; + ;; ;AN000; +DARKADJUST_P LABEL BYTE ;; ;AN000; + DB 1,1 ;; Required,MAX ;AN000; + DW DARKADJUST_P0 ;; Numeric: adjust value ;AN000; + DB 0 ;; # Switches ;AN000; + DB 0 ;; # keywords ;AN000; + ;; ;AN000; +DARKADJUST_P0 DW 4000H ;; Signed Numeric - adjust value ;AN000; + DW 0 ;; No Capitalize ;AN000; + DW RESULT_BUFFER ;; Result buffer ;AN000; + DW DARKADJUST_P0V ;; Value list ;AN000; + DB 0 ;; Synomyms ;AN000; + ;; ;AN000; +DARKADJUST_P0V DB 1 ;; # of value lists ;AN000; + DB 1 ;; # of range numerics ;AN000; + DB 1 ;; tag ;AN000; + DD -63,63 ;; range -63,63 ;AN000; +;;;;***********************************;; ;AN000; + ;; ;AN000; + ;AN000; +PARSE_DARKADJUST PROC ;; ;AN000; + ;; ;AN000; + MOV CUR_STMT,DARK ;; ;AN000; + .IF ;; PRINTER statemnet must have been ;AN000; + OR STMT_ERROR,MISSING ;; processed ;AN000; + MOV PARSE_ERROR,YES ;; ;AN000; + MOV BUILD_STATE,NO ;; ;AN000; + .ENDIF ;; ;AN000; + ;; ;AN000; + ;; ;AN000; + OR STMTS_DONE,DARK ;; Indicate found ;AN000; + ;; Terminate any preceeding groups ;AN000; + MOV AX,PREV_STMT ;; ;AN000; + OR GROUPS_DONE,AX ;; ;AN000; + ;; ;AN000; + MOV DI,OFFSET DARKADJUST_PARSE_PARMS ;; parse parms ;AN000; + ;; SI => the line to parse ;AN000; + XOR DX,DX ;; ;AN000; + XOR CX,CX ;; ;AN000; + ;; ;AN000; + CALL SYSPARSE ;; PARSE the ADJUST VALUE ;AN000; + .IF ;; ;AN000; + OR STMT_ERROR,INVALID ;; ;AN000; + MOV PARSE_ERROR,YES ;; ;AN000; + MOV BUILD_STATE,NO ;; ;AN000; + .ELSE ;; ;AN000; + .IF ;; ;AN000; + MOV AL,RESULT_VAL ;; ;AN000; + MOV [BP].DARKADJUST_VALUE,AL ;; ;AN000; + .ENDIF ;; ;AN000; + CALL SYSPARSE ;; CHECK FOR EXTRA PARMS ;AN000; + .IF ;; ;AN000; + OR STMT_ERROR,INVALID ;; ;AN000; + MOV PARSE_ERROR,YES ;; ;AN000; + MOV BUILD_STATE,NO ;; ;AN000; + .ENDIF ;; ;AN000; + .ENDIF ;; ;AN000; + ;; ;AN000; + RET ;; ;AN000; + ;; ;AN000; +PARSE_DARKADJUST ENDP ;; ;AN000; + ;AN000; +LIMIT LABEL NEAR ;; ;AN000; +CODE ENDS ;; ;AN000; + END ;AN000; diff --git a/v4.0/src/CMD/GRAPHICS/GRLOAD3.EXT b/v4.0/src/CMD/GRAPHICS/GRLOAD3.EXT new file mode 100644 index 0000000..6c1b8e5 --- /dev/null +++ b/v4.0/src/CMD/GRAPHICS/GRLOAD3.EXT @@ -0,0 +1,28 @@ +.XLIST ;AN000; + ;AN000; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;AN000; +;; DOS - GRAPHICS Command +;; (C) Copyright 1988 Microsoft +;; ;AN000; +;; File Name: GRINST.EXT ;AN000; +;; ---------- ;AN000; +;; ;AN000; +;; Description: ;AN000; +;; ------------ ;AN000; +;; External declarations for code and data defined in ;AN000; +;; GRLOAD.ASM ;AN000; +;; ;AN000; +;; Change History: ;AN000; +;; --------------- ;AN000; +;; ;AN000; +;; ;AN000; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;AN000; + ;; ;AN000; + EXTRN PARSE_GRAPHICS:NEAR ;; ;AN000; + EXTRN PARSE_COLORSELECT:NEAR ;; ;AN000; + EXTRN PARSE_COLORPRINT:NEAR ;; ;AN000; + EXTRN PARSE_DARKADJUST:NEAR ;; ;AN000; + EXTRN LIMIT:NEAR ;; ;AN000; + ;; ;AN000; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;AN000; +.LIST ;AN000; diff --git a/v4.0/src/CMD/GRAPHICS/GRMSG.EQU b/v4.0/src/CMD/GRAPHICS/GRMSG.EQU new file mode 100644 index 0000000..60b4c0e --- /dev/null +++ b/v4.0/src/CMD/GRAPHICS/GRMSG.EQU @@ -0,0 +1,84 @@ +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;AN000; +;; DOS - GRAPHICS Command +;; (c) Copyright 1988 Microsoft +;; ;AN000; +;; File Name: GRMSG.EQU ;AN000; +;; ---------- ;AN000; +;; ;AN000; +;; DOS GRAPHICS Command - Message number AN000;equates +;; ;AN000; +;; Description: ;AN000; +;; ------------ ;AN000; +;; This file contains the numbers assigned to the error messages ;AN000; +;; issued by GRAPHICS.COM ;AN000; +;; ;AN000; +;; These messages are defined in GRAPHICS.MSG ;AN000; +;; (The message skeleton file for GRAPHICS.COM) ;AN000; +;; ;AN000; +;; This file also contains equates for the error codes returned by ;AN000; +;; the DOS parser. ;AN000; +;; ;AN000; +;; Documentation Reference: ;AN000; +;; ------------------------ ;AN000; +;; ;AN000; +;; DOS 3.3 Message Retriever Interface Supplement. ;AN000; +;; ;AN000; +;; External Procedure References: ;AN000; +;; ------------------------------ ;AN000; +;; FROM FILE GRINST.ASM: ;AN000; +;; GRAPHICS_INSTALL - Main module for GRAPHICS install. ;AN000; +;; PARSE_PARMS - Parse the command line parameters. ;AN000; +;; FROM FILE GRLOAD.ASM AND GRLOAD2.ASM ;AN000; +;; All modules ;AN000; +;; ;AN000; +;; Change History: ;AN000; +;; --------------- ;AN000; +;; ;AN000; +;; ;AN000; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;AN000; + ;AN000; +;-------------------------------------------------------------------------------;AN000; +; GRAPHICS MESSAGE NUMBERS ;AN000; +;-------------------------------------------------------------------------------;AN000; + ;AN000; +; Class A messages: ;AN000; +INCORRECT_DOS EQU 1 ; 'Incorrect DOS version' ;AN000; +NO_MEMORY EQU 2 ; 'Insufficient memory' ;AN000; + ;AN000; +; Class B messages: (Profile loading) ;AN000; +PROFILE_NOT_FOUND EQU 9 ; 'Cannot find GRAPHICS profile' ;AN000; +MISSING_STMT EQU 10 ; 'Required profile statement missing ;AN000; + ; before line %1' ;AN000; +INVALID_STMT EQU 11 ; 'Invalid profile statement on line %1' ;AN000; +OUT_SEQ_STMT EQU 12 ; 'Profile statement out of sequence on line %1';AN000; +FILE_ERRORS EQU 13 ; 'Error reading GRAPHICS profile' ;AN000; +SYNTAX_ERRORS EQU 14 ; 'Syntax errors in GRAPHICS profile' ;AN000; +INVALID_PB EQU 15 ; 'PRINTBOX id not in GRAPHICS profile' ;AN000; +INVALID_PRT EQU 16 ; 'Printer type not in GRAPHICS profile' ;AN000; + ;AN000; +; Class C messages: (Command line parsing) ;AN000; +TOO_MANY_PARMS EQU 3 ; 'Too many parameters' ;AN000; +VALUE_NOT_ALLOWED EQU 4 ; 'Parameter value not allowed' ;AN000; +INVALID_PARM EQU 5 ; 'Invalid parameter %1' ;AN000; +INVALID_COMBINATION EQU 6 ; 'Invalid parameter combination' ;AN000; +DUPLICATE_PARM EQU 7 ; 'Duplicate parameters not allowed' ;AN000; +FORMAT_NOT_CORRECT EQU 8 ; 'Parameter format not correct' ;AN000; +INVALID_B_SWITCH EQU 17 ; '/B invalid with a Black and White printer' ;AN000; +UNABLE_RELOAD EQU 18 ; 'Unable to reload with profile supplied' ;AN000; + ;AN000; + ;AN000; + ;AN000; +;-------------------------------------------------------------------------------;AN000; +; PARSER ERROR CODES AND OUR OWN PARSING ERROR CODES ;AN000; +; *** ;AN000; +;-------------------------------------------------------------------------------;AN000; + ;AN000; +RC_NO_ERROR EQU 0 ;AN000; +RC_EOL EQU -1 ;AN000; +RC_TOO_MANY EQU 1 ;AN000; +RC_NOT_IN_SW EQU 3 ;AN000; +RC_NOT_IN_VAL EQU 7 ;AN000; +RC_NOT_IN_STR EQU 8 ;AN000; + ;AN000; +RC_INVLD_COMBINATION EQU 99 ;AN000; +RC_DUPLICATE_PARMS EQU 100 ;AN000; diff --git a/v4.0/src/CMD/GRAPHICS/GRPARMS.ASM b/v4.0/src/CMD/GRAPHICS/GRPARMS.ASM new file mode 100644 index 0000000..8cebf2e --- /dev/null +++ b/v4.0/src/CMD/GRAPHICS/GRPARMS.ASM @@ -0,0 +1,717 @@ + PAGE ,132 ;AN000; + TITLE DOS - GRAPHICS Command - Command line parsing module ;AN000; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;AN000; +;; DOS - GRAPHICS Command +;; (C) Copyright 1988 Microsoft +;; ;AN000; +;; File Name: GRPARMS.ASM ;AN000; +;; ---------- ;AN000; +;; ;AN000; +;; Description: ;AN000; +;; ------------ ;AN000; +;; ;AN000; +;; This file contains modules for parsing the GRAPHICS.COM ;AN000; +;; command line; using the DOS PARSER. ;AN000; +;; ;AN000; +;; ;AN000; +;; Documentation Reference: ;AN000; +;; ------------------------ ;AN000; +;; OASIS High Level Design ;AN000; +;; OASIS GRAPHICS I1 Overview ;AN000; +;; DOS 3.3 Message Retriever Interface Supplement. ;AN000; +;; TUPPER I0 Document - PARSER HIGH LEVEL DESIGN REVIEW ;AN000; +;; ;AN000; +;; Procedures Contained in This File: ;AN000; +;; ---------------------------------- ;AN000; +;; PARSE_PARMS - Parse the command line ;AN000; +;; GET_R - Get /R ;AN000; +;; GET_B - Get /B ;AN000; +;; GET_LCD - Get /LCD ;AN000; +;; GET_PRINTBOX - Get /PRINTBOX ;AN000; +;; GET_PROFILE - Get the profile path and file name ;AN000; +;; GET_TYPE - Get the printer type ;AN000; +;; ;AN000; +;; Include Files Required: ;AN000; +;; ----------------------- ;AN000; +;; GRINST.EXT - Externals for installation modules ;AN000; +;; GRPARSE.EXT - Externals for the DOS parser code ;AN000; +;; GRSHAR.STR - Shared Data Area Structure ;AN000; +;; GRMSG.EQU - Equates for GRAPHICS.COM error messages ;AN000; +;; STRUC.INC - Macros for using structured assembly language ;AN000; +;; ;AN000; +;; External Procedure References: ;AN000; +;; ------------------------------ ;AN000; +;; FROM FILE GRINST.ASM: ;AN000; +;; GRAPHICS_INSTALL - Main module for the installation of GRAPHICS ;AN000; +;; SYSPARSE - DOS system parser ;AN000; +;; SYSDISPMSG - DOS message retriever ;AN000; +;; ;AN000; +;; Linkage Instructions: ;AN000; +;; -------------------- ;AN000; +;; Refer to GRAPHICS.ASM ;AN000; +;; ;AN000; +;; Change History: ;AN000; +;; --------------- ;AN000; +;; ;AN000; +;; ;AN000; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;AN000; +CODE SEGMENT PUBLIC 'CODE' ;AN000; + ASSUME CS:CODE,DS:CODE ;AN000; +PARSE_PARMS PROC NEAR ;AN000; + jmp PARSE_PARMS_START ;AN000; +PUBLIC PARSE_PARMS ;AN000; +.XLIST ;AN000; +INCLUDE GRMSG.EQU ; Include GRAPHICS error messages equates ;AN000; +INCLUDE GRSHAR.STR ; Include the Shared data area structure ;AN000; +INCLUDE GRINST.EXT ; Include externals for the installation module ;AN000; +INCLUDE GRPARSE.EXT ; Include externals for the DOS parse code ;AN000; +INCLUDE STRUC.INC ; Include macros for using STRUCTURES ;AN000; +.LIST ;AN000; + ;AN000; +PAGE ;AN000; +;===============================================================================;AN000; +; ;AN000; +; PARSE_PARMS : PARSE THE COMMAND LINE PARAMETERS. ;AN000; +; ;AN000; +;-------------------------------------------------------------------------------;AN000; +; ;AN000; +; INPUT: DS,ES = SEGMENT CONTAINING THE PROGRAM PREFIX SEGMENT ;AN000;(PSP) +; ;AN000; +; OUTPUT: SWITCHES = A bit mask in the shared data area indicating ;AN000; +; which command line switches are set. ;AN000; +; PROFILE_PATH = The profile file name and path (ASCIIZ string);AN000; +; PRINTBOX_ID_PTR = Offset of the printbox id (ASCIIZ string) ;AN000; +; PRINTER_TYPE_PARM = printer type (ASCIIZ string) ;AN000; +; CARRY FLAG IS SET if an error occurred ;AN000; +; ;AN000; +;-------------------------------------------------------------------------------;AN000; +; ;AN000; +; DESCRIPTION: Call the DOS parser to parse the command line parameters ;AN000; +; of the GRAPHICS command line which is obtained from the PSP (Program Segment ;AN000; +; Prefix). ;AN000; +; ;AN000; +; The format of the command line is: ;AN000; +; ;AN000; +; ;AN000; +; GRAPHICS {prt_type {profile}} {/R} {/B} {[/LCD | /PRINTBOX:id]} ;AN000; +; ;AN000; +; (All arguments are optional, /PRINTBOX can be spelled /PB.) ;AN000; +; ;AN000; +; If no printer type is specified then, a null pointer is returned. ;AN000; +; If no profile name is supplied then, a null string is returned. ;AN000; +; If "/LCD" is specified then, a pointer to the printbox id: "LCD" is returned. ;AN000; +; ;AN000; +; ;AN000; +; LOGIC: ;AN000; +; Set addressibility to the command line parameters in the PSP ;AN000; +; CALL SYSPARSE ; Call the system parser ;AN000; +; While not (End Of Line) AND no error ;AN000; +; IF argument is the profile name ;AN000; +; THEN Get the profile name ;AN000; +; IF argument is the printbox switch ;AN000; +; THEN Get the printbox id ;AN000; +; IF argument is a /r ;AN000; +; THEN Get /r ;AN000; +; IF argument is /b ;AN000; +; THEN Get /b ;AN000; +; IF argument /lcd ;AN000; +; THEN Get /lcd ;AN000; +; CALL SYSPARSE ;AN000; +; If error ;AN000; +; Then display the appropriate error message ;AN000; +; ;AN000; +;-------------------------------------------------------------------------------;AN000; +; BIT MASK INDICATING THE COMMAND LINE SWITCHES PARSED SO FAR: ;AN000; +;-------------------------------------------------------------------------------;AN000; +SWITCH_PARSED DB 0 ;AN000; +GOT_R EQU 1 ; Found /R ;AN000; +GOT_B EQU 2 ; Found /B ;AN000; +GOT_LCD EQU 4 ; Found /LCD ;AN000; +GOT_PRINTBOX EQU 8 ; Found /PB:id or /PRINTBOX:id ;AN000; + ;AN000; +;===============================================================================;AN000; +; ;AN000; +; CONTROL BLOCK DEFINITIONS FOR THE PARSER: ;AN000; +; ;AN000; +;===============================================================================;AN000; + ;AN000; +;-------------------------------------------------------------------------------;AN000; +; PARMS INPUT BLOCK ;AN000; +;-------------------------------------------------------------------------------;AN000; +PARMS LABEL WORD ;AN000; + DW PARMSX ; Offset of parms extension block ;AN000; + DB 0 ; No delimiters to define ;AN000; + ; or end of line markers. ;AN000; + ;AN000; + ;AN000; +;-------------------------------------------------------------------------------;AN000; +; PARMS EXTENSION BLOCK : Describe what's on the command line ;AN000; +;-------------------------------------------------------------------------------;AN000; +PARMSX LABEL BYTE ;AN000; + DB 0,2 ; Max. 2 positional parameters ;AN000; + DW TYPE_CTL ; Offset of type control block ;AN000; + DW PROF_CTL ; Offset of profile control block ;AN000; + ;AN000; + DB 4 ; Max. 4 switch types ;AN000; + DW PRINTBOX_CTL ; Offset of control for Printbox ;AN000; + DW R_CTL ; Offset of control for /R ;AN000; + DW B_CTL ; Offset of control for /B ;AN000; + DW LCD_CTL ; Offset of control for /LCD ;AN000; + ;AN000; + DB 0 ; No keywords ;AN000; + ;AN000; +;-------------------------------------------------------------------------------;AN000; +; ;AN000; +; Describe the printer type parameter: ;AN000; +; ;AN000; +;-------------------------------------------------------------------------------;AN000; +TYPE_CTL LABEL WORD ;AN000; + DW 2001H ; Optional simple string ;AN000; + DW 0002H ; Capitalize it ;AN000; + DW TYPE_RESULT ; Offset of result buffer for printer type ;AN000; + DW NO_VALUES ; No values (NOTE: The type returned is checked;AN000; + DB 0 ; for validity by LOAD_PROFILE);AN000; + ;AN000; +NO_VALUES DB 0 ;AN000; + ;AN000; +TYPE_RESULT LABEL BYTE ;AN000; + DB ? ; Type ;AN000; + DB ? ; Item tag ;AN000; + DW ? ; Offset of synomym ;AN000; + DD ? ; Pointer to string found ;AN000; + ;AN000; +;-------------------------------------------------------------------------------;AN000; +; ;AN000; +; Describe the format of the PROFILE parameter: ;AN000; +; ;AN000; +;-------------------------------------------------------------------------------;AN000; + ;AN000; +PROF_CTL LABEL WORD ;AN000; + DW 0201H ; File spec. - Optional ;AN000; + DW 0001h ; Capitalize ;AN000; + DW PROFILE_RESULT ; Offset of result buffer for Profile ;AN000; + DW NO_VALUES ; No values needed ;AN000; + DB 0 ;AN000; + ;AN000; + ;AN000; +PROFILE_RESULT LABEL BYTE ;AN000; + DB ? ; Type ;AN000; + DB ? ; Item tag ;AN000; + DW ? ; Offset of synomym ;AN000; + DD ? ; Offset of string ;AN000; + ;AN000; +;-------------------------------------------------------------------------------;AN000; +; ;AN000; +; Describe the format of /R ;AN000; +; ;AN000; +;-------------------------------------------------------------------------------;AN000; +R_CTL LABEL WORD ;AN000; + DW 0 ; ;AN000; + DW 0 ; ;AN000; + DW R_RESULT ; Offset of result buffer for a simple switch ;AN000; + DW NO_VALUES ; No values can be given with these switches. ;AN000; + DB 1 ; 1 name for this switch ;AN000; + DB "/R",0 ; Reverse ;AN000; + ;AN000; +R_RESULT LABEL BYTE ;AN000; + DB ? ; Type ;AN000; + DB ? ; Item tag ;AN000; + DW ? ; Offset of synomym ;AN000; + DD ? ; Offset of value ;AN000; + ;AN000; +;-------------------------------------------------------------------------------;AN000; +; ;AN000; +; Describe the format of /B ;AN000; +; ;AN000; +;-------------------------------------------------------------------------------;AN000; +B_CTL LABEL WORD ;AN000; + DW 0 ; ;AN000; + DW 0 ; ;AN000; + DW B_RESULT ; Offset of result buffer for a simple switch ;AN000; + DW NO_VALUES ; No values can be given with these switches. ;AN000; + DB 1 ; 1 name allowed for this switch ;AN000; + DB "/B",0 ; Background ;AN000; + ;AN000; +B_RESULT LABEL BYTE ;AN000; + DB ? ; Type ;AN000; + DB ? ; Item tag ;AN000; + DW ? ; Offset of synomym ;AN000; + DD ? ; Offset of value ;AN000; + ;AN000; +;-------------------------------------------------------------------------------;AN000; +; ;AN000; +; Describe the format of /LCD ;AN000; +; ;AN000; +;-------------------------------------------------------------------------------;AN000; +LCD_CTL LABEL WORD ;AN000; + DW 0 ; ;AN000; + DW 0 ; ;AN000; + DW LCD_RESULT ; Offset of result buffer for a /LCD ;AN000; + DW NO_VALUES ; No values can be given with these switches. ;AN000; + DB 1 ; 1 name: ;AN000; + DB "/LCD",0 ; /LCD ;AN000; + ;AN000; +LCD_RESULT LABEL BYTE ;AN000; + DB ? ; Type ;AN000; + DB ? ; Item tag ;AN000; + DW ? ; Offset of synomym ;AN000; + DD ? ; Offset of value ;AN000; + ;AN000; +;-------------------------------------------------------------------------------;AN000; +; ;AN000; +; Describe the format of the PRINTBOX switch: ;AN000; +; ;AN000; +;-------------------------------------------------------------------------------;AN000; +PRINTBOX_CTL LABEL WORD ;AN000; + DW 2001H ; Optional simple string ;AN000; + DW 0001H ; Capitalize ;AN000; + DW PRINTBOX_RESULT ; Offset of result buffer for Printbox ;AN000; + DW NO_VALUES ; Values will be validated when loading profile ;AN000; + DB 2 ; 2 synomym for this switch: ;AN000; + DB "/PRINTBOX",0 ; ;AN000; + DB "/PB",0 ;AN000; + ;AN000; +PRINTBOX_RESULT LABEL BYTE ;AN000; + DB ? ; Type ;AN000; + DB ? ; Item tag ;AN000; + DW ? ; Offset of synomym ;AN000; + DD ? ; Offset of value ;AN000; + ;AN000; +;===============================================================================;AN000; +; ;AN000; +; DOS "MESSAGE RETRIEVER" Substitution list control block: ;AN000; +; ;AN000; +;-------------------------------------------------------------------------------;AN000; +SUBLIST LABEL DWORD ; List for substitution: ;AN000; + DB 11 ; Size of this list ;AN000; + DB 0 ; Reserved ;AN000; +SAVE_SI DD ? ; Ptr to data item ;AN001; + DB 1 ; Variable to be substitued: %1 ;AN000; + DB 00010000B ; %1 is an ASCIIZ string left justifi;AN000;ed + DB 0 ; Unlimited size for %1 ;AN000; + DB 1 ; Minimum size is 1 character ;AN000; + DB " " ; Delimiter is "space" ;AN000; + ;AN000; +;===============================================================================;AN000; +; ;AN000; +; START OF EXECUTABLE CODE: ;AN000; +; ;AN000; +;-------------------------------------------------------------------------------;AN000; + ;AN000; +PARSE_PARMS_START: ;AN000; + PUSH AX ;AN000; + PUSH BX ;AN000; + PUSH CX ;AN000; + PUSH DX ;AN000; + PUSH SI ;AN000; + PUSH DI ;AN000; + PUSH ES ;AN000; +;-------------------------------------------------------------------------------;AN000; +; Set up addressibility for the parser ;AN000; +;-------------------------------------------------------------------------------;AN000; + MOV SI,81H ; DS:SI := Command line parameters ;AN000; + ; to be parsed ;AN000; + PUSH CS ;AN000; + POP ES ;AN000; + LEA DI,PARMS ; ES:DI := Parms control block ;AN000; +;(deleted ;AN001;) XOR DX,DX ; CX,DX must be zero for the ;AN000; + XOR CX,CX ; Initially, CX should be zero ;AN001; + MOV AX,0 ; No error yet ;AN000; +;-------------------------------------------------------------------------------;AN000; +; Parse FIRST argument ;AN000; +;-------------------------------------------------------------------------------;AN000; +;(deleted ;AN001;) CALL SYSPARSE ; Get one argument from the command line;AN000; + CALL CALL_SYSPARSE ; Get one argument from the command line;AN001; +;(deleted ;AN001;) MOV BX,DX ; BX := Offset of result block ;AN000; +.WHILE ; While there is no error ;AN000; +;-------------------------------------------------------------------------------;AN000; +; Get the argument: ;AN000; +;-------------------------------------------------------------------------------;AN000; + .SELECT ;AN000; + .WHEN > ;AN000; + CALL GET_TYPE ;AN000; + .WHEN > ;AN000; + CALL GET_PROFILE_NAME ;AN000; + .WHEN > ;AN000; + CALL GET_LCD ;AN000; + .WHEN > ;AN000; + CALL GET_REVERSE ;AN000; + .WHEN > ;AN000; + CALL GET_BACKGROUND ;AN000; + .WHEN > ;AN000; + CALL GET_PRINTBOX_ID ;AN000; + .OTHERWISE ;AN000; +;-------No result block was returned by the parser ;AN000; + STC ; Set error ;AN000; + .ENDSELECT ;AN000; + .LEAVE C ; IF error occurred while parsing the ;AN000; + ; previous argument, exit the loop: ;AN000; + ; stop parsing the command line. ;AN000; +;-------------------------------------------------------------------------------;AN000; +; Parse next argument: ;AN000; +;-------------------------------------------------------------------------------;AN000; +;(deleted ;AN001;) XOR DX,DX ; ;AN000; +;(deleted ;AN001;) CALL SYSPARSE ; Get one argument from the command line;AN000; + CALL CALL_SYSPARSE ; Get one argument from the command line;AN001; +;(deleted ;AN001;) MOV BX,DX ; ES:BX := Offset of result block ;AN000; +.ENDWHILE ;AN000; +;-------------------------------------------------------------------------------;AN000; +; Check for error, select and display an error message ;AN000; +;-------------------------------------------------------------------------------;AN000; +.IF ; IF an error occurred ;AN000; +.THEN ; then, display error message ;AN000; + MOV CX,0 ; Assume no substitutions ;AN000; + .SELECT ; (CX := Number of substitutions ;AN000; + .WHEN ; When RC = Too many parameters ;AN000; + MOV AX,TOO_MANY_PARMS ; (AL = Message number to display) ;AN000; + .WHEN ; When RC = Not in value list provided ;AN000; + MOV AX,VALUE_NOT_ALLOWED ; (AL = Message number to display) ;AN000; + .WHEN ; When RC = Not in switch list provided ;AN000; + MOV CX,1 ; 1 substitution in this message ;AN000; + MOV BYTE PTR [SI],0 ; PUT NUL AT END OF THIS PARM ;AN001; + LEA SI,SUBLIST ; DS:[SI]:="Invalid parm" Substitution;AN000; list +;(deleted ;AN001;) LES DX,ES:[BX+4] ; ES:DX := Offset of offending parm. ;AN000; +;(deleted ;AN001;) MOV [SI]+2,DX ; Store offset to this offender in the;AN000; + MOV [SI]+4,ES ; substitution list control block ;AN000; + MOV AX,INVALID_PARM ; AL := 'Invalid parameter' msg number;AN000; + .WHEN ; When RC = Invalid combination of parms;AN000; + MOV AX,INVALID_COMBINATION ; (AL = Message number to display) ;AN000; + .WHEN ; When RC = Invalid combination of parms;AN000; + MOV AX,DUPLICATE_PARM ; (AL = Message number to display) ;AN000; + .OTHERWISE ; ;AN000; + MOV AX,FORMAT_NOT_CORRECT ; RC = Anything else, tell the user ;AN000; + ; something is wrong with his ;AN000; + .ENDSELECT ; command line. ;AN000; + CALL DISP_ERROR ; Display the selected error message ;AN000; + STC ; Indicate parse error occurred ;AN000; +.ENDIF ;AN000; + ;AN000; + POP ES ;AN000; + POP DI ;AN000; + POP SI ;AN000; + POP DX ;AN000; + POP CX ;AN000; + POP BX ;AN000; + POP AX ;AN000; + RET ; Return to GRAPHICS_INSTALL ;AN000; + ;AN000; +PARSE_PARMS ENDP ;AN000; +CALL_SYSPARSE PROC NEAR ;COMMON INVOCATION OF SYSPARSE ;AN001; +;INPUT: - CX=ORDINAL VALUE ;AN001; +; DS:SI=WHERE COMMAND LINE IS, SAVED IN "SAVE_SI" ;AN001; +; ES:DI=WHERE PARMS DESCRIPTOR BLOCK IS ;AN001; +;OUTPUT: CX=NEW ORDINAL VALUE ;AN001; +; BX=OFFSET OF RESULT BLOCK, IF ONE IS RETURNED ;AN001; +; SI=OFFSET OF CHAR BEYOND PARSED PARM IN COMMAND LINE ;AN001; + ;AN001; + XOR DX,DX ;CLEAR DX FOR PARSER ;AN001; + MOV WORD PTR SAVE_SI,SI ;REMEMBER WHERE TO START LOOKING ;AN001; + CALL SYSPARSE ;GO PARSE THE NEXT PARM ;AN001; + ;AN001; + MOV BX,DX ; BX := Offset of result block ;AN001; + RET ;RETURN TO CALLER ;AN001; +CALL_SYSPARSE ENDP ;AN001; +PAGE ;AN000; +;===============================================================================;AN000; +; ;AN000; +; PROCEDURE_NAME: GET_PROFILE ;AN000; +; ;AN000; +; INPUT: ES:[BX] := Result block ;AN000; +; ;AN000; +; OUTPUT: PROFILE_PATH = The profile file name and path (ASCIIZ string) ;AN000; +; ;AN000; +;-------------------------------------------------------------------------------;AN000; +GET_PROFILE_NAME PROC ;AN000; + PUSH AX ;AN000; + PUSH BX ;AN000; + PUSH DX ;AN000; + PUSH SI ;AN000; + PUSH DI ;AN000; + ;AN000; +;-------------------------------------------------------------------------------;AN000; +; Get the name of the profile path found on the command line: ;AN000; +;-------------------------------------------------------------------------------;AN000; + MOV DI,ES:[BX+4] ; DI := Offset of filename found ;AN000; + XOR BX,BX ; BX := Byte index ;AN000; + MOV SI,OFFSET PROFILE_PATH ; [BX][SI] := Where to store it ;AN000; + ;AN000; +.IF < NE 0> ; Don't copy a NULL parm ;AN000; + .REPEAT ; While not end of path name (NULL terminated) ;AN000; + MOV AL,[BX][DI] ; Copy the byte (including the NULL) ;AN000; + MOV [BX][SI],AL ;AN000; + INC BX ; Get next one ;AN000; + .UNTIL < EQ 0> ; ;AN000; +.ENDIF ;AN000; + ;AN000; + POP DI ;AN000; + POP SI ;AN000; + POP DX ;AN000; + POP BX ;AN000; + POP AX ;AN000; + CLC ;AN000; + RET ;AN000; +GET_PROFILE_NAME ENDP ;AN000; + ;AN000; +PAGE ;AN000; +;===============================================================================;AN000; +; ;AN000; +; PROCEDURE_NAME: GET_TYPE ;AN000; +; ;AN000; +; INPUT: ES:[BX] := Result block ;AN000; +; PRINTER_TYPE_LENGTH := Maximum length for the printer type string ;AN000; +; ;AN000; +; OUTPUT: PRINTER_TYPE_PARM = ASCIIZ string containing ;AN000; +; the Printer type. ;AN000; +; AX = Error code ;AN000; +; ;AN000; +;-------------------------------------------------------------------------------;AN000; +GET_TYPE PROC ;AN000; + PUSH BX ;AN000; + PUSH CX ;AN000; + PUSH SI ;AN000; + PUSH DI ;AN000; + ;AN000; +;---------------------------------------------------------------------- ;AN000; +; Overwrite the DEFAULT TYPE with the type found on the command line ;AN000; +;---------------------------------------------------------------------- ;AN000; + MOV SI,ES:[BX+4] ; DS:SI := Offset of printer type found ;AN000; + .IF < NE 0> ; Do not copy an empty string ;AN000; + .THEN ; ;AN000; + MOV CL,PRINTER_TYPE_LENGTH ; CX := Maximum number of bytes ;AN000; + XOR CH,CH ; to copy ;AN000; + MOV DI,OFFSET PRINTER_TYPE_PARM; ES:DI := Where to store it ;AN000; + REP MOVSB ; Copy the string ;AN000; + ;---------------------------------------------------------------------- ;AN000; + ; Verify that the string supplied is not too long: ;AN000; + ;---------------------------------------------------------------------- ;AN000; + .IF < EQ 0> ; If the last byte is a null ;AN000; + .THEN ; then, the string was not longer ;AN000; + ; than the maximum ;AN000; + CLC ; Clear the carry flag = No error ;AN000; + .ELSE ; else, string provided is too long ;AN000; + MOV AX,RC_Not_In_Sw ; Error := RC for Invalid parm ;AN000; + STC ; Set error ;AN000; + .ENDIF ; ENDIF string too long ;AN000; + .ENDIF ; ENDIF string provided ;AN000; + ;AN000; +GET_TYPE_END: ;AN000; + POP DI ;AN000; + POP SI ;AN000; + POP CX ;AN000; + POP BX ;AN000; + RET ;AN000; +GET_TYPE ENDP ;AN000; + ;AN000; +PAGE ;AN000; +;===============================================================================;AN000; +; ;AN000; +; PROCEDURE_NAME: GET_REVERSE ;AN000; +; ;AN000; +; INPUT: ES:[BX] := Result block ;AN000; +; SWITCH_PARSED := The command line switches parsed so far (bit mask) ;AN000; +; ;AN000; +; OUTPUT: CS:[BP].SWITCHES (Bit mask in the Shared data area) is updated ;AN000; +; with the value of the switch found. ;AN000; +; GOT_R is set in SWITCH_PARSED ;AN000; +; AX := Error message number. ;AN000; +; CARRY FLAG IS SET IF ERROR FOUND ;AN000; +; ;AN000; +; ;AN000; +;-------------------------------------------------------------------------------;AN000; +GET_REVERSE PROC ;AN000; + ;AN000; + TEST SWITCH_PARSED,GOT_R ; If already parsed this switch ;AN000; + JNZ DUPLICATE_R ; then, error ;AN000; + OR SWITCH_PARSED,GOT_R ; else, say we parsed it. ;AN000; + ;AN000; +;-------------------------------------------------------------------------------;AN000; +; Set the Reverse switch in the Shared data area ;AN000; +;-------------------------------------------------------------------------------;AN000; + OR CS:[BP].SWITCHES,REVERSE_SW ; Set the command line switch ;AN000; + CLC ; Clear the error flag ;AN000; + JMP SHORT GET_REVERSE_END ; Return ;AN000; + ;AN000; +DUPLICATE_R: ; Already got this switch ;AN000; + MOV AX,RC_DUPLICATE_PARMS ; AX := error message number ;AN000; + STC ; SET ERROR ;AN000; +GET_REVERSE_END: ;AN000; + ;AN000; + RET ;AN000; +GET_REVERSE ENDP ;AN000; + ;AN000; +PAGE ;AN000; +;===============================================================================;AN000; +; ;AN000; +; PROCEDURE_NAME: GET_BACKGROUND ;AN000; +; ;AN000; +; INPUT: ES:[BX] := Result block ;AN000; +; SWITCH_PARSED := The command line switches parsed so far (bit mask) ;AN000; +; ;AN000; +; OUTPUT: CS:[BP].SWITCHES (Bit mask in the Shared data area) is updated ;AN000; +; with the value of the switch found. ;AN000; +; ;AN000; +; GOT_B is set in SWITCH_PARSED ;AN000; +; AX := Error message number. ;AN000; +; CARRY FLAG IS SET IF ERROR FOUND ;AN000; +; ;AN000; +;-------------------------------------------------------------------------------;AN000; +GET_BACKGROUND PROC ;AN000; + ;AN000; + TEST SWITCH_PARSED,GOT_B ; If already parsed this switch ;AN000; + JNZ DUPLICATE_B ; then, error ;AN000; + OR SWITCH_PARSED,GOT_B ; else, say we parsed it. ;AN000; +;-------------------------------------------------------------------------------;AN000; +; Set the switch in the Shared data area ;AN000; +;-------------------------------------------------------------------------------;AN000; + OR CS:[BP].SWITCHES,BACKGROUND_SW ; Set the command line switch ;AN000; + CLC ; Clear the error flag ;AN000; + JMP SHORT GET_BACKGROUND_END ; Return ;AN000; + ;AN000; +DUPLICATE_B: ; Already got this switch ;AN000; + MOV AX,RC_DUPLICATE_PARMS ; AX := error message number ;AN000; + STC ; SET ERROR ;AN000; + ;AN000; +GET_BACKGROUND_END: ;AN000; + RET ;AN000; +GET_BACKGROUND ENDP ;AN000; + ;AN000; +PAGE ;AN000; +;===============================================================================;AN000; +; ;AN000; +; PROCEDURE_NAME: GET_LCD ;AN000; +; ;AN000; +; INPUT: SWITCH_PARSED := The command line switches parsed so far (bit mask) ;AN000; +; ;AN000; +; OUTPUT: PRINTBOX_ID_PTR := Point to /LCD ASCIIZ string. ;AN000; +; GOT_B is set in SWITCH_PARSED ;AN000; +; AX := Error message number. ;AN000; +; CARRY FLAG IS SET IF ERROR FOUND ;AN000; +; ;AN000; +;-------------------------------------------------------------------------------;AN000; +; Data Referenced: ;AN000; +; ;AN000; +; LCD_BOX = An ASCIIZ string representing the LCD printbox id. ;AN000; +; ;AN000; +;-------------------------------------------------------------------------------;AN000; +GET_LCD PROC ;AN000; + ;AN000; + TEST SWITCH_PARSED,GOT_LCD ; If already parsed this switch ;AN000; + JNZ DUPLICATE_LCD ; then, error: Duplicate switch ;AN000; + TEST SWITCH_PARSED,GOT_PRINTBOX ; If printbox already mentioned ;AN000; + JNZ BAD_COMBINATION ; then, error: Invalid combination ;AN000; + ;AN000; +;-------------------------------------------------------------------------------;AN000; +; Set the pointer to the print box id to "LCD" ;AN000; +;-------------------------------------------------------------------------------;AN000; + MOV AX,OFFSET LCD_BOX ; PRINTBOX id := LCD ;AN000; + MOV PRINTBOX_ID_PTR,AX ; Save pointer to this printbox id. ;AN000; + OR SWITCH_PARSED,GOT_LCD ; Say we found this switch ;AN000; + CLC ; Clear the error flag ;AN000; + JMP SHORT GET_LCD_END ; Return ;AN000; + ;AN000; +;-------------------------------------------------------------------------------;AN000; +; /LCD was already parsed: ;AN000; +;-------------------------------------------------------------------------------;AN000; +DUPLICATE_LCD: ; Already got this switch ;AN000; + MOV AX,RC_DUPLICATE_PARMS ; AX := error message number ;AN000; + STC ; SET ERROR ;AN000; + JMP SHORT GET_LCD_END ; Return ;AN000; + ;AN000; +;-------------------------------------------------------------------------------;AN000; +; /PRINTBOX was already parsed: ;AN000; +;-------------------------------------------------------------------------------;AN000; +BAD_COMBINATION: ; /LCD and /PRINTBOX invalid at same ;AN000; + MOV AX,RC_INVLD_COMBINATION ; time, Set the error flag ;AN000; + STC ; AX := Error code ;AN000; + ;AN000; +GET_LCD_END: ;AN000; + RET ;AN000; +GET_LCD ENDP ;AN000; + ;AN000; +PAGE ;AN000; +;===============================================================================;AN000; +; ;AN000; +; PROCEDURE_NAME: GET_PRINTBOX ;AN000; +; ;AN000; +; INPUT: ES:[BX] := Result block ;AN000; +; SWITCH_PARSED := The command line switches parsed so far (bit mask) ;AN000; +; ;AN000; +; OUTPUT: DEFAULT_BOX := Is overwritten to contain the printbox id. found on ;AN000; +; the command line. ;AN000; +; GOT_PRINTBOX is set in SWITCH_PARSED ;AN000; +; AX := Error message number. ;AN000; +; CARRY FLAG IS SET IF ERROR FOUND ;AN000; +; ;AN000; +;-------------------------------------------------------------------------------;AN000; +GET_PRINTBOX_ID PROC ;AN000; + ;AN000; + PUSH CX ;AN000; + PUSH SI ;AN000; + PUSH DI ;AN000; + ;AN000; +;-------------------------------------------------------------------------------;AN000; +; Test for error in the printbox statement: ;AN000; +;-------------------------------------------------------------------------------;AN000; + TEST SWITCH_PARSED,GOT_LCD ; If /LCD already mentioned ;AN000; + JNZ BAD_COMBINATION2 ; then, error: Invalid combination ;AN000; + TEST SWITCH_PARSED,GOT_PRINTBOX ; If already parsed this switch ;AN000; + JNZ DUPLICATE_PRINTBOX ; then, error: Duplicate switch ;AN000; + ;AN000; + MOV DI,ES:[BX+4] ; DI := Offset of switch VALUE found;AN000; + ;AN000; + .IF < EQ 0> ; IF no printbox id ;AN000; + .THEN ; then, ;AN000; + ;----------------------------------------------------------------------;AN000; + ; No printbox id. was found: ;AN000; + ;----------------------------------------------------------------------;AN000; + MOV AX,FORMAT_NOT_CORRECT ; AX := Error code ;AN000; + STC ; Set the error flag ;AN000; + .ELSE ; else, ;AN000; + OR SWITCH_PARSED,GOT_PRINTBOX; Say we found this switch ;AN000; + ;----------------------------------------------------------------------;AN000; + ; Overwrite DEFAULT_BOX with the Printbox id. found ;AN000; + ;----------------------------------------------------------------------;AN000; + MOV CL,PRINTBOX_ID_LENGTH ; CX := Maximum number of bytes ;AN000; + XOR CH,CH ; to copy ;AN000; + MOV SI,DI ; [DS][SI] := Value found ;AN000; + MOV DI,OFFSET DEFAULT_BOX ; [ES][DI] := Default value ;AN000; + REP MOVSB ; Copy the string ;AN000; + ;----------------------------------------------------------------------;AN000; + ; Verify that the Printbox id. string is not too long: ;AN000; + ;----------------------------------------------------------------------;AN000; + .IF < EQ 0> ; If the last byte is a null ;AN000; + .THEN ; then, the string was not longer ;AN000; + ; than the maximum ;AN000; + CLC ; Clear the carry flag = No error ;AN000; + .ELSE ; else, string provided is too long ;AN000; + MOV AX,RC_Not_In_Sw ; Error := RC for Invalid parm ;AN000; + STC ; Set error ;AN000; + .ENDIF ; ENDIF printbox id. too long ;AN000; + .ENDIF ; ENDIF printbox id. provided ;AN000; + ;AN000; + JMP SHORT GET_PRINTBOX_END ; Return ;AN000; + ;AN000; +;-------------------------------------------------------------------------------;AN000; +; /PRINTBOX was already parsed: ;AN000; +;-------------------------------------------------------------------------------;AN000; +DUPLICATE_PRINTBOX: ; Already got this switch ;AN000; + MOV AX,RC_DUPLICATE_PARMS ; AX := error message number ;AN000; + STC ; SET ERROR ;AN000; + JMP SHORT GET_PRINTBOX_END ; Return ;AN000; + ;AN000; +;-------------------------------------------------------------------------------;AN000; +; /LCD was already parsed: ;AN000; +;-------------------------------------------------------------------------------;AN000; +BAD_COMBINATION2: ; /LCD and /PRINTBOX invalid at same;AN000; + MOV AX,RC_INVLD_COMBINATION ; time, Set the error flag ;AN000; + STC ; AX := Error code ;AN000; + ;AN000; +GET_PRINTBOX_END: ;AN000; + POP DI ;AN000; + POP SI ;AN000; + POP CX ;AN000; + RET ;AN000; +GET_PRINTBOX_ID ENDP ;AN000; + ;AN000; +CODE ENDS ;AN000; + END ;AN000; diff --git a/v4.0/src/CMD/GRAPHICS/GRPARMS.EXT b/v4.0/src/CMD/GRAPHICS/GRPARMS.EXT new file mode 100644 index 0000000..3587787 --- /dev/null +++ b/v4.0/src/CMD/GRAPHICS/GRPARMS.EXT @@ -0,0 +1,24 @@ +.XLIST ;AN000; +PAGE ,132 ;AN000; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;AN000; +;; DOS - GRAPHICS Command +;; (C) Copyright 1988 Microsoft +;; ;AN000; +;; File Name: GRPARMS.EXT ;AN000; +;; ---------- ;AN000; +;; ;AN000; +;; Description: ;AN000; +;; ------------ ;AN000; +;; External declarations for code and data defined in ;AN000; +;; GRPARMS.ASM ;AN000; +;; ;AN000; +;; Change History: ;AN000; +;; --------------- ;AN000; +;; ;AN000; +;; ;AN000; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;AN000; + ;; ;AN000; + EXTRN PARSE_PARMS:NEAR ;; ;AN000; + ;; ;AN000; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;AN000; +.LIST ;AN000; diff --git a/v4.0/src/CMD/GRAPHICS/GRPARSE.ASM b/v4.0/src/CMD/GRAPHICS/GRPARSE.ASM new file mode 100644 index 0000000..3d837bb --- /dev/null +++ b/v4.0/src/CMD/GRAPHICS/GRPARSE.ASM @@ -0,0 +1,87 @@ + PAGE ,132 ;AN000; + TITLE DOS GRAPHICS Command - Profile Load Modules #2 + ;AN000; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;AN000; +;; DOS - GRAPHICS Command +;; (C) Copyright 1988 Microsoft +;; ;AN000; +;; File Name: GRLOAD.ASM ;AN000; +;; ---------- ;AN000; +;; ;AN000; +;; Description: ;AN000; +;; ------------ ;AN000; +;; This file contains the modules used to load the ;AN000; +;; GRAPHICS profile into resident memory. ;AN000; +;; ;AN000; +;; ************* The EGA Dynamic Save Area will be built (by ;AN000; +;; ** NOTE ** CHAIN_INTERRUPTS in file GRINST.ASM) over top of these ;AN000; +;; ************* modules to avoid having to relocate this save just before ;AN000; +;; terminating. This is safe since the maximum memory used is ;AN000; +;; 288 bytes and the profile loading modules are MUCH larger than ;AN000; +;; this. So GRLOAD.ASM MUST be linked before GRINST.ASM and after ;AN000; +;; GRPRINT.ASM. ;AN000; +;; ;AN000; +;; ;AN000; +;; Documentation Reference: ;AN000; +;; ------------------------ ;AN000; +;; PLACID Functional Specifications ;AN000; +;; OASIS High Level Design ;AN000; +;; OASIS GRAPHICS I1 Overview ;AN000; +;; ;AN000; +;; Procedures Contained in This File: ;AN000; +;; ---------------------------------- ;AN000; +;; LOAD_PROFILE - Main module for profile loading ;AN000; +;; ;AN000; +;; Include Files Required: ;AN000; +;; ----------------------- ;AN000; +;; ?????????? - Externals for profile loading modules ;AN000; +;; ;AN000; +;; External Procedure References: ;AN000; +;; ------------------------------ ;AN000; +;; None ;AN000; +;; ;AN000; +;; Linkage Instructions: ;AN000; +;; --------------------- ;AN000; +;; Refer to GRAPHICS.ASM ;AN000; +;; ;AN000; +;; Change History: ;AN000; +;; --------------- ;AN000; +;; ;AN000; +;; ;AN000; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;AN000; + ;; ;AN000; + ;; ;AN000; +CODE SEGMENT PUBLIC 'CODE' ;; ;AN000; + ;; ;AN000; + INCLUDE STRUC.INC ;; ;AN000; + ;; ;AN000; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;AN000; +;; ;AN000; +;; Public Symbols ;AN000; +;; ;AN000; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;AN000; + ;; ;AN000; + ;; ;AN000; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;AN000; + ;; ;AN000; + ASSUME CS:CODE,DS:CODE ;; ;AN000; + ;; ;AN000; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;AN000; + ;; ;AN000; +;-------------------------------------------------------------------------------;AN000; +; Set assemble switches for parse code that is not required!! ;AN000; +;-------------------------------------------------------------------------------;AN000; +DateSW EQU 0 ;AN000; +TimeSW EQU 0 ;AN000; +CmpxSW EQU 0 ;AN000; +DrvSW EQU 0 ;AN000; +QusSW EQU 0 ;AN000; +KeySW EQU 0 ;AN000; +;Val1SW EQU 0 ;AN000; +;Val2SW EQU 0 ;AN000; + ;AN000; + PUBLIC SYSPARSE ;; ;AN000; + INCLUDE PARSE.ASM ;; parser code ;AN000; + ;; ;AN000; +CODE ENDS ;; ;AN000; + END ;AN000; diff --git a/v4.0/src/CMD/GRAPHICS/GRPARSE.EXT b/v4.0/src/CMD/GRAPHICS/GRPARSE.EXT new file mode 100644 index 0000000..416c664 --- /dev/null +++ b/v4.0/src/CMD/GRAPHICS/GRPARSE.EXT @@ -0,0 +1,24 @@ +.XLIST ;AN000; + ;AN000; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;AN000; +;; DOS - GRAPHICS Command +;; (C) Copyright 1988 Microsoft +;; ;AN000; +;; File Name: GRINST.EXT ;AN000; +;; ---------- ;AN000; +;; ;AN000; +;; Description: ;AN000; +;; ------------ ;AN000; +;; External declarations for code and data defined in ;AN000; +;; GRLOAD.ASM ;AN000; +;; ;AN000; +;; Change History: ;AN000; +;; --------------- ;AN000; +;; ;AN000; +;; ;AN000; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;AN000; + ;; ;AN000; + EXTRN SYSPARSE:NEAR ;; ;AN000; + ;; ;AN000; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;AN000; +.LIST ;AN000; diff --git a/v4.0/src/CMD/GRAPHICS/GRPATTRN.ASM b/v4.0/src/CMD/GRAPHICS/GRPATTRN.ASM new file mode 100644 index 0000000..06aed1b --- /dev/null +++ b/v4.0/src/CMD/GRAPHICS/GRPATTRN.ASM @@ -0,0 +1,217 @@ + PAGE ,132 ;AN000; + TITLE DOS - GRAPHICS Command - Common modules ;AN000; +.xlist ;AN000; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;AN000; +;; DOS - GRAPHICS Command +;; (c) Copyright 1988 Microsoft +;; ;AN000; +;; File Name: GRPATTRN.ASM ;AN000; +;; ---------- ;AN000; +;; ;AN000; +;; Description: ;AN000; +;; ------------ ;AN000; +;; This file contains the grey patterns used by PRT_BW_APA for printing ;AN000; +;; on a Black and White printer. ;AN000; +;; ;AN000; +;; Documentation Reference: ;AN000; +;; ------------------------ ;AN000; +;; OASIS High Level Design ;AN000; +;; OASIS GRAPHICS I1 Overview ;AN000; +;; ;AN000; +;; Procedures Contained in This File: ;AN000; +;; ---------------------------------- ;AN000; +;; none ;AN000; +;; ;AN000; +;; Include Files Required: ;AN000; +;; ----------------------- ;AN000; +;; GRPATTRN.STR - Structures for patterns. ;AN000; +;; ;AN000; +;; ;AN000; +;; External Procedure References: ;AN000; +;; ------------------------------ ;AN000; +;; ;AN000; +;; Called by PRT_BW_APA from file GRBWPRT.ASM ;AN000; +;; ;AN000; +;; Linkage Instructions: ;AN000; +;; -------------------- ;AN000; +;; ;AN000; +;; Change History: ;AN000; +;; --------------- ;AN000; +;; ;AN000; +;; ;AN000; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;AN000; +.list ;AN000; +CODE SEGMENT PUBLIC 'CODE' ;AN000; + ASSUME CS:CODE,DS:CODE ;AN000; +INCLUDE GRPATTRN.STR ;AN000; + ;AN000; +PUBLIC TAB_DIRECTORY ;AN000; +PUBLIC TAB_DIR_NB_ENTRIES ;AN000; +PUBLIC PAT_4X2 ;AN000; +PUBLIC PAT_4X4 ;AN000; +PUBLIC PAT_6X2 ;AN000; +PUBLIC PAT_8X2 ;AN000; +PUBLIC PAT_6X4 ;AN000; +PUBLIC PAT_8X4 ;AN000; +PUBLIC PAT_8X6 ;AN000; + ;AN000; +;-------------------------------------------------------------------------------;AN000; +; ;AN000; +; PATTERN DIRECTORY: ;AN000; +; ;AN000; +;-------------------------------------------------------------------------------;AN000; +TAB_DIR_NB_ENTRIES DB 7 ;AN000; +TAB_DIRECTORY LABEL BYTE ;AN000; +; ENTRY = ;AN000; + TAB_ENTRY ;AN000; + TAB_ENTRY ;AN000; + TAB_ENTRY ;AN000; + TAB_ENTRY ;AN000; + TAB_ENTRY ;AN000; + TAB_ENTRY ;AN000; + TAB_ENTRY ;AN000; +;-------------------------------------------------------------------------------;AN000; +; ;AN000; +; 4X2 GREY PATTERNS: ;AN000; +; ;AN000; +;-------------------------------------------------------------------------------;AN000; +PAT_4X2 LABEL BYTE ;AN000; +; PATTERN= ;AN000; + PAT_4X2_STR < 5,11B,11B,11B,11B> ;AN000; + PAT_4X2_STR <13,11B,10B,01B,11B> ;AN000; + PAT_4X2_STR <20,10B,11B,01B,10B> ;AN000; + PAT_4X2_STR <28,10B,01B,01B,10B> ;AN000; + PAT_4X2_STR <36,10B,00B,01B,10B> ;AN000; + PAT_4X2_STR <47,10B,00B,01B,00B> ;AN000; + PAT_4X2_STR <58,10B,00B,00B,00B> ;AN000; + PAT_4X2_STR <63,00B,00B,00B,00B> ;AN000; + ;AN000; +;-------------------------------------------------------------------------------;AN000; +; ;AN000; +; 4X4 GREY PATTERNS: ;AN000; +; ;AN000; +;-------------------------------------------------------------------------------;AN000; +PAT_4X4 LABEL BYTE ;AN000; +; PATTERN= ;AN000; + PAT_4X4_STR < 5,1111B,1111B,1111B,1111B> ;AN000; + PAT_4X4_STR <13,1111B,1010B,0101B,1111B> ;AN000; + PAT_4X4_STR <20,1010B,1111B,0101B,1010B> ;AN000; + PAT_4X4_STR <28,1010B,0101B,0101B,1010B> ;AN000; + PAT_4X4_STR <36,1010B,0000B,0101B,1010B> ;AN000; + PAT_4X4_STR <47,1010B,0000B,0101B,0000B> ;AN000; + PAT_4X4_STR <58,1010B,0000B,0000B,0000B> ;AN000; + PAT_4X4_STR <63,0000B,0000B,0000B,0000B> ;AN000; + ;AN000; +;-------------------------------------------------------------------------------;AN000; +; ;AN000; +; 6X2 GREY PATTERNS: ;AN000; +; ;AN000; +;-------------------------------------------------------------------------------;AN000; +PAT_6X2 LABEL BYTE ;AN000; + PAT_6X2_STR < 3,11B,11B,11B,11B,11B,11B> ;AN000; + PAT_6X2_STR < 8,11B,11B,10B,11B,11B,01B> ;AN000; + PAT_6X2_STR <15,10B,01B,10B,11B,10B,01B> ;AN000; + PAT_6X2_STR <21,01B,10B,10B,01B,10B,10B> ;AN000; + PAT_6X2_STR <28,01B,10B,10B,01B,10B,00B> ;AN000; + PAT_6X2_STR <36,10B,01B,00B,10B,01B,00B> ;AN000; + PAT_6X2_STR <45,00B,10B,00B,01B,00B,10B> ;AN000; + PAT_6X2_STR <53,10B,00B,00B,01B,00B,00B> ;AN000; + PAT_6X2_STR <60,10B,00B,00B,00B,00B,00B> ;AN000; + PAT_6X2_STR <63,00B,00B,00B,00B,00B,00B> ;AN000; + ;AN000; +;-------------------------------------------------------------------------------;AN000; +; ;AN000; +; 8X2 GREY PATTERNS: ;AN000; +; ;AN000; +;-------------------------------------------------------------------------------;AN000; +PAT_8X2 LABEL BYTE ;AN000; + PAT_8X2_STR < 3,11B,11B,11B,11B,11B,11B,11B,11B> ;AN000; + PAT_8X2_STR < 9,11B,11B,10B,11B,11B,10B,11B,01B> ;AN000; + PAT_8X2_STR <15,10B,11B,01B,11B,10B,11B,00B,11B> ;AN000; + PAT_8X2_STR <21,10B,01B,11B,10B,01B,10B,01B,10B> ;AN000; + PAT_8X2_STR <27,10B,01B,01B,10B,10B,01B,01B,10B> ;AN000; + PAT_8X2_STR <33,00B,10B,01B,10B,00B,01B,10B,01B> ;AN000; + PAT_8X2_STR <39,10B,00B,10B,01B,00B,10B,00B,01B> ;AN000; + PAT_8X2_STR <45,10B,00B,01B,00B,10B,00B,01B,00B> ;AN000; + PAT_8X2_STR <51,10B,00B,00B,01B,00B,00B,10B,00B> ;AN000; + PAT_8X2_STR <56,10B,00B,00B,00B,01B,00B,00B,00B> ;AN000; + PAT_8X2_STR <61,10B,00B,00B,00B,00B,00B,00B,00B> ;AN000; + PAT_8X2_STR <63,00B,00B,00B,00B,00B,00B,00B,00B> ;AN000; + ;AN000; +;-------------------------------------------------------------------------------;AN000; +; ;AN000; +; 6X4 GREY PATTERNS: ;AN000; +; ;AN000; +;-------------------------------------------------------------------------------;AN000; +PAT_6X4 LABEL BYTE ;AN000; + PAT_6X4_STR < 3,1111B,1111B,1111B,1111B,1111B,1111B> ;AN000; + PAT_6X4_STR < 8,1111B,1111B,1101B,1111B,1111B,1011B> ;AN000; + PAT_6X4_STR <13,1111B,1111B,0101B,1011B,1111B,1010B> ;AN000; + PAT_6X4_STR <16,0101B,1111B,0101B,1010B,0101B,1010B> ;AN000; + PAT_6X4_STR <20,0101B,1110B,0101B,1010B,0101B,1010B> ;AN000; + PAT_6X4_STR <24,1010B,0101B,1010B,0101B,0010B,0101B> ;AN000; + PAT_6X4_STR <28,1010B,0101B,1000B,0101B,0010B,0101B> ;AN000; + PAT_6X4_STR <32,1010B,0101B,1000B,1001B,0010B,0100B> ;AN000; + PAT_6X4_STR <37,1010B,0000B,1010B,0101B,0000B,0101B> ;AN000; + PAT_6X4_STR <40,0100B,0001B,1000B,0010B,1000B,0101B> ;AN000; + PAT_6X4_STR <45,0100B,0010B,1000B,0010B,0100B,0001B> ;AN000; + PAT_6X4_STR <49,1010B,0000B,1000B,0101B,0000B,0000B> ;AN000; + PAT_6X4_STR <52,1010B,0000B,0000B,0101B,0000B,0000B> ;AN000; + PAT_6X4_STR <55,0000B,1000B,0000B,0010B,0000B,0100B> ;AN000; + PAT_6X4_STR <58,1000B,0000B,0000B,0010B,0000B,0000B> ;AN000; + PAT_6X4_STR <61,1000B,0000B,0000B,0000B,0000B,0000B> ;AN000; + PAT_6X4_STR <63,0000B,0000B,0000B,0000B,0000B,0000B> ;AN000; + ;AN000; +;-------------------------------------------------------------------------------;AN000; +; ;AN000; +; 8X4 GREY PATTERNS: ;AN000; +; ;AN000; +;-------------------------------------------------------------------------------;AN000; +PAT_8X4 LABEL BYTE ;AN000; + PAT_8X4_STR < 1,1111B,1111B,1111B,1111B,1111B,1111B,1111B,1111B> ;AN000; + PAT_8X4_STR < 4,1010B,1111B,1111B,1111B,1010B,1111B,1111B,1111B> ;AN000; + PAT_8X4_STR < 7,1010B,1111B,1101B,1111B,1010B,1111B,0111B,1111B> ;AN000; + PAT_8X4_STR <10,1010B,0111B,1110B,0101B,1010B,1101B,1011B,0101B> ;AN000; + PAT_8X4_STR <13,1001B,1110B,0110B,1001B,0110B,1011B,1001B,0110B> ;AN000; + PAT_8X4_STR <18,1010B,0101B,1110B,0101B,1010B,0101B,1010B,0101B> ;AN000; + PAT_8X4_STR <24,1010B,0101B,0101B,1010B,1010B,0101B,0101B,1010B> ;AN000; + PAT_8X4_STR <30,1010B,0101B,1010B,0000B,0101B,1010B,0101B,0000B> ;AN000; + PAT_8X4_STR <36,1010B,0000B,1010B,0101B,0000B,1010B,0000B,0101B> ;AN000; + PAT_8X4_STR <42,1010B,0000B,0101B,0000B,1010B,0000B,0101B,0000B> ;AN000; + PAT_8X4_STR <46,0010B,1000B,0000B,0010B,1000B,0001B,0100B,0001B> ;AN000; + PAT_8X4_STR <48,1010B,0000B,0101B,0000B,0000B,1010B,0000B,0000B> ;AN000; + PAT_8X4_STR <50,0010B,0000B,1000B,0010B,0000B,0100B,0001B,0000B> ;AN000; + PAT_8X4_STR <53,1010B,0000B,0000B,0000B,0101B,0000B,0000B,0000B> ;AN000; + PAT_8X4_STR <56,0000B,1000B,0000B,0000B,0100B,0000B,0000B,0010B> ;AN000; + PAT_8X4_STR <59,1000B,0000B,0000B,0000B,0010B,0000B,0000B,0000B> ;AN000; + PAT_8X4_STR <62,1000B,0000B,0000B,0000B,0000B,0000B,0000B,0000B> ;AN000; + PAT_8X4_STR <63,0000B,0000B,0000B,0000B,0000B,0000B,0000B,0000B> ;AN000; + ;AN000; +;-------------------------------------------------------------------------------;AN000; +; ;AN000; +; 8X6 GREY PATTERNS: ;AN000; +; ;AN000; +;-------------------------------------------------------------------------------;AN000; +PAT_8X6 LABEL BYTE ;AN000; + PAT_8X6_STR < 1,111111B,111111B,111111B,111111B,111111B,111111B,111111B,111111B>;AN000; + PAT_8X6_STR < 4,011011B,111111B,111111B,111111B,110110B,111111B,111111B,111111B>;AN000; + PAT_8X6_STR < 7,101010B,011111B,111111B,110101B,101010B,011111B,111111B,110101B>;AN000; + PAT_8X6_STR <10,101010B,010101B,111111B,101010B,010101B,101010B,111111B,010101B>;AN000; + PAT_8X6_STR <13,011011B,100100B,111011B,100100B,011011B,100100B,011111B,100100B>;AN000; + PAT_8X6_STR <17,101010B,010101B,101010B,010101B,101010B,010101B,101010B,010101B>;AN000; + PAT_8X6_STR <21,101010B,010101B,101010B,010101B,001010B,010101B,101010B,010101B>;AN000; + PAT_8X6_STR <25,010100B,101010B,010101B,001010B,100100B,010001B,101110B,000001B>;AN000; + PAT_8X6_STR <29,000000B,010101B,101010B,010101B,000000B,101010B,010101B,101010B>;AN000; + PAT_8X6_STR <33,010010B,100101B,011000B,100010B,001101B,100000B,001010B,100100B>;AN000; + PAT_8X6_STR <37,100100B,001010B,010000B,001001B,100010B,001101B,010000B,001010B>;AN000; + PAT_8X6_STR <41,100000B,010010B,100100B,000010B,101000B,000101B,010000B,001010B>;AN000; + PAT_8X6_STR <45,100010B,001000B,000010B,100000B,010100B,000001B,100100B,000000B>;AN000; + PAT_8X6_STR <49,101000B,000001B,000100B,010000B,000010B,100000B,001000B,000101B>;AN000; + PAT_8X6_STR <53,101010B,000000B,000000B,000000B,010101B,000000B,000000B,000000B>;AN000; + PAT_8X6_STR <57,000000B,010000B,000000B,000100B,000000B,100000B,000000B,000010B>;AN000; + PAT_8X6_STR <60,100000B,000000B,000000B,000000B,000100B,000000B,000000B,000000B>;AN000; + PAT_8X6_STR <62,100000B,000000B,000000B,000000B,000000B,000000B,000000B,000000B>;AN000; + PAT_8X6_STR <63,000000B,000000B,000000B,000000B,000000B,000000B,000000B,000000B>;AN000; +CODE ENDS ;AN000; + END ;AN000; diff --git a/v4.0/src/CMD/GRAPHICS/GRPATTRN.EXT b/v4.0/src/CMD/GRAPHICS/GRPATTRN.EXT new file mode 100644 index 0000000..cfe1dad --- /dev/null +++ b/v4.0/src/CMD/GRAPHICS/GRPATTRN.EXT @@ -0,0 +1,31 @@ +PAGE ,132 ;AN000; +.XLIST ;AN000; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;AN000; +;; DOS - GRAPHICS Command +;; (C) Copyright 1988 Microsoft +;; ;AN000; +;; File Name: GRPATTRN.EXT ;AN000; +;; ---------- ;AN000; +;; ;AN000; +;; Description: ;AN000; +;; ------------ ;AN000; +;; Include file containing external declarations for ;AN000; +;; the data defined in GRPATTRN.ASM ;AN000; +;; ;AN000; +;; Change History: ;AN000; +;; --------------- ;AN000; +;; ;AN000; +;; ;AN000; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;AN000; + ;; ;AN000; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;AN000; +.LIST ;AN000; +EXTRN PAT_4X2:BYTE ;AN000; +EXTRN PAT_4X4:BYTE ;AN000; +EXTRN PAT_6X2:BYTE ;AN000; +EXTRN PAT_8X2:BYTE ;AN000; +EXTRN PAT_6X4:BYTE ;AN000; +EXTRN PAT_8X4:BYTE ;AN000; +EXTRN PAT_8X6:BYTE ;AN000; +EXTRN TAB_DIRECTORY:NEAR ;AN000; +EXTRN TAB_DIR_NB_ENTRIES:BYTE ;AN000; diff --git a/v4.0/src/CMD/GRAPHICS/GRPATTRN.STR b/v4.0/src/CMD/GRAPHICS/GRPATTRN.STR new file mode 100644 index 0000000..1e2947d --- /dev/null +++ b/v4.0/src/CMD/GRAPHICS/GRPATTRN.STR @@ -0,0 +1,125 @@ +.XLIST ;AN000; +PAGE ,132 ;AN000; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;AN000; +;; DOS - GRAPHICS Command +;; (C) Copyright 1988 Microsoft +;; ;AN000; +;; File Name: GRPATTRN.STR ;AN000; +;; ---------- ;AN000; +;; ;AN000; +;; Description: ;AN000; +;; ------------ ;AN000; +;; Include file containing structures for ;AN000; +;; the Printer grey patterns. ;AN000; +;; ;AN000; +;; Change History: ;AN000; +;; --------------- ;AN000; +;; ;AN000; +;; ;AN000; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;AN000; + ;; ;AN000; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;AN000; +.LIST ;AN000; + ;AN000; +TAB_ENTRY STRUC ; TABLE DIRECTORY ENTRY USED TO LOCATED ;AN000; + ; WHAT TABLE OF PATTERNS TO USE ;AN000; + TAB_OFFSET DW ? ; ADDRESS OF THE PATTERN TABLE ;AN000; + TAB_COPY DW ? ; ADDRESS OF PATTERN TABLE COPY IN SHARED DATA ;AN000; + TAB_SIZE DW ? ; SIZE OF THE PATTERN TABLE ;AN000; + BOX_W_PAT DB ? ; BOX WIDTH FOR PATTERNS IN THIS TABLE ;AN000; + BOX_H_PAT DB ? ; BOX HEIGHT FOR PATTERNS IN THIS TABLE ;AN000; + NB_INT DB ? ; NUMBER OF INTENSITIES IN THIS TABLE ;AN000; +TAB_ENTRY ENDS ;AN000; + ;AN000; +;-------------------------------------------------------------------------------;AN000; +; PATTERN TYPES: ;AN000; +; ;AN000; +; The maximum intensity field represents the upper bound for using ;AN000; +; a pattern (e.g., the acual intensity of a specific pattern may be ;AN000; +; 25 but, it will be used for printing intensities of up to 32). ;AN000; +; Intensities range from 0 = Black to 63 = White. ;AN000; +; ;AN000; +; For example, a 4x2 structure represents the following pattern: ;AN000; +; --- ;AN000; +; ;AN000; +; BYTES: C1_4X2 C2_4X2 C3_4X2 C4_4X2 ;AN000; +; ;AN000; +; Top dot to print ------> 0 0 0 0 ;AN000; +; ;AN000; +; Least significatnt bit ------> 0 0 0 0 ;AN000; +; of the byte is the dot ;AN000; +; printed below. ;AN000; +; ;AN000; +;-------------------------------------------------------------------------------;AN000; + ;AN000; +PAT_4X2_STR STRUC ; PATTERN MADE OF 2X1 BOXES ;AN000; + MAX_4X2 DB ? ; Maximum intensity ;AN000; + C1_4X2 DB 00B ; Column 1 (Leftmost column) ;AN000; + C2_4X2 DB 00B ; Column 2 ;AN000; + C3_4X2 DB 00B ; Column 3 ;AN000; + C4_4X2 DB 00B ; Column 4 (Rightmost column) ;AN000; +PAT_4X2_STR ENDS ;AN000; + ;AN000; +PAT_4X4_STR STRUC ; PATTERN MADE OF 2X2 BOXES ;AN000; + MAX_4X4 DB ? ; Maximum intensity ;AN000; + C1_4X4 DB 0000B ; Column 1 (Leftmost column) ;AN000; + C2_4X4 DB 0000B ; Column 2 ;AN000; + C3_4X4 DB 0000B ; Column 3 ;AN000; + C4_4X4 DB 0000B ; Column 4 (Rightmost column) ;AN000; +PAT_4X4_STR ENDS ;AN000; + ;AN000; +PAT_6X2_STR STRUC ; PATTERN MADE OF 3X1 BOXES ;AN000; + MAX_6X2 DB ? ; Maximum intensity ;AN000; + C1_6X2 DB 00B ; Column 1 (Leftmost column) ;AN000; + C2_6X2 DB 00B ; Column 2 ;AN000; + C3_6X2 DB 00B ; Column 3 ;AN000; + C4_6X2 DB 00B ; Column 4 ;AN000; + C5_6X2 DB 00B ; Column 5 ;AN000; + C6_6X2 DB 00B ; Column 6 (Rightmost column) ;AN000; +PAT_6X2_STR ENDS ;AN000; + ;AN000; +PAT_8X2_STR STRUC ; PATTERN MADE OF 4X1 BOXES ;AN000; + MAX_8X2 DB ? ; Maximum intensity ;AN000; + C1_8X2 DB 00B ; Column 1 (Leftmost column) ;AN000; + C2_8X2 DB 00B ; Column 2 ;AN000; + C3_8X2 DB 00B ; Column 3 ;AN000; + C4_8X2 DB 00B ; Column 4 ;AN000; + C5_8X2 DB 00B ; Column 5 ;AN000; + C6_8X2 DB 00B ; Column 6 ;AN000; + C7_8X2 DB 00B ; Column 7 ;AN000; + C8_8X2 DB 00B ; Column 8 (Rightmost column) ;AN000; +PAT_8X2_STR ENDS ;AN000; + ;AN000; +PAT_8X4_STR STRUC ; PATTERN MADE OF 4X2 BOXES ;AN000; + MAX_8X4 DB ? ; Maximum intensity ;AN000; + C1_8X4 DB 0000B ; Column 1 (Leftmost column) ;AN000; + C2_8X4 DB 0000B ; Column 2 ;AN000; + C3_8X4 DB 0000B ; Column 3 ;AN000; + C4_8X4 DB 0000B ; Column 4 ;AN000; + C5_8X4 DB 0000B ; Column 5 ;AN000; + C6_8X4 DB 0000B ; Column 6 ;AN000; + C7_8X4 DB 0000B ; Column 7 ;AN000; + C8_8X4 DB 0000B ; Column 8 (Rightmost column) ;AN000; +PAT_8X4_STR ENDS ;AN000; + ;AN000; +PAT_6X4_STR STRUC ; PATTERN MADE OF 3X2 BOXES ;AN000; + MAX_6X4 DB ? ; Maximum intensity ;AN000; + C1_6X4 DB 0000B ; Column 1 (Leftmost column) ;AN000; + C2_6X4 DB 0000B ; Column 2 ;AN000; + C3_6X4 DB 0000B ; Column 3 ;AN000; + C4_6X4 DB 0000B ; Column 4 ;AN000; + C5_6X4 DB 0000B ; Column 5 ;AN000; + C6_6X4 DB 0000B ; Column 6 (Rightmost column) ;AN000; +PAT_6X4_STR ENDS ;AN000; + ;AN000; +PAT_8X6_STR STRUC ; PATTERN MADE OF 4X3 BOXES ;AN000; + MAX_8X6 DB ? ; Maximum intensity ;AN000; + C1_8X6 DB 000000B ; Column 1 (Leftmost column) ;AN000; + C2_8X6 DB 000000B ; Column 2 ;AN000; + C3_8X6 DB 000000B ; Column 3 ;AN000; + C4_8X6 DB 000000B ; Column 4 ;AN000; + C5_8X6 DB 000000B ; Column 5 ;AN000; + C6_8X6 DB 000000B ; Column 6 ;AN000; + C7_8X6 DB 000000B ; Column 7 ;AN000; + C8_8X6 DB 000000B ; Column 8 (Rightmost column) ;AN000; +PAT_8X6_STR ENDS ;AN000; diff --git a/v4.0/src/CMD/GRAPHICS/GRPRINT.EXT b/v4.0/src/CMD/GRAPHICS/GRPRINT.EXT new file mode 100644 index 0000000..a4d0732 --- /dev/null +++ b/v4.0/src/CMD/GRAPHICS/GRPRINT.EXT @@ -0,0 +1,29 @@ +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;AN000; +;; DOS - GRAPHICS Command +;; (C) Copyright 1988 Microsoft +;; ;AN000; +;; File Name: GRPRINT.EXT ;AN000; +;; ---------- ;AN000; +;; ;AN000; +;; Description: ;AN000; +;; ------------ ;AN000; +;; External declarations for code and data defined in ;AN000; +;; GRPRINT.ASM ;AN000; +;; ;AN000; +;; Change History: ;AN000; +;; --------------- ;AN000; +;; ;AN000; +;; ;AN000; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;AN000; + ;; ;AN000; + EXTRN PRINT_MODULE_START:NEAR ;; ;AN000; + EXTRN LEN_OF_BW_MODULES:ABS ;; ;AN000; + EXTRN LEN_OF_COLOR_MODULES:ABS ;; ;AN000; + EXTRN COLOR_PRINT_MODULES:NEAR ;; ;AN000; + EXTRN BW_PRINT_MODULES:NEAR ;; ;AN000; + EXTRN PRINT_COLOR:NEAR ;; ;AN000; + EXTRN RGB2BAND:NEAR ;; ;AN000; + EXTRN PRINT_BW_APA:NEAR ;; ;AN000; + EXTRN RGB2INT:NEAR ;; ;AN000; + ;; ;AN000; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;AN000; diff --git a/v4.0/src/CMD/GRAPHICS/GRSHAR.STR b/v4.0/src/CMD/GRAPHICS/GRSHAR.STR new file mode 100644 index 0000000..5e62727 --- /dev/null +++ b/v4.0/src/CMD/GRAPHICS/GRSHAR.STR @@ -0,0 +1,127 @@ +.XLIST ;AN000; +PAGE ;AN000; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;AN000; +;; DOS - GRAPHICS Command +;; (C) Copyright IBM Corp 198?,... ;AN000; +;; ;AN000; +;; File Name: GRSHAR.STR ;AN000; +;; ---------- ;AN000; +;; ;AN000; +;; Description: ;AN000; +;; ------------ ;AN000; +;; Include file containing structures and equates for ;AN000; +;; Shared Data Area. ;AN000; +;; ;AN000; +;; This area is used for communication between the installation process ;AN000; +;; and the Print Screen process; it contains all the information ;AN000; +;; extracted from the printer profile. ;AN000; +;; ;AN000; +;; ;AN000; +;; Change History: ;AN000; +;; --------------- ;AN000; +;; ;AN000; +;; ;AN000; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;AN000; + ;; ;AN000; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;AN000; +.LIST ;AN000; + ; ;AN000; +SHARED_DATA_AREA_STR STRUC ; ;AN000; + SD_TOTAL_SIZE DW ? ; Total # bytes ALLOCATED to the ;AN000; + ; the Shared Data Area. ;AN000; + ;;;;;;;;;;;; Environment ;;;;;;;;;;;;;; ;AN000; + SWITCHES DB 0 ; Command line switches ;AN000; + HARDWARE_CONFIG DB ? ; Type of video hardware ;AN000; + PRINTER_TYPE DB ? ; Type of printer attached ;AN000; + ; ;AN000; + ;;;;;;;;;;;; Profile Data ;;;;;;;;;;;;; ;AN000; + DARKADJUST_VALUE DB 0 ; Darkness adjustment value ;AN000; + ; ;AN000; + NUM_PRT_COLOR DB ? ; Number of print colors ;AN000; + COLORPRINT_PTR DW ? ; Pointer to COLORPRINT info ;AN000; + ; ;AN000; + NUM_PRT_BANDS DB ? ; Number of selectable print bands ;AN000; + COLORSELECT_PTR DW ? ; Pointer to COLORSELECT info ;AN000; + ; bands ;AN000; + DISPLAYMODE_PTR DW ? ; Pointer to start of DISPLAYMODE ;AN000; + ; info ;AN000; +SHARED_DATA_AREA_STR ENDS ;; ;AN000; + ;AN000; + ;AN000; +;;;;;;;;; COLORSELECT info structure ;;;; ;AN000; + ; ;AN000; +COLORSELECT_STR STRUC ; ;AN000; + NUM_SELECT_ESC DB ? ; number of escape bytes to ;AN000; + ; select this band ;AN000; + SELECT_ESC DB ? ; Escape bytes to select band ;AN000; +COLORSELECT_STR ENDS ;; ;AN000; + ;AN000; + ;AN000; + ;AN000; +;;;;;;;;; COLORPRINT info structure ;;;;; ;AN000; + ; ;AN000; +COLORPRINT_STR STRUC ; ;AN000; + RED DB ? ; RGB value ;AN000; + GREEN DB ? ; ;AN000; + BLUE DB ? ; ;AN000; + ; Bit mask indicating color ;AN000; + SELECT_MASK DB ? ; bands required: ;AN000; + ; Bit 0: first band in table ;AN000; +COLORPRINT_STR ENDS ;; Bit 1: second band... ;AN000; + ;AN000; + ;AN000; +;;;;;;;;; DISPLAYMODE info structure ;;;; ;AN000; + ; A new block is built when a ;AN000; +DISPLAYMODE_STR STRUC ; DISPLAYMODE statement is ;AN000; + ; found ;AN000; + NEXT_DISP_MODE DW ? ; Pointer to info for next ;AN000; + ; display mode; -1 if last ;AN000; + NUM_DISP_MODE DB ? ; Number of display modes for ;AN000; + DISP_MODE_LIST_PTR DW ? ; this record - list of them ;AN000; + ; ;AN000; + BOX_WIDTH DB ? ; Print box size - horizontal ;AN000; + BOX_HEIGHT DB ? ; Print box size - vertical ;AN000; + ; ;AN000; + NUM_PATTERNS DB ? ; Number of grey patterns for ;AN000; + ; this box size ;AN000; + PATTERN_TAB_PTR DW ? ; pointer to grey pattern table ;AN000; + ; for this display mode ;AN000; + NUM_GRAPHICS_ESC DB ? ; # of escape byte for GRAPHICS ;AN000; + GRAPHICS_ESC_PTR DW ? ; pointer to GRAPHICS escape ;AN000; + LOW_BYT_COUNT_PTR DW ? ; pointers to number of bytes sent ;AN000; + HGH_BYT_COUNT_PTR DW ? ; to the printer (1 word holds this ;AN000; + ; number but, must be send 1 byte ;AN000; + ; at a time). ;AN000; + NUM_SETUP_ESC DB ? ; # of escape byte for SETUP ;AN000; + SETUP_ESC_PTR DW ? ; pointer to SETUP escape seq ;AN000; + ; for this display mode ;AN000; + NUM_RESTORE_ESC DB ? ; # of escape byte for RESTORE ;AN000; + RESTORE_ESC_PTR DW ? ; pointer to RESTORE escape ;AN000; + ; seq for this display mode ;AN000; + PRINT_OPTIONS DB ? ; ;AN000; + ; ;AN000; +DISPLAYMODE_STR ENDS ;; ;AN000; + ;AN000; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;AN000; +;; ;AN000; +;; SHARED DATA AREA - EQUATES ;AN000; +;; ;AN000; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;AN000; + ;AN000; +; SWITCHES DB ; Command line switches: ;AN000; + REVERSE_SW EQU 1 ; /R ;AN000; + BACKGROUND_SW EQU 2 ; /B ;AN000; + ; ;AN000; +; HARDWARE_CONFIG DB ; Type of video hardware ;AN000; + PALACE EQU 1 ; attached ;AN000; + ROUNDUP EQU 2 ; PS 2 MODEL 50 60 AND 80 ;AN000; + EGA EQU 4 ; Enhance Graphics Adapter ;AN000; + PC_CONVERTIBLE EQU 8 ; PC Convertible LCD ;AN000; + OLD_ADAPTER EQU 16 ; Color Graph. Adater or MONO ;AN000; + ; ;AN000; +; PRINTER_TYPE DB ; Type of printer attached ;AN000; + COLOR EQU 1 ; ;AN000; + BLACK_WHITE EQU 2 ; ;AN000; + ; ;AN000; +; PRINT_OPTIONS DB ; ;AN000; + ROTATE EQU 1 ; ;AN000; diff --git a/v4.0/src/CMD/GRAPHICS/MAKEFILE b/v4.0/src/CMD/GRAPHICS/MAKEFILE new file mode 100644 index 0000000..af52400 --- /dev/null +++ b/v4.0/src/CMD/GRAPHICS/MAKEFILE @@ -0,0 +1,64 @@ +#************************** makefile for cmd\... *************************** + +msg =..\..\messages +dos =..\..\dos +inc =..\..\inc +hinc =..\..\h + +# +####################### dependencies begin here. ######################### +# + +all: graphics.com + + +graphics.ctl: graphics.skl $(msg)\$(COUNTRY).msg + +graphics.obj: graphics.asm grinst.ext makefile + +grinst.obj: grinst.asm grload.ext grload2.ext grctrl.ext grprint.ext \ + grcpsd.ext grparms.ext grparse.ext grbwprt.ext grcolprt.ext \ + grint2fh.ext grmsg.equ graphics.ctl graphics.cla graphics.cl1 \ + graphics.clb \ + graphics.cl2 graphics.clc \ + $(inc)\sysmsg.inc $(inc)\struc.inc grshar.str makefile + +grcpsd.obj: grparse.asm makefile $(inc)\parse.asm + +grparse.obj: grcpsd.asm makefile + +grpattrn.obj: grpattrn.asm grpattrn.str makefile + +grbwprt.obj: grbwprt.asm grcommon.ext grctrl.str grshar.str makefile \ + grpattrn.str $(inc)\struc.inc makefile + +grint2fh.obj: grint2fh.asm grload.ext grctrl.ext grprint.ext \ + grcpsd.ext makefile + +grctrl.obj: grctrl.asm grint2fh.ext grbwprt.ext grcolprt.ext grshar.str \ + grpattrn.str grpattrn.ext grctrl.str $(inc)\struc.inc \ + makefile + +grcolprt.obj: grctrl.str grshar.str grpattrn.str grctrl.ext \ + $(inc)\struc.inc grcommon.asm makefile + +grload.obj: grload.asm $(inc)\struc.inc grinst.ext grshar.str grparse.ext \ + grload2.ext grload3.ext grmsg.equ makefile + +grload2.obj: grload2.asm $(inc)\struc.inc grinst.ext grshar.str grmsg.equ \ + grinst.ext grload.ext grparse.ext grpattrn.str grpattrn.ext \ + makefile + +grload3.obj: grload3.asm $(inc)\struc.inc grinst.ext grshar.str grmsg.equ \ + grinst.ext grload.ext grload2.ext grparse.ext grpattrn.str \ + grpattrn.ext makefile + +grparms.obj: grparms.asm grmsg.equ grshar.str grinst.ext grparse.ext \ + $(inc)\struc.inc makefile + +graphics.com: graphics.obj grint2fh.obj grpattrn.obj grctrl.obj grcpsd.obj \ + grcolprt.obj grbwprt.obj grinst.obj grparse.obj grparms.obj \ + grload.obj grload2.obj grload3.obj graphics.lnk + link @graphics.lnk + exe2bin graphics.exe graphics.com + del graphics.exe -- cgit v1.2.3