[MN-dev] [mndiff]: r70 - in trunk/vga600: . vga600.asm

michael subversion at mplayerhq.hu
Fri Jul 6 00:49:44 CEST 2007


Author: michael
Date: Fri Jul  6 00:49:43 2007
New Revision: 70

Log:
vga600 program from 1997-02-10 17:02 (this is the oldest version i found in my mess)


Added:
   trunk/vga600/
   trunk/vga600/vga600.asm

Added: trunk/vga600/vga600.asm
==============================================================================
--- (empty file)
+++ trunk/vga600/vga600.asm	Fri Jul  6 00:49:43 2007
@@ -0,0 +1,869 @@
+;350 text ???VDEE =57h
+
+;VGA600 ver 0.5 Copyright (C) Michael Niedermayer 1997
+
+;history:
+; 0.1 initial ver                                      (never released)
+; 0.2 added 240-line modes and ET4000-clock            (never released)
+; 0.3 added 350/400-line modes and S3-clock(untested)  (never released)
+; 0.4 added more inteligent activation                 (never released)
+; 0.5 added clock probeing         
+;           et4000 clock divide /2 /4
+;           mode recorrection  WINDOZE 95 SUCKS
+;           Loader rewriten
+ideal
+P286
+
+cr           equ 0ah
+lf           equ 0dh
+paras        equ (end10h-int10h)/16+1
+paras_all    equ (end_all-start+100h)/16+1
+words        equ (end10h-int10h)/2+5
+SC_INDEX     equ 03c4h   
+CRTC_INDEX   equ 03d4h   
+MISC_OUTPUT  equ 03c2h   
+MISC_INPUT   equ 03cch   
+patch_size   equ patch_code_end-patch_code
+delay        equ 6
+delay2       equ 12
+
+segment code
+org 100h
+assume cs:code, ds:code, es:code, ss:code
+
+start:
+jmp install
+
+mcb_name db 'VGA600  '
+int10h:
+ cmp ax,020FFh
+  jne exit_10
+  mov ax,00600h
+  mov bx,cs
+ iret
+exit_10:
+ push ax
+ cmp ax,04F02h
+  je mode_set
+ test ah,ah
+  jnz no_mode_set                ;only mode set
+  and al,7Fh
+  cmp al,013h
+   je x_mode_set               ;only 320x200 (x-modes)
+mode_set:
+  mov [BYTE cs:temp-int10h],1
+x_mode_set:
+  mov [BYTE cs:counter-int10h],delay or 11000000b 
+no_mode_set:
+ pop ax
+ pushf
+ db 09Ah
+old_int10h dd 0
+ pushf
+ shr [BYTE cs:temp-int10h],1
+  jnc no_check_set
+ call check_set
+no_check_set:
+ and [BYTE cs:counter-int10h],00111111b 
+ popf
+retf 2
+
+int8h:
+ dec [BYTE cs:counter-int10h]
+  jns decr
+ inc [BYTE cs:counter-int10h]
+decr:                                      
+  jnz exit_8
+ mov [BYTE cs:counter-int10h],delay2
+
+ call check_set
+
+exit_8:
+db 0eah
+old_int8h dd 0
+ 
+check_set:
+pusha
+push ds
+ push cs
+ pop ds
+ mov dx,CRTC_INDEX
+ mov al,9
+ out dx,al
+ inc dx
+ in al,dx
+ dec dx
+ and al,11100111b      ;TEXT (25/50)
+ mov cl,al
+  jns no_cga
+ mov ah,al
+ add al,al              ;shl al,1    
+ inc ax                              
+ and ax,0110000000011111b                   
+ or al,ah
+no_cga:
+ xchg ax,bx    ;bl=al
+ mov al,12h
+ out dx,al
+ inc dx
+ in al,dx
+ dec dx
+ mov bh,al     
+ mov ch,al
+
+ cld
+ mov si,offset(CRTParms)-int10h-9
+check_loop:
+ add si,9 
+ lodsw                         
+ cmp ax,bx
+  je patch
+ test ax,ax
+jnz check_loop
+
+ mov si,offset(TextParms)-int10h-7
+check_loop2:
+ add si,9 
+ lodsw                         
+ cmp ax,cx
+nopi:
+  je patch2
+ test ax,ax
+jnz check_loop2
+pop ds
+popa
+ret
+
+patch2:
+ dec si
+ dec si
+patch:
+ mov al,11h                    
+ out dx,al                     
+ inc dx                        
+ in al,dx                      
+ and al,7fh                    
+ out dx,al                     
+ dec dx                        
+ mov cx,8                      
+SetCRT:
+  lodsb                      
+  mov ah,al
+  mov bx,cx
+  mov al,[bx+where-int10h-1]
+  cmp al,9                    ;MSL (GRRR TEXT 50lines)
+   jne no_texti
+  out dx,al
+  inc dx
+  in al,dx
+  dec dx
+  and al,00001000b
+  or ah,al
+  mov al,9
+no_texti:
+  out dx,ax
+ loop SetCRT
+
+ lodsb
+patch_code2:
+ xchg ax,bx
+ mov ah,bl                     ;ah=bl=clock
+ shl ah,2
+ mov dl,LOW(MISC_INPUT)       ;dh=3!
+ in al,dx                      ;al=MiscOutput
+ mov dl,LOW(MISC_OUTPUT)       ;dh=3!
+patch_code:
+et4000_clock:
+ and ax,0000110011110011b      
+ or al,ah
+ out dx,al                     ;0-1
+
+ mov dl,0bfh                   ;!dh=3
+ mov al,3
+ out dx,al
+ mov dl,0d8h                   ;!dh=3
+ mov al,0a0h
+ out dx,al                     ;enable ET4000 ext.
+
+ mov dl,LOW(CRTC_INDEX)                  ;!dh=3
+ mov al,34h
+ out dx,al
+ inc dx
+ in al,dx
+ mov ah,bl
+ shr ah,1
+ and ax,0000001011111101b
+ or al,ah
+ out dx,al                               ;2
+
+ dec dx
+ mov al,31h
+ out dx,al
+ inc dx
+ in al,dx
+ mov ah,bl
+ shl ah,3
+ and ax,1100000000111111b
+ or al,ah
+ out dx,al                     ;3-4
+
+ mov dl,LOW(SC_INDEX)
+ mov al,7h
+ out dx,al
+ inc dx
+ in al,dx
+ mov bh,bl
+ and bx,0100000000100000b
+ shl bl,1
+ shr bh,6
+ or bl,bh
+ and al,10111110b
+ or al,bl
+ out dx,al                     ;5/6 *double/quad*
+
+ dec dx
+ mov al,6h
+ out dx,al
+ inc dx
+ in al,dx
+ out dx,al                     ;ET4000 SUCKs
+
+pop ds
+popa
+ret
+patch_code_end:
+
+where:
+    db 016h                     ;VBE
+    db 015h                     ;VBS
+    db 011h                     ;VSE / Protect
+    db 010h                     ;VSS
+    db 007h                     ;OF
+    db 006h                     ;VT
+    db 012h                     ;VDEE
+    db 009h                     ;MSL 
+
+CRTParms:
+d1 db 041h                        ;MSL=41        (?x200 double->triple)
+   db 08fh                        ;VDEE=399
+    db 062h                     ;MSL 
+    db 057h                     ;VDEE
+    db 087h                     ;VT
+    db 0f0h                     ;OF
+    db 064h                     ;VSS
+    db 086h                     ;VSE / Protect
+    db 05eh                     ;VBS
+    db 079h                     ;VBE
+c1  db 01h                        ;Clock=1
+
+d2 db 041h                        ;MSL=41        (?x200 double->quad)
+   db 08fh                        ;VDEE=399
+    db 063h                     ;MSL 
+    db 01fh                     ;VDEE
+    db 04fh                     ;VT
+    db 0ffh                     ;OF
+    db 02Ch                     ;VSS
+    db 08eh                     ;VSE / Protect
+    db 026h                     ;VBS
+    db 03fh                     ;VBE
+c2  db 01h                        ;Clock=1
+
+d3 db 041h                        ;MSL=41        (?x240 double->triple)
+   db 0dfh                        ;VDEE=479
+    db 062h                     ;MSL 
+    db 0cfh                     ;VDEE
+    db 0ffh                     ;VT
+    db 0f0h                     ;OF
+    db 0dch                     ;VSS
+    db 08eh                     ;VSE / Protect
+    db 0d6h                     ;VBS
+    db 0efh                     ;VBE
+c3  db 01h                        ;Clock=1
+
+d4 db 041h                        ;MSL=41        (?x240 double->quad)
+   db 0dfh                        ;VDEE=479
+    db 063h                     ;MSL    
+    db 0bfh                     ;VDEE   
+    db 0efh                     ;VT     
+    db 0ffh                     ;OF     
+    db 0cch                     ;VSS    
+    db 08eh                     ;VSE / Protect
+    db 0c6h                     ;VBS    
+    db 0dfh                     ;VBE
+c4  db 01h                        ;Clock=1
+   
+d5 db 040h                        ;MSL=40        (?x350 single->double)
+   db 05dh                        ;VDEE=349
+    db 061h                     ;MSL 
+    db 0bbh                     ;VDEE
+    db 0ebh                     ;VT
+    db 0f0h                     ;OF
+    db 0c8h                     ;VSS
+    db 08ah                     ;VSE / Protect
+    db 0c2h                     ;VBS
+    db 0d6h                     ;VBE
+c5  db 01h                        ;Clock=1
+
+d6 db 040h                        ;MSL=41        (?x400 single->double)
+   db 08fh                        ;VDEE=399
+    db 061h                     ;MSL 
+    db 01fh                     ;VDEE
+    db 04fh                     ;VT
+    db 0ffh                     ;OF
+    db 02Ch                     ;VSS
+    db 08eh                     ;VSE / Protect
+    db 026h                     ;VBS
+    db 03fh                     ;VBE
+c6  db 01h                        ;Clock=1
+  
+d7 db 040h                        ;MSL=40        (?x480 single->double)
+   db 0dfh                        ;VDEE=479
+    db 061h                     ;MSL    
+    db 0bfh                     ;VDEE   
+    db 0efh                     ;VT     
+    db 0ffh                     ;OF     
+    db 0cch                     ;VSS    
+    db 08eh                     ;VSE / Protect
+    db 0c6h                     ;VBS    
+    db 0dfh                     ;VBE
+c7  db 01h                        ;Clock=1
+TextParms:
+d8 db 047h                        ;MSL=40    TEXT (?x350 single->double)
+   db 05dh                        ;VDEE=349
+    db 0e7h                     ;MSL 
+    db 0bbh                     ;VDEE
+    db 0ebh                     ;VT
+    db 0f0h                     ;OF
+    db 0c8h                     ;VSS
+    db 08ah                     ;VSE / Protect
+    db 0c2h                     ;VBS
+    db 0d6h                     ;VBE
+c8  db 01h                        ;Clock=1
+
+d9 db 047h                        ;MSL=47    TEXT (?x400 single->double)
+   db 08fh                        ;VDEE=399
+    db 0e7h                     ;MSL 
+    db 01fh                     ;VDEE
+    db 04fh                     ;VT
+    db 0ffh                     ;OF
+    db 02Ch                     ;VSS
+    db 08eh                     ;VSE / Protect
+    db 026h                     ;VBS
+    db 03fh                     ;VBE
+c9  db 01h                        ;Clock=1
+
+da db 047h                        ;MSL=47      TEXT (?x480 single->double)
+   db 0dfh                        ;VDEE=479
+    db 0e7h                     ;MSL    
+    db 0bfh                     ;VDEE   
+    db 0efh                     ;VT     
+    db 0ffh                     ;OF     
+    db 0cch                     ;VSS    
+    db 08eh                     ;VSE / Protect
+    db 0c6h                     ;VBS    
+    db 0dfh                     ;VBE
+ca  db 01h                        ;Clock=1
+
+end_pos dd 0
+
+counter  db delay2
+temp db 0
+
+end10h:
+
+
+
+install:
+ cld
+ mov dx,offset(c_r)
+ call wstring
+ mov si,80h
+ mov ch,0
+ mov cl,[si]
+ inc si
+ or cx,cx
+  jz unk_command
+
+commands:
+ lodsb
+ cmp al,'\'
+  jne check_ok
+  mov [WORD nopi],09090h
+  mov al,'/'
+check_ok:
+ cmp al,'/'
+loopne commands
+ je nunk_command
+unk_command:
+  mov dx,offset(u_c)
+  call wstring
+ int 20h
+nunk_command:
+
+ lodsb
+ or al,00100000b ;conv to lower-case
+
+ cmp al,'u'
+  jne nunload
+  jmp unload
+nunload:
+
+ cmp al,'e'
+  jne nenable
+  mov [BYTE check_set],060h
+  jmp enable_disable
+nenable:
+
+ cmp al,'d'
+  jne ndisable
+  mov [BYTE check_set],0C3h
+  jmp enable_disable
+ndisable:
+
+ cmp al,33h
+  ja unk_command
+ sub al,30h
+  jb unk_command
+ push si
+  mov ah,0
+  xchg ax,bx
+  add bx,bx                ;shl bx,1
+  add bx,offset(code_table)
+  mov si,[bx]
+  mov di,offset(patch_code)
+  mov cx,patch_size
+  rep movsb                      ;copy clock_code 
+ pop si
+ mov di,offset CRTParms
+next_parm:
+  xor bx,bx
+  mov dl,10
+  mov cx,3
+  inc si
+loop_dez:
+  lodsb
+  cmp al,' '
+   je no_num
+  cmp al,0dh
+   je no_num
+  cmp al,'-'
+   je no_num2
+  sub al,30h
+   jnb nunk_command2
+probe2:
+   jmp probe
+unk_command2:
+  jmp unk_command
+nunk_command2:
+  cmp al,9h
+   ja probe2
+  xchg ax,bx
+  mul dl
+  xchg ax,bx
+  add bl,al
+ loop loop_dez
+no_num2:
+  inc si
+  mov [WORD di],-1
+no_num:
+  dec si
+ mov [di+10],bl
+ add di,11
+ cmp [WORD di],0
+jne next_parm
+
+ call chk_600
+  jne nalready_installed
+  mov dx,offset(p_a)
+  call wstring
+  mov es,bx
+  cli
+  mov di,offset(patch_code)-int10h
+  mov si,offset(patch_code)
+  mov cx,patch_size
+  rep movsb
+  mov di,offset(CRTParms)-int10h
+  mov si,offset(CRTParms)
+  mov cx,offset(end_pos)-offset(CRTParms)   
+  rep movsb
+  mov ax,[offset(nopi)]
+  mov [es:nopi-int10h],ax
+ int 20h
+
+enable_disable:
+ call chk_600
+  je nnot_inst
+  jmp not_inst
+nnot_inst:
+  mov dx,offset(p_a)
+  call wstring
+  mov es,bx
+  mov al,[offset(check_set)]
+  mov [es:check_set-int10h],al
+ int 20h
+
+nalready_installed:
+
+ mov ax,3510h
+ int 21h                       ;get old int 10
+ mov [offset(old_int10h)],bx
+ mov [offset(old_int10h)+2],es
+
+ mov ax,3508h
+ int 21h                       ;get old int 8
+ mov [offset(old_int8h)],bx
+ mov [offset(old_int8h)+2],es
+
+ mov sp,offset end_all+0FEh
+
+ push cs
+ pop es
+ mov ah,04Ah
+ mov bx,paras_all+010h
+ int 21h                       ;resize us 
+  jc mem_error 
+
+ mov ah,048h                   ;!BX=paras_all+10h
+ int 21h                       ;allocate mem for copy
+  jc mem_error                  
+
+ mov es,ax
+ mov cx,offset end_all+0100h
+ xor di,di
+ xor si,si
+ rep movsb                    ;copy IT
+
+ push es
+ push offset cool_jmp
+ retf                         ;mov cs,es 
+
+cool_jmp:                     ;
+ push cs
+ pop ss                    ;and the stack
+
+ mov ax,ds
+ cmp [016h],ax
+  jne ok2
+ mov [es:016h],es
+ok2:
+ cmp [034h+2],ax
+  jne ok3
+ mov [es:034h+2],es
+ok3:                          
+
+ mov ah,50h
+ mov bx,cs
+ int 21h                     ;set addr of PSP
+
+ push ds
+ pop es
+ mov ah,49h
+ int 21h                      ;get rid of the old shit
+
+ mov ax,cs
+ mov ds,ax
+ dec ax
+ mov es,ax
+ mov [es:1],ds                 ;set seg to itself
+
+ mov es,[2ch]                  ;es=env-seg
+ mov bx,paras
+ mov ah,4ah
+ int 21h                       ;resize env
+ cmp bx,paras
+  je nmem_error
+mem_error:
+  mov dx,offset(m_e)
+  call wstring
+ jmp exit_load
+nmem_error:
+
+ mov ax,es
+ dec ax
+ mov es,ax                     ;mcb of env-seg
+ inc ax
+ mov [es:1],ax                 ;set seg to itself
+ mov di,8
+ mov si,offset(mcb_name)
+ mov cx,words
+ rep movsw                     ;copy name & prog to mcb & mem
+ mov ds,ax
+ xor dx,dx
+ mov ax,2510h
+ int 21h                       ;set new int 10
+ mov dx,int8h-int10h     
+ mov ax,2508h
+ int 21h                       ;set new int 8
+
+exit_load:
+ push cs
+ pop es
+ mov ah,49h
+ int 21h                      
+mov ah,04ch
+int 21h                        ;get out (cool TSR)
+
+unload:
+ call chk_600
+  je nnot_installed
+not_inst:
+  mov dx,offset(n_i)
+  call wstring
+ int 20h
+nnot_installed:
+ push bx
+ mov ax,3510h
+ int 21h             ;get int 10
+ pop bx
+ push bx
+ mov ax,es
+ cmp ax,bx
+  jne not_unload
+
+ mov ax,3508h
+ int 21h             ;get int 8
+ pop bx
+ mov ax,es
+ cmp ax,bx
+  jne not_unload
+
+ mov dx,[es:offset(old_int10h)-int10h]
+ mov ds,[es:offset(old_int10h)-int10h+2]
+ mov ax,2510h
+ int 21h            ;set old int 10
+ mov dx,[es:offset(old_int8h)-int10h]
+ mov ds,[es:offset(old_int8h)-int10h+2]
+ mov ax,2508h
+ int 21h            ;set old int 8
+ mov ah,49h
+ int 21h            ;free mem
+int 20h
+
+not_unload:
+ mov dx,offset(n_u)
+ call wstring
+int 20h
+
+probe:
+ call chk_600
+  jne nprobeerror
+  mov dx,offset(p_e)
+  call wstring
+; int 20h
+nprobeerror:
+
+ mov ax,0013h
+ int 10h   
+
+ mov ax,3508h
+ int 21h                       ;get old int 8
+ mov [offset(old_int8xh)],bx
+ mov [offset(old_int8xh)+2],es
+
+ mov dx,offset(int8_probe)
+ mov ax,2508h
+ int 21h                       ;set new int 8
+
+ xor di,di
+ mov si,offset clock_buf
+
+probe_loop:
+ mov ax,di
+ call patch_code2
+
+ mov [WORD int8_counter],-1
+syncint8:
+ cmp [WORD int8_counter],0
+  js syncint8
+
+ call waitvret
+ xor cx,cx
+wait_loop:
+ call waitvret
+ inc cx
+ cmp [WORD int8_counter],18
+  jb wait_loop
+ shl cx,6   ;mul cx,64
+ xchg ax,cx
+ mov cl,179
+ div cl
+ mov [si],al
+ inc si
+ inc di
+ cmp di,32
+  jb probe_loop
+end1:
+
+ mov ax,0003h
+ int 10h   
+
+ mov si,offset clock_buf
+
+ mov cx,32
+print_loop:
+ test cl,111b
+  jnz no_crlf
+ mov dx,offset crlf
+ call wstring
+no_crlf:
+ mov ah,0
+ mov al,[si]
+ inc si
+ call wdez
+ mov dx,offset Mhz
+ call wstring
+ loop print_loop
+end_print:
+
+
+
+ mov dx,[offset(old_int8xh)]
+ mov ds,[offset(old_int8xh)+2]
+ mov ax,2508h
+ int 21h                       ;set old int 8
+
+int 20h
+
+waitvret:
+ pusha
+ mov dx,03dah
+waitsvret:
+  in al,dx
+  mov cl,1000b
+  and al,cl
+ loope waitsvret
+waitevret:
+  in al,dx
+  mov cl,1000b
+  and al,cl
+ loopne waitevret
+ popa
+ret
+
+int8_probe:
+ inc [WORD cs:int8_counter]
+db 0eah
+old_int8xh dd 0
+
+wstring:
+ mov ah,09h
+ int 21h
+ret
+
+wdez:
+ pusha
+ mov di,ax
+ mov cx,5
+ mov si,10000
+ mov bx,10
+dez_loop:
+ xor dx,dx
+ div si
+ push dx
+ cmp cx,1
+  je nnope
+ cmp dx,di
+  je nope
+nnope:
+ xchg ax,dx
+ mov ah,2
+ add dl,30h
+ int 21h
+nope:
+ xchg si,ax
+ xor dx,dx
+ div bx
+ xchg si,ax
+ pop ax
+loop dez_loop
+ popa
+ret
+
+chk_600:
+ mov ax,020FFh
+ int 10h
+ cmp ax,00600h
+ret
+
+vga_clock:
+ and ax,0000110011110011b      
+ or al,ah
+ out dx,al                     ;0-1
+pop ds
+popa
+ret
+
+s3_clock:
+ or al,00001100b                         ;set std_clock to 3
+ out dx,al
+
+ mov dl,LOW(CRTC_INDEX)                   ;!dh=3
+ mov al,38h                               ;unlock registers
+ out dx,al
+ inc dx
+ mov al,48h
+ out dx,al
+ dec dx
+ mov al,39h
+ out dx,al
+ inc dx
+ mov al,0A5h
+ out dx,al
+ dec dx
+
+ mov al,42h
+ out dx,al
+ inc dx
+ in al,dx
+ and al,11110000b
+ and bl,00001111b
+ or al,bl
+ out dx,al
+
+ pop ds
+ popa
+ret
+
+alt_vga_clock:
+ and ax,0001110011100011b      
+ or al,ah
+ out dx,al                     ;0-2
+ pop ds
+ popa
+ret
+
+int8_counter dw 0
+
+clock_buf db 32 dup (0)
+
+code_table:
+ dw offset(vga_clock)
+ dw offset(et4000_clock)
+ dw offset(s3_clock)
+ dw offset(alt_vga_clock)
+
+c_r db 'VGA600 ver 0.5 Copyright (C) Michael Niedermayer 1997',cr,lf,'$'
+u_c db 'VGA600 (/|\)vga_card c1 c2 c3 c4 c5 c6 c7 c8 c9 ca|/U|/E|/D',cr,lf
+    db ' vga_card: 0=VGA 1=ET4000 2=S3(untested)',cr,lf
+    db ' c1: G ?x200(400)->(600) DOT-clock | - if disabled',cr,lf
+    db ' c2: G ?x200(400)->(800) DOT-clock | - if disabled',cr,lf
+    db ' c3: G ?x240(480)->(720) DOT-clock | - if disabled',cr,lf
+    db ' c4: G ?x240(480)->(960) DOT-clock | - if disabled',cr,lf
+    db ' c5: G ?x350(350)->(700) DOT-clock | - if disabled',cr,lf
+    db ' c6: G ?x400(400)->(800) DOT-clock | - if disabled',cr,lf
+    db ' c7: G ?x480(480)->(960) DOT-clock | - if disabled',cr,lf
+    db ' c8: T ?x350(350)->(700) DOT-clock | - if disabled',cr,lf
+    db ' c9: T ?x400(400)->(800) DOT-clock | - if disabled',cr,lf
+    db ' ca: T ?x480(480)->(960) DOT-clock | - if disabled',cr,lf
+    db 'ex: VGA600 /1 2 - 4 - 5 6 6 - - -',cr,lf,'$'
+n_i db 'VGA600 is not installed!',cr,lf,'$'
+n_u db 'VGA600 is not unloadable!',cr,lf,'$'
+m_e db 'Mem allocating error!',cr,lf,'$'
+p_a db 'Passing arguments to TSR!',cr,lf,'$'
+p_e db 'Uninstall VGA600 first!',cr,lf,'$'
+Mhz db 'Mhz $'
+crlf db cr,lf,'$'
+
+end_all:
+ends
+end start



More information about the Mndiff-dev mailing list