        name    _L40set
        ;   void L40set(void);
L40_TEXT       segment byte public 'CODE'
        assume  cs:L40_TEXT
        org     100h
_L40set:
        mov     ax,1202h        ; scanline = 400
        mov     bl,30h
        int     10h
        cmp     al,12h
        jne     @out            ; bailout if not VGA

        MOV     AX,0003         ; textmode 0x03
        INT     10h      

        MOV     AX,1111h        ; 8x14 char set & video parameters
        MOV     BL,00   
        INT     10h      

        MOV     AX,1102h        ; set 8 point font
        MOV     BL,00   
        INT     10h      

        mov     dx,03d4h        ; update CRTC register 9
        mov     al,09h
        out     dx,al
        inc     dx
        in      al,dx
        and     al,0e0h
        or      al,09h
        out     dx,al

        mov     dx,03d4h        ; update CRTC register 12h
        mov     ax,9012h
        out     dx,ax

        push    ds
        XOR     AX,AX   
        MOV     DS,AX   
        mov     ah,09
        MOV     ds:[0485h],ah           ; update BIOScrtpoints 
        mov     ah,27h
        MOV     ds:[0484h],ah          ; update BIOScrtrows
        mov     ah,40h
        mov     ds:[044dh],ah          ; set page length to 16k
        xor     ah,ah
        mov     ds:[044ch],ah
        pop     ds

        xor     al,al
        mov     ah,1
        mov     ch,9
        mov     cl,0ah
        int     10h     ; set cursor size
@out:
        mov     ax,4c00h
        int     21h
L40_TEXT        ends
        end     _L40set

