Assembly Language Help (alang.hlp) (Table of Contents; Topic list)
Important Notice
The pages on this site contain documentation for very old MS-DOS software, purely for historical purposes. If you're looking for up-to-date documentation, particularly for programming, you should not rely on the information found here, as it will be woefully out of date.
SetLineMode
 Map                                       Up Contents Index Back
────────────────────────────────────────────────────────────────────────────
 
;* SetLineMode - Sets line mode for EGA or VGA.
;*
;* Shows:   BIOS Interrupt - 10h, Function 11h (Character Generator Interface)
;*                           10h, Function 12h (Video Subsystem Configuration)
;*
;* Uses:    vconfig - Video configuration structure (initialized
;*          by calling the GetVidConfig procedure)
;*
;* Params:  Line - Requested line mode (25, 43, or 50)
;*
;* Return:  Short integer with error code
;*          0 if successful
;*          1 if error
 
SetLineMode PROC,
        Line:WORD
 
        .IF     vconfig.adapter >= EGA  ; If EGA or VGA:
        mov     ax, Line                ; Check for valid parameter
        cmp     al, 25
        je      line25
        cmp     al, 43
        je      line43
        cmp     al, 50
        je      line50
        jmp     e_exit                  ; If not 25, 43, or 50, exit w/ error
line25:
        mov     al, 11h                 ; Set for EGA 25-line mode
        cmp     vconfig.adapter, EGA    ; EGA?
        je      linemode                ; Yes?  Continue
        mov     ax, 1202h               ; No?  Function 12h for VGA
        mov     bl, 30h                 ; AL = 2 for 400 scan lines
        int     10h                     ; Reset to 400 scan lines
        mov     ax, 0003                ; Reset mode (Function 0)
        int     10h                     ;   to mode 3 (80-col text)
        mov     al, 14h                 ; Request 8x16 char matrix
        jmp     linemode
line43:
        mov     al, 12h                 ; Set for EGA 43-line mode
        cmp     vconfig.adapter, EGA    ; EGA?
        je      linemode                ; Yes?  Continue
        mov     ax, 1201h               ; No?  Function 12h for VGA
        mov     bl, 30h                 ; AL = 1 for 350 scan lines
        int     10h                     ; Reset to 350 scan lines
        mov     ax, 0003                ; Reset mode (Function 0)
        int     10h                     ;   to mode 3 (80-col text)
        mov     al, 12h                 ; Request 8x8 character matrix
        jmp     linemode
line50:
        cmp     vconfig.adapter, VGA    ; VGA?
        jne     e_exit                  ; No?  Exit with error
        mov     ax, 1202h               ; Yes?  Function 12h
        mov     bl, 30h                 ; AL = 2 for 400 scan lines
        int     10h                     ; Reset to 400 scan lines
        mov     ax, 0003                ; Reset mode (Function 0)
        int     10h                     ;   to mode 3 (80-col text)
        mov     al, 12h                 ; Request 8x8 character matrix
linemode:
        sub     bl, bl                  ; Use table 0
        mov     ah, 11h                 ; Request Function 11h
        int     10h                     ; Set new line mode
 
        mov     ah, 12h                 ; Select alternate print
        mov     bl, 20h                 ;    screen for EGA and VGA
        int     10h
 
        cmp     vconfig.adapter, VGA    ; VGA?
        je      exit                    ; Yes?  Then exit
        cmp     Line, 12h               ; If EGA 43-line mode, set
        je      port                    ;   cursor through port to
                                        ;   avoid cursor emulation bug
 
        ; Set normal cursor size, pass top and bottom scan lines
        INVOKE  SetCurSize, 6, 7
        jmp     exit
port:
        mov     dx, 03D4h               ; Video controller address
        mov     ax, 060Ah               ; Set AH = 06h (cursor start)
                                        ;     AL = 0Ah (register #)
        out     dx, ax                  ; Update port
        mov     ax, 000Bh               ; Set AH = 00h (cursor end)
                                        ;     AL = 0Bh (register #)
        out     dx, ax                  ; Update port
        jmp     exit                    ; Normal exit
        .ENDIF  ; EGA or VGA
e_exit:
        mov     ax, 1                   ; Set error code
        jmp     exit2
exit:
        sub     ax, ax                  ; Clear error code
exit2:
        ret
 
SetLineMode ENDP
                                    -♦-