flat assembler
Message board for the users of flat assembler.
![]() Goto page Previous 1, 2 |
Author |
|
Dex4u 02 Feb 2011, 18:19
Vesa is just as simple as 13h mode
Here is a example for the new 32bit dos i am working on works Code: ;=========================================================; ; Vesa 02/02/2011 ; ;---------------------------------------------------------; ; By Dex. ; ; ; ; Here is a simple "Vesa" program. ; ; for Dos32, using the calltable functions. ; ; To assemble in Dos32, use fasm as follows ; ; fasm vesa1.asm vesa1.dex ; ;=========================================================; use32 ORG 0x400000 ; where our program is loaded to jmp start ; jump to the start of program. db 'DEX3' ; We check for this, to make shore it a valid 32bit dos file. ;----------------------------------------------------; ; Start of program. ; ;----------------------------------------------------; start: mov ax,18h mov ds,ax mov es,ax ;----------------------------------------------------; ; Get int21h address. ; ;----------------------------------------------------; mov eax,21h ; get the int 21h address int 21h jc Int21hError mov dword[Int21h],eax ; store it ;----------------------------------------------------; ; Get calltable address. ; ;----------------------------------------------------; mov edi,Functions ; fill the function table mov al,0 ; so we have some usefull functions mov ah,0x0a int 50h ;----------------------------------------------------; ; set vesa up ; ;----------------------------------------------------; mov ax,4f00h ; Set the vesa mode mov bx,0x4115 mov edi,Mode_Info ; fill in vesa info call [RealModeInt10h] jc Int21hError ;----------------------------------------------------; ; fade and send to screen ; ;----------------------------------------------------; call fade_screen32_8001 ; fill the off screen buff with color call BuffToScreen ; write it to screen ;----------------------------------------------------; ; wait for keypress ; ;----------------------------------------------------; mov ah,07h ; function number call dword[Int21h] ; wait for keypress ;----------------------------------------------------; ; return to text mode ; ;----------------------------------------------------; change back to text mode mov ax,03h ; move the number of the mode to ax call [RealModeInt10h] ; and enter the mode using int 10h ;----------------------------------------------------; ; print string ; ;----------------------------------------------------; print a message mov edx,Text_msg ; this point's to our string. mov ah,09h ; function number call dword[Int21h] ; this call dos function. ret ; returen to CLI ;----------------------------------------------------; ; exit error ; ;----------------------------------------------------; Int21hError: ; If error we end up here ;----------------------------------------------------; ; print string ; ;----------------------------------------------------; mov edx,Error_msg ; this point's to our string. mov ah,09h ; function number call dword[Int21h] ; this call dos function. ret ;----------------------------------------------------; ; BuffToScreen. ;Puts whats in the buffer to screen ; ;----------------------------------------------------; BuffToScreen: ; test for 24bit or 32bit vesa cmp [ModeInfo_BitsPerPixel],24 jne Try32 call BuffToScreen24 jmp wehavedone24 Try32: cmp [ModeInfo_BitsPerPixel],32 jne wehavedone24 call BuffToScreen32 wehavedone24: @@: ret ;----------------------------------------------------; ; BuffToScreen24 32bpp ; ;----------------------------------------------------; BuffToScreen32: pushad push es mov ax,8h mov es,ax mov edi,[ModeInfo_PhysBasePtr] mov esi,VesaBuffer xor eax,eax mov ecx,eax mov ax,[ModeInfo_XResolution] mov cx,[ModeInfo_YResolution] mul ecx mov ecx,eax cld cli rep movsd sti pop es popad ret ;----------------------------------------------------; ; BuffToScreen24 24bpp ; ;----------------------------------------------------; BuffToScreen24: pushad push es mov ax,8h mov es,ax xor eax,eax mov ecx,eax mov ebx,eax mov ax,[ModeInfo_YResolution] mov ebp,eax lea eax,[ebp*2+ebp] mov edi,[ModeInfo_PhysBasePtr] mov esi,VesaBuffer cld .l1: mov cx,[ModeInfo_XResolution] shr ecx,2 .l2: mov eax,[esi] mov ebx,[esi+4] shl eax,8 shrd eax,ebx,8 stosd mov ax,[esi+8] shr ebx,8 shl eax,16 or eax,ebx stosd mov bl,[esi+10] mov eax,[esi+12] shl eax,8 mov al,bl stosd add esi,16 loop .l2 sub ebp,1 ja .l1 pop es popad ret fade_screen32_8001: pushad mov edi,VesaBuffer mov eax,0x00ffffff mov ecx,800*600 rep stosd popad ret ;----------------------------------------------------; ; Data. ; ;----------------------------------------------------; VesaBuffer = 0x800000 count db 0 Int21h dd 0 Error_msg: db 'No vesa found! It change to 800x600 32bpp and files the screen with color and returns to text mode. |
|||
![]() |
|
Goto page Previous 1, 2 < Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2023, Tomasz Grysztar. Also on GitHub, YouTube, Twitter.
Website powered by rwasa.