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.
fisher@sc2a.unige.ch (Markus Fischer) (08/14/90)
In article <482@demott.COM>, kdq@demott.COM (Kevin D. Quitt) writes: > 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. I'm no assembler wizard, but if you are, you could take a look at nnansi.zoo (at SIMTEL20, for example). If nnansi.sys (as a replacement of ansi.sys) works in your configuration, then you could implement the routines in an *.asm external, or maybe even translate them to c ? (By the way, you can, of course, use nnansi as-is (i.e. load the driver), and use the provided escapes sequences, but I guess you need something more portable...) The package includes source files, and is copyrighted: (C) 1986 Daniel Kegel, Pasadena, CA [later] Modified Tom Almy but it can be distributed for educational use. I guess we're allowed to learn something from it! I hope somebody posts a more direct solution... Markus Fischer -|--|--|--|--|--|--I Department of Anthropology -|--|--|--|--|--|--|-(#)-I University of Geneva -|--|--|--|--|--|--|--|--|-(#)-|-(#)(#)(_)-I CH-1227 Carouge (GE) -&-(_)-|--|--|-(#)-&--|-(#)(#)(_)(#)-&-(_)(#)-I Switzerland -|--|--|--|--|-(#)(_)-|-(_)(_)(_)(#)-I black (#) to kill ! --|--|-(#)(_)(_)(_)(#)(#)(_)(_) fisher@sc2a.unige.ch =+==+==+==+==+==+==+==+==+==+==+==+==+==+==+=(#)=+ fisher@cgeuge52.bitnet