Thread View: alt.msdos.programmer
1 messages
1 total messages
Started by Kevin D. Quitt
Tue, 14 Aug 1990 05:24
Switching between screen modes
Author: Kevin D. Quitt
Date: Tue, 14 Aug 1990 05:24
Date: Tue, 14 Aug 1990 05:24
100 lines
3192 bytes
3192 bytes
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.
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads