🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: alt.msdos.programmer
Article #545

Switching between screen modes

#545
From: Kevin D. Quitt
Date: Tue, 14 Aug 1990 05:24
100 lines
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, &regs, &regs );

    regs.x.ax   = 0x1111;
    regs.x.bx   = 0x0000;
    int86( 0x10, &regs, &regs );        /* Select 8x14 font                 */

    regs.x.ax   = 0x1200;
    regs.x.bx   = 0x0020;               /* Select alt print screen routine  */
    int86( 0x10, &regs, &regs );

    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, &regs, &regs );

    regs.x.ax   = 0x1112;
    regs.x.bx   = 0x0000;
    int86( 0x10, &regs, &regs );        /* Select 8x8 font                  */

    regs.x.ax   = 0x1200;
    regs.x.bx   = 0x0020;               /* Select alt print screen routine  */
    int86( 0x10, &regs, &regs );

    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.
Technical Details
Message-ID: <492@demott.COM>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!mailrus!cs.utexas.edu!usc!srhqla!demott!kdq

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!mailrus!cs.utexas.edu!usc!srhqla!demott!kdq
From: kdq@demott.COM (Kevin D. Quitt)
Newsgroups: alt.msdos.programmer,comp.os.msdos.programmer,comp.sys.ibm.pc.misc
Subject: Switching between screen modes
Message-ID: <492@demott.COM>
Date: 14 Aug 90 05:24:40 GMT
Reply-To: kdq@demott.COM (Kevin D. Quitt)
Followup-To: alt.msdos.programmer
Organization: DeMott Electronics Co., Van Nuys CA
Lines: 100