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

michael subversion at mplayerhq.hu
Fri Jul 6 01:00:10 CEST 2007


Author: michael
Date: Fri Jul  6 01:00:10 2007
New Revision: 72

Log:
version from 1997-02-19 15:37


Modified:
   trunk/vga600/vga600.asm

Modified: trunk/vga600/vga600.asm
==============================================================================
--- trunk/vga600/vga600.asm	(original)
+++ trunk/vga600/vga600.asm	Fri Jul  6 01:00:10 2007
@@ -173,9 +173,9 @@ Not2_End_CheckSet:
  cmp bx,ax
   jb End2_CheckSet
 
- cmp ax,[max_line-int10h]                   ;check num_lines (300-1000)
+ cmp ax,[MaxLines-int10h]                   ;check num_lines (300-1000)
   ja End2_CheckSet
- cmp ax,[min_line-int10h]
+ cmp ax,[MinLines-int10h]
   jb End2_CheckSet
 
  mov al,[MSL-int10h]
@@ -211,7 +211,7 @@ FindBest:
 n3:
  mov ax,bx
  call FindSet_V                              ;find and set Vertical nums
- cmp si,[max_line-int10h]
+ cmp si,[MaxLines-int10h]
   ja End_FindBest                            ; get out if toooo much
 
  mov si,FP8_ClockTable-int10h                ;si=pointer to clock_table
@@ -221,15 +221,15 @@ FindBestClock:
  mov ax,[WORD si]                            ;get clock
  mul [WORD FP8_1-int10h]                     ;for more precision 
  div [WORD HT-int10h]                        ;find line_freq  HT MUST >256
- cmp ax,[FP8_min_LineFreq]                   ;check if < min_LineFreq
+ cmp ax,[FP8_MinLineFreq]                   ;check if < MinLineFreq
   jb End_FindBestClock
- cmp ax,[FP8_max_LineFreq]                   ;check if > max_LineFreq
+ cmp ax,[FP8_MaxLineFreq]                   ;check if > MaxLineFreq
   ja End_FindBestClock
  mul [WORD FP8_1-int10h]                     ;for more precision 
  div [WORD VT-int10h]                        ;find refresh_freq VT>256
- cmp ax,[FP8_min_refresh]                    ;check if < min_refresh
+ cmp ax,[FP8_MinRefresh]                    ;check if < MinRefresh
   jb End_FindBestClock
- cmp ax,[FP8_max_refresh]                    ;check if > max_refresh
+ cmp ax,[FP8_MaxRefresh]                    ;check if > MaxRefresh
   ja End_FindBestClock
  cmp ax,bp                                   ;check if better than best
   jb End_FindBestClock
@@ -573,23 +573,23 @@ ret
 
 
 FP8_1            dw 256
-FP8_min_refresh  dw 60 shl 8
-FP8_max_refresh  dw 90 shl 8
-FP8_min_LineFreq dw 28 shl 8
-FP8_max_LineFreq dw 72 shl 8
-
-FP8_ClockTable   dw 32 dup (?)
+FP8_MinRefresh  dw 60 shl 8
+FP8_MaxRefresh  dw 90 shl 8            
+FP8_MinLineFreq dw 28 shl 8            
+FP8_MaxLineFreq dw 72 shl 8            
+                                        
+FP8_ClockTable   dw 32 dup (?)          
 FP8_ClockTable_end:
 
 FPx_1_  dw FPx_1
 
 FPx_1p5 dw FPx_1/67              ;1/.015=67
 FPx_VS  dw FPx_1/200             ;1/.005=200
-FPx_VB  dw FPx_1/14              ;1/.070=14 !!!(inacurate)
+FPx_VB  dw FPx_1*7/100           ;1/.070=(100/7)
 
 clock_d  db 0
-max_line dw 1023
-min_line dw 300
+MaxLines dw 1023
+MinLines dw 300
 
 counter  db delay2
 temp db 0
@@ -599,51 +599,94 @@ end10h:
 
 
 install:
- cld
- mov dx,offset(c_r)
- call wstring
- mov si,80h
+ cld                              ;clear dir_falg
+ mov dx,offset(c_r)               ;dx=offset(copy-right)
+ call wstring                     ;write it to screen
+ mov si,80h                       ;si=offset(Num_ComLineArgs)
  mov ch,0
