]> wirehaze git hosting - MS-DOS.git/blob - v4.0/src/SELECT/S_DISPLY.ASM

wirehaze git hosting

MZ is back!
[MS-DOS.git] / v4.0 / src / SELECT / S_DISPLY.ASM
1 ;********************************************************************************
2 ; File: S_DISPLY.ASM
3 ;
4 ; This module contains a subroutine for setting the mode of the display to
5 ; 80X25 text mode.
6 ;
7 ; If ANSI.SYS is loaded, then the calls to change the mode go through it,
8 ; otherwise standard BIOS calls are performed.
9 ;
10 ; If ANSI.SYS is to be used, then a version dated July 15, 1987 or later must
11 ; be used.
12 ;
13 ;********************************************************************************
14 .ALPHA ;AN000;
15 .XLIST ;AN000;
16 INCLUDE STRUC.INC ;AN000;
17 .LIST ;AN000;
18
19 DATA SEGMENT BYTE PUBLIC 'DATA' ;AN000;
20
21
22 ; Buffer for IOCTL calls
23 BUFFER LABEL BYTE ;AN000;
24 DB 0 ;AN000; INFO LEVEL
25 DB 0 ;AN000; RESERVED
26 DW 14 ;AN000; SIZE
27 FLAGS DW 0 ;AN000;
28 D_MODE DB 0 ;AN000; 1 = TEXT, 2 = APA
29 DB 0 ;AN000; RESERVED
30 COLORS DW 0 ;AN000;
31 B_WIDTH DW 0 ;AN000; PELS ==> -1 FOR TEXT
32 B_LENGTH DW 0 ;AN000; PELS ==> -1 FOR TEXT
33 COLS DW 0 ;AN000;
34 ROWS DW 0 ;AN000;
35
36 DATA ENDS ;AN000;
37
38 CODE_FAR SEGMENT BYTE PUBLIC 'CODE' ;AN000;
39
40 ASSUME CS:CODE_FAR, DS:DATA ;AN000;
41
42 ;********************************************************************************
43 ; SET_DISPLAY_MODE_ROUTINE: Set the display mode to 80X25 text mode.
44 ;
45 ; INPUT:
46 ; None.
47 ;
48 ; OUTPUT:
49 ; If CY = 1, then an error was encountered making a IOCTL call.
50 ; If CY = 0, there were no errors.
51 ;
52 ; Operation: If ANSY.SYS is loaded, then the mode is set by calls to it,
53 ; otherwise BIOS calls are used.
54 ;
55 ;********************************************************************************
56 PUBLIC SET_DISPLAY_MODE_ROUTINE ;AN000;
57 SET_DISPLAY_MODE_ROUTINE PROC FAR ;AN000;
58
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
72 .ENDIF ;AN000;
73 INT 10H ;AN000; Set the mode
74 .ELSE ;AN000;
75 MOV AX, 440CH ;AN000; Get the info from ANSI.
76 MOV BX, 0 ;AN000;
77 MOV CX, 037FH ;AN000;
78 MOV DX, OFFSET BUFFER ;AN000;
79 INT 21H ;AN000;
80 .IF < C > ;AN000; Was there an error?
81 JMP ERROR_SETTING ;AN000; Yes! Exit the subroutine.
82 .ENDIF ;AN000;
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
90 .ENDIF ;AN000;
91 MOV AX, 440CH ;AN000; Set the new mode
92 MOV BX, 0 ;AN000;
93 MOV CX, 035FH ;AN000;
94 MOV DX, OFFSET BUFFER ;AN000;
95 INT 21H ;AN000;
96 .IF < C > ;AN000; Was there en error?
97 JMP ERROR_SETTING ;AN000; Yes! Exit the subroutine
98 .ENDIF ;AN000;
99 CLC ;AN000; Indicate there were no errors
100 .ENDIF ;AN000;
101 JMP EXIT_SET ;AN000;
102 ERROR_SETTING: ;AN000;
103 STC ;AN000; Indicate that there were errors
104 EXIT_SET: ;AN000;
105 RET ;AN000;
106
107 SET_DISPLAY_MODE_ROUTINE ENDP ;AN000;
108
109
110 CODE_FAR ENDS ;AN000;
111
112 END ;AN000;