home *** CD-ROM | disk | FTP | other *** search
-
- Egy kis magyarázat az SVGA.ASM-hoz.
- -----------------------------------
-
- Ez egy kis segítség azoknak, akik valami SVGA-sat szeretnének írni,
- a 13h-tól felfele (értitek ugye). Neked nincs is más dolgod, mint
- felhasználni a már kész dolgokat. A használat:
-
- .
- .
- .
- CALL ASKVGA ; detektálja a VGA tipusát, vagy a CHIPkészletet,
- . ; majd megkérdezi ugyanezt (biztos ami biztos)
- .
- .
- .
- CALL SETMODE ; Ez bevált a 640x400x256-os módba, ha van ilyen
- . ; de ha nincs, akkor 640x480x256-ba
- .
- .
- MOV AX,hanyadiklapra ; AX-ben várja a 64K-s lap számát (0-15)
- CALL LAPOZ ; Meghívja a lapváltást
- .
- .
- .
-
- Ennyi az egész. Nem kommenteztem hülyére a forrást, mert nem ide szántam
- Eredetileg. Ha valaki tudja használni az ilyesmiket, annak már amúgy sem
- kell magyarázkodni, ugye ?
- Még valami: szivesen fogadok minden segítséget a témában.
- Ez a forrás még igen kezdetleges. De sokkal jobb lesz. Csak ehhez kell
- még egy kis idô (és információ !)
-
- - TSC -cp_rite db 'TSC''S SVGA DISPLAY DRIVER V 1.4'
-
- ; SVGA detecting, SVGA setting, SVGA paging == CODED BY TSC/TSi == '93 03
- ; Thanx to Kyto for the TSENG ET 3000/4000 detect routine !
-
- ; First, U have to call the ASKVGA, which determines the VGA card U have.
- ; Then U have to call the SETMODE, which sets the desired video mode
- ; (currently 640x400x256) for the actual VGA card.
- ; Then, when needed U have to call LAPOZ, which selects the desired
- ; page for the actual VGA card. Note: U have to put the desired
- ; page number into the AX !
- ; Have a nice time with it. But remember, if ya use it in your demo,
- ; that's OK, but send me a greet please....
-
- ; Here are 16 different bank switching....
- ; 0. PARADISE
- ; 1. VESA
- ; 2. TRIDENT
- ; 3. TSENG ET-4000 + A LOTS OF COMPATIBLES
- ; 4. VIDEO 7
- ; 5. ATI VGA WONDER
- ; 6. AHEAD A
- ; 7. AHEAD B
- ; 8. DIAMOND SPEEDSTAR 24 - ET-4000 COMPATIBLE !
- ; 9. STB
- ; 10. NCR
- ; 11. TSENG ET-3000
- ; 12. EVEREX
- ; 13. OAK
- ; 14. CHIPS & TECH
- ; 15. REALTEK RTVGA - MAY NOT WORK ! REALTEK IS THE SHITTEST SVGA I EVER
- ; FUCKED.
- ; 16. S3 WINDOWS ACCELERATOR
- ; 17. CIRRUS GD-5422 (alias AVGA-2, AVGA-3)
- ; 18. MACRONIX MX-68010
- ; 19. PRIMUS P-2000 ACCELERATOR
- ; 20. AVANCE LOGIC GRAPHICS ACCELERATOR
-
- ; AX:BANK
-
-
- setmode: push bx
- push ax
- cmp cs:vgacard,12
- je set_everex ;special EVEREX setting, by INT 10h 0070h
- cmp cs:vgacard,16
- je set_s3
- mov ax,cs:mode400
- mov bx,100h ;this is just for the VESA only
- int 10h
- jmp end_of_setmode
- set_everex: mov ax,0070h
- mov bl,14h ;640x400x256 on EVEREX
- int 10h
- end_of_setmode: pop ax
- pop bx
- ret
- set_s3: mov bx,101h ;same as VESA, but the Bank switching
- mov ax,4f02h ;is different
- int 10h
- pop ax
- pop bx
- ret
- lapoz:
- paradise: cmp cs:vgacard,0
- ja vesa
- push dx
- push ax
- push ax
- mov dx,3ceh
- mov al,9
- out dx,al
- inc dx
- pop ax
- shl ax,4
- out dx,al
- pop ax
- pop dx
- ret
-
- vesa: cmp cs:vgacard,1
- ja trident
- push bx
- push ax
- push dx
- mov bx,0
- shl ax,4
- mov dx,ax
- mov ax,4f05h
- int 10h
- pop dx
- pop ax
- pop bx
-
- trident: cmp cs:vgacard,2
- ja tseng4000
- push ax
- push dx
- push ax
- mov dx,3ceh ;set page size to 64k
- mov al,6
- out dx,al
- inc dl
- in al,dx
- dec dl
- or al,4
- mov ah,al
- mov al,6
- out dx,ax
- mov dl,0c4h ;switch to BPS mode
- mov al,0bh
- out dx,al
- inc dl
- in al,dx
- dec dl
- pop ax
- mov ah,al
- xor ah,2
- mov dx,3c4h
- mov al,0eh
- out dx,ax
- pop dx
- pop ax
- ret
- tseng4000: cmp cs:vgacard,3
- ja video7
- push ax
- push dx
- mov ah,al
- mov dx,3bfh ;Enable access to extended registers
- mov al,3
- out dx,al
- mov dl,0d8h
- mov al,0a0h
- out dx,al
- and ah,15
- mov al,ah
- shl al,1
- shl al,1
- shl al,1
- shl al,1
- or al,ah
- mov dl,0cdh
- out dx,al
- pop dx
- pop ax
- ret
-
- video7: cmp cs:vgacard,4
- ja ativga
- push ax
- push dx
- push cx
- and ax,15
- mov ch,al
- mov dx,3c4h
- mov ax,0ea06h
- out dx,ax
- mov ah,ch
- and ah,1
- mov al,0f9h
- out dx,ax
- mov al,ch
- and al,1100b
- mov ah,al
- shr ah,1
- shr ah,1
- or ah,al
- mov al,0f6h
- out dx,al
- inc dx
- in al,dx
- dec dx
- and al,not 1111b
- or ah,al
- mov al,0f6h
- out dx,ax
- mov ah,ch
- mov cl,4
- shl ah,cl
- and ah,100000b
- mov dl,0cch
- in al,dx
- mov dl,0c2h
- and al,not 100000b
- or al,ah
- out dx,al
- pop cx
- pop dx
- pop ax
- ret
-
- ativga: cmp cs:vgacard,5
- ja aheada
- push ax
- push dx
- mov ah,al
- mov dx,1ceh
- mov al,0b2h
- out dx,al
- inc dl
- in al,dx
- shl ah,1
- and al,0e1h
- or ah,al
- mov al,0b2h
- dec dl
- out dx,ax
- pop dx
- pop ax
- ret
-
- aheada: cmp cs:vgacard,6
- ja aheadb
- push ax
- push dx
- push cx
- mov ch,al
- mov dx,3ceh ;Enable extended registers
- mov ax,200fh
- out dx,ax
- mov dl,0cch ;bit 0
- in al,dx
- mov dl,0c2h
- and al,11011111b
- shr ch,1
- jnc skpa
- or al,00100000b
- skpa: out dx,al
- mov dl,0cfh ;bits 1,2,3
- mov al,0
- out dx,al
- inc dx
- in al,dx
- dec dx
- and al,11111000b
- or al,ch
- mov ah,al
- mov al,0
- out dx,ax
- pop cx
- pop dx
- pop ax
- ret
-
- aheadb: cmp cs:vgacard,7
- ja diamond
- push ax
- push dx
- push cx
- mov ch,al
- mov dx,3ceh ;Enable extended registers
- mov ax,200fh
- out dx,ax
- mov ah,ch
- mov cl,4
- shl ah,cl
- or ah,ch
- mov al,0dh
- out dx,ax
- pop cx
- pop dx
- pop ax
- ret
- diamond: cmp cs:vgacard,8
- ja stbvga
- push ax
- push dx
- mov ah,al
- mov dx,3bfh ;Enable access to extended registers
- mov al,3
- out dx,al
- mov dl,0d8h
- mov al,0a0h
- out dx,al
- and ah,15
- mov al,ah
- shl al,1
- shl al,1
- shl al,1
- shl al,1
- or al,ah
- mov dl,0cdh
- out dx,al
- pop dx
- pop ax
- ret
- stbvga: cmp cs:vgacard,9
- ja ncrvga
- push ax
- push dx
- mov ah,al
- mov dx,3bfh ;Enable access to extended registers
- mov al,3
- out dx,al
- mov dl,0d8h
- mov al,0a0h
- out dx,al
- and ah,15
- mov al,ah
- shl al,1
- shl al,1
- shl al,1
- shl al,1
- or al,ah
- mov dl,0cdh
- out dx,al
- pop dx
- pop ax
- ret
- ncrvga: cmp cs:vgacard,10
- ja tsenget3000
- mov bx,ax
- mov al,18h
- mov dx,3c4h
- out dx,al
- inc dx
- shl bx,2
- mov ax,bx
- out dx,al
- ret
-
- tsenget3000: cmp cs:vgacard,11
- ja everex_ ;Tseng et 3000
- push ax
- push dx
- and al,7
- mov ah,al
- shl al,1
- shl al,1
- shl al,1
- or al,ah
- or al,01000000b
- mov dx,3cdh
- out dx,al
- pop dx
- pop ax
- ret
-
- everex_: cmp cs:vgacard,12 ;Everex
- ja oak_
- push ax
- push dx
- push cx
- mov cl,al
- mov dx,3c4h
- mov al,8
- out dx,al
- inc dl
- in al,dx
- dec dl
- shl al,1
- shr cl,1
- rcr al,1
- mov ah,al
- mov al,8
- out dx,ax
- mov dl,0cch
- in al,dx
- mov dl,0c2h
- and al,0dfh
- shr cl,1
- jc ever_ez
- or al,20h
- ever_ez: out dx,al
- pop cx
- pop dx
- pop ax
- ret
-
- oak_: cmp cs:vgacard,13 ;Oak Technology Inc OTI-067
- ja chipstech
- push ax
- push dx
- and al,15
- mov ah,al
- shl al,1
- shl al,1
- shl al,1
- shl al,1
- or al,ah
- mov dx,3dfh
- out dx,al
- pop dx
- pop ax
- ret
-
- chipstech: cmp cs:vgacard,14 ;Chips & Tech
- ja realteklapoz
- push ax
- push dx
- push bx
- mov bl,al
- mov dx,46e8h ;place chip in setup mode
- mov ax,1eh
- out dx,ax
- mov dx,103h ;enable extended registers
- mov ax,0080h
- out dx,ax
- mov dx,46e8h ;bring chip out of setup mode
- mov ax,0eh
- out dx,ax
- mov ah,bl
- shl ah,1 ;change 64k bank number into 16k bank number
- shl ah,1
- mov al,10h
- mov dx,3d6h
- out dx,ax
- pop bx
- pop dx
- pop ax
- ret
- realteklapoz: cmp cs:vgacard,15
- ja s3lapoz
- push dx
- mov dx,3d7h
- out dx,al ; Easy eh ????
- pop dx
- ret
-
- s3lapoz: cmp cs:vgacard,16
- ja cirruslapoz
- push dx
- push ax
- mov al,35h
- mov dx,3d4h
- out dx,al
- inc dx
- pop ax
- out dx,al
- pop dx
- ret
- cirruslapoz: cmp cs:vgacard,17
- ja mxlapoz
- push dx
- push ax
- mov al,9
- mov dx,3ceh
- out dx,al
- inc dx
- pop ax
- out dx,al
- pop dx
- ret
- mxlapoz: cmp cs:vgacard,18
- ja primuslapoz
- push dx
- push ax
- mov al,0c5h
- mov dx,3c4h
- out dx,al
- inc dx
- pop ax
- out dx,al
- pop dx
- ret
- primuslapoz: cmp cs:vgacard,19
- ja avancelapoz
- push dx
- mov dx,3d6h
- out dx,al
- pop dx
- ret
- avancelapoz: cmp cs:vgacard,20
- ja valamimas
- push dx
- mov dx,3d7h
- out dx,al
- pop dx
- ret
- valamimas: ret
-
-
- detections: mov ax,cs
- mov es,ax
- mov ah,3
- int 10h
- mov bl,3
- mov bh,0
- mov bp,offset cs:infoline
- mov al,1
- mov ah,13h
- mov cx,21
- int 10h
-
- tridect: push cs
- pop ds
- mov dx,03c4h
- mov ax,14
- out dx,ax
- inc dx
- in ax,dx
- mov cs:oldvalue,ax
- mov ax,0
- out dx,ax
- in ax,dx
- and ax,15
- mov cs:value,ax
- mov ax,cs:oldvalue
- out dx,ax
- cmp cs:value,2
- jne paradisedet
- mov ah,9
- mov dx,offset cs:tridetected
- int 21h
- jmp vesadetect
-
- paradisedet: mov ax,0c000h
- mov ds,ax
- mov si,7dh
- lodsw
- cmp ax,'GV'
- jne aheaddetect
- lodsw
- cmp ax,'=A'
- jne aheaddetect
- mov ax,cs
- mov ds,ax
- mov ah,9
- mov dx,offset cs:paradetected
- int 21h
- jmp vesadetect
-
- aheaddetect: mov ax,0c000h
- mov ds,ax
- mov si,25h
- lodsw
- cmp ax,'HA'
- jne tsengdetect
- lodsw
- cmp ax,'AE'
- jne tsengdetect
- mov ax,cs
- mov ds,ax
- mov ah,9
- mov dx,offset cs:aheaddetected
- int 21h
- jmp vesadetect
- tsengdetect:
- ;
- ; 3CDh (R/W): Segment Select
- ; bit 0-2 (ET3000) 64k Write bank nr
- ; 3-5 (ET3000) 64k Read bank nr
- ; 6-7 (ET3000) Segment Configuration.
- ; 0 128K segments
- ; 1 64K segments
- ; 2 1M linear memory
- ; 0-3 (ET4000) 64k Write bank nr (0..15)
- ; 4-7 (ET4000) 64k Read bank nr (0..15)
-
- DetectTseng:
- mov dx,3CDh
- in al,dx
- mov ah,al
- mov al,55h
- out dx,al
- in al,dx
- xchg ah,al
- out dx,al
- cmp ah,55h
- jne vesadetect
- dec dx
- in al,dx
- mov dl,0D4h
- and al,1
- jne ET01
- mov dl,0B4h
- ET01: mov al,33h
- out dx,al
- inc dx
- in al,dx
- mov cl,al
- xor al,0Fh
- mov ah,al
- out dx,al
- in al,dx
- xchg al,cl
- out dx,al
- cmp ah,cl
- jne ET3000
- ET4000: mov ax,cs
- mov ds,ax
- mov ah,9
- mov dx,offset cs:et4000det
- int 21h
- jmp vesadetect
- ET3000: mov ax,cs
- mov ds,ax
- mov ah,9
- mov dx,offset cs:et3000det
- int 21h
- jmp vesadetect
-
- vesadetect: mov ax,4f03h
- int 10h
- cmp al,4fh
- jne undetect
- mov ax,cs
- mov ds,ax
- mov dx,offset cs:vesadetected
- mov ah,9
- int 21h
- mov ax,cs
- mov es,ax
- mov di,offset cs:vesatable
- mov cx,100h
- mov ax,4f01h
- int 10h
- mov ax,cs:[di+2]
- cmp al,7
- je writablevesa
- mov ah,3
- int 10h
- mov bl,4
- mov bh,0
- mov bp,offset cs:vesawarning
- mov al,1
- mov ah,13h
- mov cx,128
- int 10h
- writablevesa: ret
-
- undetect: mov ax,cs
- mov ds,ax
- mov ah,9
- mov dx,offset cs:undetected
- int 21h
- ret
- askvga: mov ax,12h
- int 10h
- mov ax,cs
- mov ds,ax
- call detections
- mov ax,cs
- mov es,ax
- mov ah,3
- int 10h
- mov bl,3
- mov bh,0
- mov bp,offset cs:whatvga
- mov al,1
- mov ah,13h
- mov cx,22
- int 10h
- mov ax,cs
- mov ds,ax
- mov ah,9
- mov dx,offset cs:whatvga2
- int 21h
- ujraask: mov ah,8
- int 21h
- cmp al,27
- jne nemakarkilepni
- mov ax,3
- int 10h
- mov ax,4c00h
- int 21h
- nemakarkilepni: cmp al,30h
- jb nemszam_
- cmp al,39h
- ja nemszam_
- sub al,30h
- mov cs:vgacard,al
- mov ah,0
- shl ax,1
- mov dx,cs
- mov ds,dx
- mov si,offset cs:vgamodes
- add si,ax
- lodsw
- mov cs:mode400,ax
- ret
- nemszam_: cmp al,'A'
- jb nemnagybetu
- cmp al,'K'
- ja nemnagybetu
- sub al,55
- mov cs:vgacard,al
- mov ah,0
- shl ax,1
- mov dx,cs
- mov ds,dx
- mov si,offset cs:vgamodes
- add si,ax
- lodsw
- mov cs:mode400,ax
- ret
- newask: jmp ujraask
- nemnagybetu: cmp al,'a'
- jb newask
- cmp al,'k'
- ja newask
- sub al,87
- mov cs:vgacard,al
- mov ah,0
- shl ax,1
- mov dx,cs
- mov ds,dx
- mov si,offset cs:vgamodes
- add si,ax
- lodsw
- mov cs:mode400,ax
- ret
-
- vgacard db 0
- whatvga db 10,13,10,13
- db 'Choose a VGA card:'
- whatvga2 db ' 0. PARADISE P1024 A. NCR',10,13
- db ' 0. PARADISE VGA PRO B. TSENG ET-3000',10,13
- db ' 0. PARADISE WD90C1x B. GENOA 5x00',10,13
- db ' 0. PARADISE WD90C3x C. EVEREX',10,13
- db ' 1. VESA STANDARD D. OAK',10,13
- db ' 2. TRIDENT 8900 E. CHIPS & TECH',10,13
- db ' 3. TSENG ET-4000 F. REALTEK',10,13
- db ' 3. DEFINICON G. S3',10,13
- db ' 3. ORCHID PRO DESIGNER II G. STEALTH VRAM',10,13
- db ' 3. GENOA 7900 H. CIRRUS GD-5422',10,13
- db ' 4. VIDEO 7 H. AVGA-2, AVGA-3',10,13
- db ' 5. ATI VGA WONDER XL I. MX-68010',10,13
- db ' 5. ATI VGA WONDER + J. PRIMUS P-2000',10,13
- db ' 5. ATI VGA ULTRA K. AVANCE AL-2101',10,13
- db ' 5. ATI GRAPHICS VANTAGE',10,13
- db ' 6. AHEAD A',10,13
- db ' 7. AHEAD B',10,13
- db ' 8. DIAMOND SPEEDSTAR',10,13
- db ' 9. STB ESC. QUIT NOW',10,13
- db '$'
-
- infoline db 10,13
- db 'Detected: '
- tridetected db 'Trident SVGA$'
- paradetected db 'Paradise SVGA$'
- aheaddetected db 'Ahead SVGA$'
- undetected db 'Unknown SVGA$'
- et3000det db 'Tseng Et-3000 SVGA$'
- et4000det db 'Tseng Et-4000 SVGA$'
- vesadetected db 10,13
- db ' VESA compatible SVGA',10,13,'$'
- oldvalue dw 0
- value dw 0
- mode400 dw 0
-
- ; These modes are 640x400x256, but some cards still doesn't support this mode.
- ; In these cases I put the 640x480x256 mode.
-
- vgamodes dw 5eh,4f02h,5ch,2fh,66h,61h,60h,60h,2fh,78h,5eh,2eh,0,53h
- dw 78h,25h,101h,5fh,58h,2dh,29h
- vesatable db 256/4 dup ('VESA')
- vesawarning db 10,13,'Don''t select VESA now, because unable to'
- db ' read from the WINDOW A.',10,13
- db 'Please load a better VESA driver,'
- db ' if you wanna select VESA !'
-
-
- * Terror Style
-