- mov cl,[si]
- inc si
- or cx,cx
-  jz unk_command
+ mov cl,[si]                      ;cx=Num_ComLineArgs
+ inc si                           ;si=offset(ComLineArgsBuffer)
+ or cx,cx                         ;check if nothing there
+  jz Unk_Command
+ xor bp,bp                        ;set nothing_Specified
 
-commands:
- lodsb
- cmp al,'/'
-loopne commands
- je nunk_command
-unk_command:
+SkipSpace:
+ lodsb                            ;fetch 1-byte from ComLine
+ cmp al,' '                       ;check if space
+loope SkipSpace                   ;loop until no space
+ je nUnk_Command                  ;check if not at end
+ test bp,bp                       ;check if no_VgaCardSpecified
+  jnz ComLineOK
+Unk_Command:                      ;print error-msg and exit
   mov dx,offset(u_c)
   call wstring
  int 20h
-nunk_command:
+nUnk_Command:
 
- lodsb
- or al,00100000b ;conv to lower-case
+ cmp al,'/'                       ;check if CommLineArg starts with /
+  jz Ok_Comm                      ;go on if so
+ cmp al,'-'                       ;check if CommLineArg starts with -
+  jnz Unk_Command                 ;get out if not
+Ok_Comm
 
- cmp al,'u'
-  jne nunload
-  jmp unload
-nunload:
+ mov di,si
+ mov si,offset(CommLineOptionsTable)
+ mov bx,offset(CLO_Enable)
+Next_CommLineArg:
+ push di                          ;Save di
+Next_CommLineArgByte:
+ lodsb                            ;fetch byte from table
+ or al,00100000b                  ;conv to lower-case
+ scasb                            ;compare if same at CommLine
+  je Next_CommLineArgByte         ;if yes check next
+ test al,al                       ;check if end reached
+  jnz Unk_Command                 ;SP not restored !
+ dec di                           ;in case "/A1" instaed of "/A 1"
+ mov al,' '
+Check_Space:
+ scasb                            ;skip spaces
+  je Check_Space
+ dec di
+ lodsb                            ;get call address from table
+ cbw                              ;convert to word
+ add bx,ax                        ;add to last
+ call bx                          ;call it
+ cbw                              ;convert to word
+ or bp,ax                         ;set bit in bp
+ pop di                           ;restore di
+ lodsb                            ;fetch next
+ dec di                           ;restore di
+ test al,al                       ;check if end reached
+  jnz Next_CommLineArg
+jmp SkipSpace                     ;get next CommLineArg from CommLine
+CommLineOk:
 
- cmp al,'e'
-  jne nenable
-  mov [BYTE CheckSet],060h
-  jmp enable_disable
-nenable:
+ push bp                          ;save bp
+ shr bp,2                         ;remove OptionFlag and VgaCardSpecifiedFlag
+CheckLine:
+ shr bp,1                         ;remove rightmost flag
+  jnc CheckLine:                  ;if flag was 0 try next
+ test bp,bp                       ;if not zero then error
+  jnz UnkCommand
+ pop bp                           ;restore bp
+
+ mov ax,bp                       ;ax=bp
+ xor ah,al                       ;(ah=0) ah=~al
+ cmp  al,00010000b               ;Check for UnInstall
+  je UnInstall
+ cmp  al,00100001b               ;Check for Probe(and vga_card)
+  je Probe
+ test ax,0000000111111100b       ;Check for VgaCard w/o other stuff
+  jz GoTSR
+ test al,11110001b               ;Check for Enable/Disable/options w/o other stuff
+  jz PassToTSR
+ jmp UnkCommand
 
- cmp al,'d'
-  jne ndisable
-  mov [BYTE CheckSet],0C3h
-  jmp enable_disable
-ndisable:
 
  cmp al,33h
-  ja unk_command
+  ja Unk_Command
  sub al,30h
-  jb unk_command
+  jb Unk_Command
  push si
   mov ah,0
   xchg ax,bx
@@ -998,7 +1041,65 @@ ret
 alt_vga_clock:
  and ax,0001110011100011b      
  or al,ah
