qa.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
   Example  Back  Contents  Index
──────────────────────────────────────────────────────────────────────────────
 
;* SetLineMode - Sets line mode for EGA or VGA.
;*
;* Shows:   BIOS Interrupt - 10h, Function 11h (Character Generator Interface)
;*                           10h, Function 12h (Video Subsystem Configuration)
;*          Instruction - cmp
;*
;* Uses:    vconfig - Video configuration structure, declared in the
;*          DEMO.INC include file. The structure must first be
;*          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
 
        cmp     vconfig.adapter, EGA    ; EGA or VGA?
        jge     @F                      ; Yes?  Continue
        jmp     e_exit                  ; No?  Exit with error
@@:     mov     ax, line                ; Check for valid parameter
        cmp     al, 25
        je      line25
        cmp     al, 43
        je      line43
        cmp     al, 50
        je      line50
        jmp     SHORT 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      lmode                   ; 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     SHORT lmode
 
line43: mov     al, 12h                 ; Set for EGA 43-line mode
        cmp     vconfig.adapter, EGA    ; EGA?
        je      lmode                   ; 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     SHORT lmode
 
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
 
lmode:  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
        mov     al, 7                   ; Else use BIOS to set cursor
        push    ax                      ; Pass bottom scan line
        mov     al, 6
        push    ax                      ; Pass top scan line
        call    SetCurSize              ; Set normal cursor
        add     sp, 4                   ; Clean stack
        jmp     SHORT exit              ; 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     SHORT exit              ; Normal exit
 
e_exit: mov     ax, 1                   ; Set error code
        jmp     SHORT @F
exit:   sub     ax, ax                  ; Clear error code
@@:     ret
 
SetLineMode ENDP
                                    -♦-