]> wirehaze git hosting - MS-DOS.git/blob - v4.0/src/CMD/FDISK/VIDEO.C

wirehaze git hosting

MZ is back!
[MS-DOS.git] / v4.0 / src / CMD / FDISK / VIDEO.C
1
2 #include "dos.h" /* AN000 */
3 #include "fdisk.h" /* AN000 */
4 #include "extern.h" /* AN000 */
5 #include "doscall.h" /* AN000 */
6 #include "fdiskmsg.h" /* AN000 */
7 #include "subtype.h"
8
9 /* \f */
10
11 void clear_screen(TopRow,LeftCol,BotRow,RightCol)
12
13 unsigned TopRow;
14 unsigned LeftCol;
15 unsigned BotRow;
16 unsigned RightCol;
17
18 BEGIN
19
20 char attribute;
21 char *attribute_ptr = &attribute;
22
23 if (mono_flag == TRUE) /* AN006 */
24 attribute = GRAY_ON_BLACK; /* AN006 */
25 else /* AN006 */
26 attribute = WHITE_ON_BLUE; /* AC000 */
27 VIOSCROLLUP(TopRow,LeftCol,BotRow,RightCol,u(0),attribute_ptr,u(0)); /* AC000 */
28 return;
29 END
30
31
32
33
34
35 /* \f */
36 /* */
37 /****************************************************************************/
38 /* Initializes the screen and stores the lower right hand corner */
39 /* of the screen in the global variable LowerRightHandCorner. This */
40 /* is which is used for screen clears. If the screen is in grahpics mode, */
41 /* it is changed to BW 40x25. This procedure is only called once at program*/
42 /* start. Also saves the current screen */
43 /****************************************************************************/
44 /* */
45
46
47 void init_video_information()
48
49 BEGIN
50 mono_flag = FALSE; /* AN006 */
51
52 /* Get the current video state */
53 regs.h.ah = uc(CURRENT_VIDEO_STATE); /* AC000 */
54 int86((int)VIDEO,&regs,&regs); /* AC000 */
55
56 /* Save the mode and display page */
57 video_mode = regs.h.al;
58 display_page = regs.h.bh;
59
60 get_video_attribute(); /* AN006 */
61
62 BEGIN
63 /* assume color mode */
64 regs.h.al = uc(Color80_25); /* AC000 */
65
66 /* See if we are in MONOCHROME mode */
67 if ((video_mode == uc(MONO80_25)) || (video_mode == uc(MONO80_25A))) /* AC000 AC006 */
68 BEGIN
69
70 /* Nope,set to BW80x25*/
71 regs.h.al = uc(BW80_25); /* AC000 */
72 mono_flag = TRUE; /* AN006 */
73 END
74
75 /* go set the new mode */
76 regs.h.ah = uc(SET_MODE); /* AC000 */
77 int86((int)VIDEO,&regs,&regs); /* AC000 */
78 END
79
80 /* Set the display page */
81 regs.h.ah = uc(SET_ACTIVE_DISPLAY_PAGE); /* AC000 */
82 regs.h.al = uc(0); /* AC000 */
83 int86((int)VIDEO,&regs,&regs); /* AC000 */
84
85 return;
86 END
87
88 /* \f */
89 /* */
90 /* Resets the video mode to the original value */
91 /* */
92
93 void reset_video_information()
94
95 BEGIN
96
97 char *attribute_ptr = &video_attribute; /* AN006 */
98
99 /* Clear display with colors that were present when FDISK was invoked */
100 VIOSCROLLUP(u(0),u(0),u(24),u(79),u(0),attribute_ptr,u(0)); /* AN006 */
101
102 /* Reset the video mode */
103 regs.h.ah = SET_MODE;
104 regs.h.al = video_mode;
105 int86((int)VIDEO,&regs,&regs); /* AC000 */
106
107 /* Set the page */
108 regs.h.ah = SET_PAGE;
109 regs.h.al = display_page;
110 int86((int)VIDEO,&regs,&regs); /* AC000 */
111 return;
112
113 END
114
115 /******************************************************************************/
116 /*Routine name: GET_VIDEO_ATTRIBUTE */
117 /******************************************************************************/
118 /* */
119 /*Description: This routine will invoke interrupt 10 function 08h to */
120 /* get the current attributes at the cursor postition in order */
121 /* to restore the correct colors when returning out of FDISK. */
122 /* */
123 /*Called Procedures: none */
124 /* */
125 /* */
126 /*Change History: Created 3/11/88 DRM */
127 /* */
128 /*Input: None */
129 /* */
130 /*Output: None */
131 /* */
132 /******************************************************************************/
133
134 void get_video_attribute() /* AN006 */
135
136 BEGIN /* AN006 */
137
138 /* Get current attributes */
139 regs.h.ah = CURRENT_VIDEO_ATTRIBUTE; /* AN006 */
140 regs.h.bh = display_page; /* AN006 */
141 int86((int)VIDEO,&regs,&regs); /* AN006 */
142 video_attribute = regs.h.ah; /* AN006 */
143 return; /* AN006 */
144
145 END /* AN006 */
146