- out dx,al                     ;0-2
+ out dx,al                             ;0-2
+ret
+
+CLO_Enable:
+ mov [BYTE CheckSet],060h              ;set first oppcode to pusha
+ mov al,00000100b                      ;set Enable-Flag
+ret
+
+CLO_Disable:
+ mov [BYTE CheckSet],0C3h              ;set first oppcode to ret
+ mov al,00001000b                      ;set Disable-Flag
+ret
+
+CLO_VgaCard:
+ mov al,00000001b                      ;set Vga_card_specified-flag
+ret
+
+CLO_UnInstatll:
+ mov al,00010000b                      ;set UnInstall-Flag
+ret
+
+CLO_Probe:
+ mov al,00100000b                       ;set Probe-Flag
+ret
+
+CLO_MaxLineFreq:
+ call GetNumFP8
+ mov [FP8_MaxLineFreq],ax
+ mov al,00000010b                       ;set Options-Flag
+ret
+
+CLO_MinLineFreq:
+ call GetNumFP8
+ mov [FP8_MinLineFreq],ax
+ mov al,00000010b                       ;set Options-Flag
+ret
+
+CLO_MaxRefresh:
+ call GetNumFP8
+ mov [FP8_MaxRefresh],ax
+ mov al,00000010b                       ;set Options-Flag
+ret
+
+CLO_MinRefresh:
+ call GetNumFP8
+ mov [FP8_MinRefresh],ax
+ mov al,00000010b                       ;set Options-Flag
+ret
+
+CLO_MaxLines:
+ call GetNum
+ mov [MaxLines],ax
+ mov al,00000010b                       ;set Options-Flag
+ret
+
+CLO_MinLines:
+ call GetNum
+ mov [MinLines],ax
+ mov al,00000010b                       ;set Options-Flag
 ret
 
 int8_counter dw 0
@@ -1009,16 +1110,33 @@ code_table:
  dw offset(s3_clock)
  dw offset(alt_vga_clock)
 
+CommLineOptionsTable:
+ db 'e',0,offset(CLO_Enable)-offset(CLO_Enable)
+ db 'd',0,offset(CLO_Disable)-offset(CLO_Enable)
+ db 'v',0,offset(CLO_VgaCard)-offset(CLO_Disable)
+ db 'u',0,offset(CLO_UnInstall)-offset(CLO_VgaCard)
+ db 'p',0,offset(CLO_Probe)-offset(CLO_UnInstall)
+ db 'alf',0,offset(CLO_MaxLineFreq)-offset(CLO_Probe)
+ db 'ilf',0,offset(CLO_MinLineFreq)-offset(CLO_MaxLineFreq)
+ db 'ar',0,offset(CLO_MaxRefresh)-offset(CLO_MinLineFreq)
+ db 'ir',0,offset(CLO_MinRefresh)-offset(CLO_MaxRefresh)
+ db 'al',0,offset(CLO_MaxLines)-offset(CLO_MinRefresh)
+ db 'il',0,offset(CLO_MinLines)-offset(CLO_MaxLines)
+ db 0
+
 c_r db 'VGA600 ver 0.6 Beta Copyright (C) Michael Niedermayer 1997',cr,lf,'$'
-u_c db 'VGA600 /vga_card <options>|/U|/E|/D',cr,lf
-    db ' vga_card: 0=VGA 1=ET4000 2=S3(untested)',cr,lf
-    db ' options: /ALF=x (Max_LineFreq) default=0',cr,lf
-    db '          /ILF=x (Min_LineFreq) default=28',cr,lf
-    db '          /AR=x  (Max_Refresh)  default=70',cr,lf
-    db '          /IR=x  (Min_Refresh)  default=60',cr,lf
-    db '          /AL=x  (Max_Lines)    default=480',cr,lf
-    db '          /IL=x  (Min_Lines)    default=300',cr,lf
-    db 'ex: VGA600 /1 /ALF=72 /AL=1023 /AR=90',cr,lf,'$'
+u_c db 'VGA600 <options>|/U|/E|/D|/P',cr,lf
+    db ' options: /V n   (VgaCard)     0=VGA 1=ET4000 2=S3(untested)',cr,lf
+    db '          /ALF n (MaxLineFreq) default=0',cr,lf
+    db '          /ILF n (MinLineFreq) default=28',cr,lf
+    db '          /AR n  (MaxRefresh)  default=70',cr,lf
+    db '          /IR n  (MinRefresh)  default=60',cr,lf
+    db '          /AL n  (MaxLines)    default=480',cr,lf
+    db '          /IL n  (MinLines)    default=300',cr,lf
+    db '          /E     (Enable)',cr,lf
+    db '          /D     (Disable)',cr,lf
+    db '          /P     (Probe for PixelClocks)',cr,lf
+    db 'ex: VGA600 /V1 /ALF72 /AL1023 /AR90',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,'$'



More information about the Mndiff-dev mailing list