1 ;********************************************************************************
4 ; This module contains a subroutine for setting the mode of the display to
7 ; If ANSI.SYS is loaded, then the calls to change the mode go through it,
8 ; otherwise standard BIOS calls are performed.
10 ; If ANSI.SYS is to be used, then a version dated July 15, 1987 or later must
13 ;********************************************************************************
16 INCLUDE STRUC.INC ;AN000;
19 DATA SEGMENT BYTE PUBLIC 'DATA' ;AN000;
22 ; Buffer for IOCTL calls
23 BUFFER
LABEL BYTE ;AN000;
24 DB 0 ;AN000; INFO LEVEL
28 D_MODE
DB 0 ;AN000; 1 = TEXT, 2 = APA
31 B_WIDTH
DW 0 ;AN000; PELS ==> -1 FOR TEXT
32 B_LENGTH
DW 0 ;AN000; PELS ==> -1 FOR TEXT
38 CODE_FAR
SEGMENT BYTE PUBLIC 'CODE' ;AN000;
40 ASSUME
CS:CODE_FAR
, DS:DATA ;AN000;
42 ;********************************************************************************
43 ; SET_DISPLAY_MODE_ROUTINE: Set the display mode to 80X25 text mode.
49 ; If CY = 1, then an error was encountered making a IOCTL call.
50 ; If CY = 0, there were no errors.
52 ; Operation: If ANSY.SYS is loaded, then the mode is set by calls to it,
53 ; otherwise BIOS calls are used.
55 ;********************************************************************************
56 PUBLIC SET_DISPLAY_MODE_ROUTINE
;AN000;
57 SET_DISPLAY_MODE_ROUTINE PROC
FAR ;AN000;
59 ;**********************************************************************
60 ; See if ANSI.SYS is loaded
61 ;**********************************************************************
62 MOV AX, 1A00H
;AC086;SEH changed from 1600h to avoid MICROSOFT collision ;AN000; Fn. for determining ANSI.SYS state
63 INT 2FH
;AN000; Returns AL = 0FFh if it is loaded
64 .IF < AL NE
0FFH > ;AN000; Is it loaded?
65 MOV AH, 15 ;AN000; No! Fn. number for getting the current video state
66 INT 10H
;AN000; Get the video state
67 .IF < AL EQ 07H > OR ;AN000; If in monochrome mode,
68 .IF < AL EQ 0FH> ;AN000; or monochrome graphics mode,
69 MOV AX, 07H ;AN000; Set monochrome mode
70 .ELSE ;AN000; Otherwise...
71 MOV AX, 03H ;AN000; Set mode 3: 80 column, color enabled
73 INT 10H
;AN000; Set the mode
75 MOV AX, 440
CH ;AN000; Get the info from ANSI.
78 MOV DX, OFFSET BUFFER
;AN000;
80 .IF < C
> ;AN000; Was there an error?
81 JMP ERROR_SETTING
;AN000; Yes! Exit the subroutine.
83 MOV D_MODE
, 1 ;AN000; Set to text mode
84 MOV B_WIDTH
, -1 ;AN000; -1 for text mode
85 MOV B_LENGTH
, -1 ;AN000; -1 for text mode
86 MOV COLS
, 80 ;AN000; Number of columns
87 MOV ROWS
, 25 ;AN000; Number of rows
88 .IF < COLORS NE
0 > ;AN000; If colors = 0, monochrome
89 MOV COLORS
, 16 ;AN000; Otherwise set 16 color mode
91 MOV AX, 440
CH ;AN000; Set the new mode
94 MOV DX, OFFSET BUFFER
;AN000;
96 .IF < C
> ;AN000; Was there en error?
97 JMP ERROR_SETTING
;AN000; Yes! Exit the subroutine
99 CLC ;AN000; Indicate there were no errors
102 ERROR_SETTING: ;AN000;
103 STC ;AN000; Indicate that there were errors
107 SET_DISPLAY_MODE_ROUTINE ENDP
;AN000;
110 CODE_FAR ENDS
;AN000;