; Here's a code that I was going to use as a 132- column setter but
; abandoned it. ATI and VESA only. The ATI detection will work with
; ANY ATI card including non-SVGA. You may want to add something there...
;
;-----------------------------------------------------------------------
;
;  Generic 132 Column Text Mode Video Driver
;  Copyright (C) 1995 Jonathan Zarate
;
;  History:
;   02.18.1995   Start
;   02.18.1995   ATI, VESA added
;   02.20.1995   Last modified
;
;-----------------------------------------------------------------------

code          segment public byte
              assume cs:code, ds:code, es:code

              org 100h

              locals @@

main          proc

              cld                      ;setup...
              push cs                  ;
              pop ds                   ;

              mov ax,2B01h             ;don't do anything under DESQview
              mov cx,'DE'              ;or we may screw things up...
              mov dx,'SQ'              ;
              int 21h                  ;
              cmp al,0FFh              ;
              jne @@99                 ;

              call vesa                ;check VESA
              jc @@99                  ;
              call ati                 ;check ATI
              jc @@99                  ;

@@99:         mov ax,4C00h             ;
              int 21h                  ;

main          endp

;-----------------------------------------------------------------------

atisig        db '761295520'

ati           proc near
              mov ax,0C000h            ;check for ATI's signature
              mov es,ax                ;
              mov di,0031h             ;
              mov si,offset atisig     ;
              mov cx,9                 ;
              rep cmpsb                ;
              je @@10                  ;
              clc                      ;
              ret                      ;

@@10:         mov ax,0033h             ;33: 132x44 (8x8)
              int 10h                  ;23: 132x25 (8x14)
              stc                      ;58: 80x33 (8x8)
              ret                      ;5B: 80x30 (8x16)
ati           endp

;-----------------------------------------------------------------------


vesamodes     dw 10Ch                  ;132x60 text
              dw 10Bh                  ;132x50 text
              dw 10Ah                  ;132x43 text
              dw 109h                  ;132x25 text

vesa          proc near
              mov ax,4F03h             ;check if VESA supported
              int 10h                  ;
              cmp ax,004Fh             ;
              je @@10                  ;
              clc                      ;
              ret                      ;

@@10:         mov cx,4                 ;
              mov si,offset vesamodes  ;
@@20:         lodsw                    ;try setting different modes...
              mov bx,ax                ;
              mov ax,4F02h             ;
              int 10h                  ;
              cmp ax,004Fh             ;jump if ok
              je @@30                  ;
              loop @@20                ;
              clc                      ;
              ret                      ;

@@30:         stc                      ;
              ret                      ;

vesa          endp

vesabuffer    db 256 dup(?)

code          ends
              end main
