[net.sources] ega programs

davidsen@steinmetz.UUCP (Davidsen) (08/11/86)

Following is the shar file for switching an EGA board in EGA mode to CGA
mode (and back). It has been tried on IBM and QUAD EGA boards, and seems to
work correctly. It will allow running of programs which will not run when
the CGA mode is selected from switches (S1?).

Included is code to switch into 43 line mode. Now if someone finds this
useful and got all the parts of the 43 line version of emacs, they could
mail it to me as a thank you.

The first file is the (ha) documentation I got with these files.

	-bill davidsen

  ihnp4!seismo!rochester!steinmetz!--\
                                       \
                    unirot ------------->---> crdos1!davidsen
                          chinet ------/
         sixhub ---------------------/        (davidsen@ge-crd.ARPA)

"Stupidity, like virtue, is its own reward"

#!/bin/sh
# created from directory /usr2/public/PCsoftware
echo shar created 13:15 on Mon Aug 11, 1986 by davidsen
echo 'x - Xga.doc (text)'
sed << 'E!O!F' 's/^X//' > Xga.doc
XFrom del Fri Mar 28 18:14:26 1986
XTo: davidsen
XSubject: cga.exe and ega.exe
XDate: Fri Mar 28 18:14:25 1986
X
X
XI'd be curious to hear your report on how well (or not well) these two
Xprograms run on some boards other than the "real" EGA.  They seem to run
Xflawlessly on it; as a matter of fact, some software which will NOT run
Xon the EGA with Switch 1 set to CGA, WILL run if you set the switch to EGA
Xmode and then reset the mode with this software.  I'm interested in
Xknowing if it works that well on other EGA-type boards.  Note that I
Xhave also provided source code for both EGA.ASM and CGA.ASM.
X
E!O!F
echo 'x - ega.asm (text)'
sed << 'E!O!F' 's/^X//' > ega.asm
X; (CTRL-OH)   IBM PC PRINTER CONDENSED MODE
X        page    ,132
X        title   colboot.asm
XRET_FN  equ     4CH                     ;"return to dos" function call
X 
X;*********************************************************************
X;
X;       LOW MEMORY SEGMENT
X;
X;*********************************************************************
X 
X 
XLowSeg  segment at 00h                  ;BIOS vectors & DOS variables
X        org     487h
XINFO    db      ?
X        org     488h
XINFO3   db      ?                       ;Feature bits, EGA DIP switches
XLowSeg  Ends
X 
X 
X;******************************************************************************
X;
X;       DATA SEGMENT
X;
X;******************************************************************************
X 
X 
XDseg    segment para public 'data'
XMSG1    db      'EGA -> EGA mode',10,13,10,13,'$'             ;startup message
XDONEMSG db      ' *** EGA MODE NOW IN EFFECT ***',10,13,'$'   ;ending message
XRET_CD  db      0                                 ;errorlevel return code value
X 
XDseg    Ends
X 
X 
X;******************************************************************************
X;
X;       CODE SEGMENT
X;
X;******************************************************************************
X 
X 
XCseg    segment para public 'code'
X        assume  cs:cseg,ss:stack        ;already set by dos loader
X 
XEntpt   proc    far                     ;entry point from dos
X        Mov     ax,Dseg                 ;set up addressability to
X        Mov     ds,ax                   ; the data segment
X        assume  ds:Dseg
X        Mov     ax,LowSeg               ;set up addressability to
X        Mov     es,ax                   ; the low segment
X        assume  es:LowSeg
X 
X;******************************************************************************
X;       set up for EGA mode
X;******************************************************************************
X 
X        Mov     dx,offset MSG1          ;program startup message
X        Mov     ah,09h                  ;print string
X        Int     21h
X 
X        mov     ah,03h                  ;read cursor position
X        int     10h
X        push    bx                      ;save page number
X        push    dx                      ;save row,column
X 
X        mov     al,INFO3
X        and     al,0f0h                 ;set low nybble to 9
X        or      al,09h
X        mov     INFO3,al                ;set up for enhanced color display
X        mov     ax,0082h                ;set normal text mode (performs the
X        int     10h                     ;  actual mode switch - no cls.)
X 
X        mov     ah,02h                  ;set cursor position
X        pop     dx                      ;restore row,column
X        pop     bx                      ;restore page number
X        int     10h
X        and     INFO,07fh               ;reset no clear screen bit (fix bug?)
X 
X        Mov     dx,offset DONEMSG       ;tell about EGA mode now
X        Mov     ah,09h                  ;print string
X        Int     21h
X        jmp     Exit
X 
X 
X;******************************************************************************
X;       RETURN TO DOS
X;******************************************************************************
X 
X 
XExit:   Mov     ah,RET_FN               ;return to dos function call, and
X        Mov     al,RET_CD               ;value to be passed to errorlevel
X        Int     21H                     ;return to dos
XEntpt   Endp                            ; (version 2.00 or later)
XCseg    ENDS
X 
XSTACK   SEGMENT PARA STACK 'STACK'
XDB      64 DUP("STACK   ")      ;256 WORD STACK AREA
XSTACK   ENDS
XEND     ENTPT
E!O!F
echo 'x - cga.asm (text)'
sed << 'E!O!F' 's/^X//' > cga.asm
X; (CTRL-OH)   IBM PC PRINTER CONDENSED MODE
X        page    ,132
X        title   colboot.asm
XRET_FN  equ     4CH                     ;"return to dos" function call
X 
X;*********************************************************************
X;
X;       LOW MEMORY SEGMENT
X;
X;*********************************************************************
X 
X 
XLowSeg  segment at 00h                  ;BIOS vectors & DOS variables
X        org     487h
XINFO    db      ?
X        org     488h
XINFO3   db      ?                       ;Feature bits, EGA DIP switches
XLowSeg  Ends
X 
X 
X;******************************************************************************
X;
X;       DATA SEGMENT
X;
X;******************************************************************************
X 
X 
XDseg    segment para public 'data'
XMSG1    db      'EGA -> Color Emulator & Reboot',10,13,10,13,'$' ;startup msg
XWAITMSG db      'Press any key to set CGA mode: $'               ;wait message
XCGAMSG  db      ' *** CGA MODE NOW IN EFFECT ***',10,13,10,13,'$'
XBOOTMSG db      'Press ENTER if you wish to boot a floppy now: $'
XCRLF2   db      10,13,10,13,'$'
XRET_CD  db      0                                 ;errorlevel return code value
X 
XDseg    Ends
X 
X 
X;******************************************************************************
X;
X;       CODE SEGMENT
X;
X;******************************************************************************
X 
X 
XCseg    segment para public 'code'
X        assume  cs:cseg,ss:stack        ;already set by dos loader
X 
XEntpt   proc    far                     ;entry point from dos
X        Mov     ax,Dseg                 ;set up addressability to
X        Mov     ds,ax                   ; the data segment
X        assume  ds:Dseg
X        Mov     ax,LowSeg               ;set up addressability to
X        Mov     es,ax                   ; the low segment
X        assume  es:LowSeg
X 
X;******************************************************************************
X;       set up for CGA emulation
X;******************************************************************************
X 
X        Mov     dx,offset MSG1          ;program startup message
X        Mov     ah,09h                  ;print string
X        Int     21h
X 
X        mov     ah,03h                  ;read cursor position
X        int     10h
X        push    bx                      ;save page number
X        push    dx                      ;save row,column
X 
X        mov     al,INFO3
X        and     al,0f0h                 ;set low nybble to 8
X        or      al,08h
X        mov     INFO3,al                ;set up for color emulation
X        mov     ax,0082h                ;set normal text mode (performs the
X        int     10h                     ;  actual mode switch)
X 
X        mov     ah,02h                  ;set cursor position
X        pop     dx                      ;restore row,column
X        pop     bx                      ;restore page number
X        int     10h
X        and     INFO,07fh               ;reset no clear screen bit (fix bug?)
X 
X;******************************************************************************
X;       ask for and perform BOOT
X;******************************************************************************
X 
X        Mov     dx,offset CGAMSG        ;tell about CGA mode
X        Mov     ah,09h                  ;print string
X        Int     21h
X 
X        Mov     dx,offset BOOTMSG       ;tell to press enter if desire boot
X        Mov     ah,09h                  ;print string
X        Int     21h
X        Mov     ax,0C07h                ;flush buffer, console input w/o echo
X        Int     21h
X        push    ax
X        Mov     dx,offset CRLF2         ;print 2 cariage returns
X        Mov     ah,09h
X        Int     21h
X        pop     ax
X        cmp     al,0dh                  ;compare to ENTER
X        jnz     Exit
X        Int     19h                     ;Dos boot interupt
X        jmp     Exit
X 
X;******************************************************************************
X;       RETURN TO DOS
X;******************************************************************************
X 
X 
XExit:   Mov     ah,RET_FN               ;return to dos function call, and
X        Mov     al,RET_CD               ;value to be passed to errorlevel
X        Int     21H                     ;return to dos
XEntpt   Endp                            ; (version 2.00 or later)
XCseg    ENDS
X 
XSTACK   SEGMENT PARA STACK 'STACK'
XDB      64 DUP("STACK   ")      ;256 WORD STACK AREA
XSTACK   ENDS
XEND     ENTPT
E!O!F
echo 'x - EGA43.asm (text)'
sed << 'E!O!F' 's/^X//' > EGA43.asm
XHere is a sample program to put the EGA in 43 line mode. It is also on
XIX/370 under /u1/wheeler.
X    
XPAGE    60,132
XTITLE MODE43 - Put EGA with ECD into 43 line mode
X;
XDATA    SEGMENT AT 40H
X        ORG     88H
XEGAMODE DB      ?
XDATA    ENDS
X;
XCODE    SEGMENT PARA PUBLIC 'CODE'
X        ASSUME  CS:CODE,DS:CODE
X;
XMODE43  PROC    NEAR
X;
X        MOV     AX,0F00H        ; Get current video mode
X        INT     10H
X        XOR     AH,AH           ; Now do mode set
X        INT     10H
X        MOV     AX,1112H        ; Select 8x8 double dot font
X        MOV     BL,0
X        INT     10H
X        MOV     AX,DATA         ; Change special EGA byte to get cursor
X        MOV     DS,AX
X        ASSUME  DS:DATA
X        MOV     EGAMODE,0F8H    ; Set to allow 8x8 cursor
X        MOV     AX,0100H        ; Set cursor type
X        MOV     CX,0607H        ; Select appropriate cursor
X        INT     10H
X        MOV     EGAMODE,0F9H    ; Set back
X        PUSH    CS              ; Set DS back to CS
X        POP     DS
X        ASSUME  DS:CODE
X        MOV     AX,1200H        ; Select alternate print screen routine
X        MOV     BL,20H
X        INT     10H
X        INT     20H             ; Return to DOS
XMODE43  ENDP
X;
XCODE    ENDS
X;
X        END     MODE43
E!O!F
-- 
	-bill davidsen

  ihnp4!seismo!rochester!steinmetz!--\
                                       \
                    unirot ------------->---> crdos1!davidsen
                          chinet ------/
         sixhub ---------------------/        (davidsen@ge-crd.ARPA)

"Stupidity, like virtue, is its own reward"