kdq@demott.COM (Kevin D. Quitt) (08/14/90)
I am using MSC 6.0, and need to reliably switch between several screen
modes: 80x25 text, 80x43 text, 40x25 text, and (640x350) graphics mode.
Getting to 43 line mode is no problem, but getting back out of it is - MSC's
library dos not accomplish this properly.
Does someone have working code that can reliably switch (for example)
from 80x43 text to 40x25 mode?
--
_
Kevin D. Quitt demott!kdq kdq@demott.com
DeMott Electronics Co. 14707 Keswick St. Van Nuys, CA 91405-1266
VOICE (818) 988-4975 FAX (818) 997-1190 MODEM (818) 997-4496 PEP last
96.37% of all statistics are made up.kdq@demott.COM (Kevin D. Quitt) (08/14/90)
Well, I've finally got switching between 80 and 40 columns, and 25 and
43 lines (especially from 43 to 25). All the code I've seen is really
kludgy, (like having to read the cursor before switching to 43 line mode).
The following code is rock-solid, switching from/to graphics or any
weird mode, and between any modes. The best way to switch to a mode from
an unknown state it to set "screen_cols" to the number you want, then call
set_xx_lines. This minimizes the amount of screen flashing.
Now, can anybody tell me how to detect vertical retrace? I'd like to
make this really crisp.
Thanks to you all who responded - note that MicroEmacs 3.10's code
should be fixed, since it doesn't do this correctly.
/* Set 25 line mode. Rock solid stuff
*/
void set_25_lines (void)
{
union REGS regs;
clear_screen();
if ( screen_cols == 80 )
regs.x.ax = 0x0003; /* Set 80x25 color text */
else
regs.x.ax = 0x0001; /* Set 40x25 color text */
int86( 0x10, ®s, ®s );
regs.x.ax = 0x1111;
regs.x.bx = 0x0000;
int86( 0x10, ®s, ®s ); /* Select 8x14 font */
regs.x.ax = 0x1200;
regs.x.bx = 0x0020; /* Select alt print screen routine */
int86( 0x10, ®s, ®s );
screen_rows = 25;
graphics_set = FALSE;
}
/* Set 43 line mode.
*/
void set_43_lines (void)
{
union REGS regs;
clear_screen();
if ( screen_cols == 80 )
regs.x.ax = 0x0003; /* Set 80x25 color text */
else
regs.x.ax = 0x0001; /* Set 40x25 color text */
int86( 0x10, ®s, ®s );
regs.x.ax = 0x1112;
regs.x.bx = 0x0000;
int86( 0x10, ®s, ®s ); /* Select 8x8 font */
regs.x.ax = 0x1200;
regs.x.bx = 0x0020; /* Select alt print screen routine */
int86( 0x10, ®s, ®s );
screen_rows = 43;
graphics_set = FALSE;
}
void set_40_columns (void)
{
screen_cols = 40;
if ( screen_rows == 43 )
set_43_lines();
else
set_25_lines();
}
void set_80_columns (void)
{
screen_cols = 80;
if ( screen_rows == 43 )
set_43_lines();
else
set_25_lines();
}
--
_
Kevin D. Quitt demott!kdq kdq@demott.com
DeMott Electronics Co. 14707 Keswick St. Van Nuys, CA 91405-1266
VOICE (818) 988-4975 FAX (818) 997-1190 MODEM (818) 997-4496 PEP last
96.37% of all statistics are made up.