flat assembler
Message board for the users of flat assembler.

Index > DOS > Question: How to do GUI in mode 13h?

Goto page Previous  1, 2
Author
Thread Post new topic Reply to topic
DOS386



Joined: 08 Dec 2006
Posts: 1901
DOS386
MeshNix wrote:
About VESA. I checked out a few stuff on VESA and I realized that it isn't as simple as VGA (mode 13h).


Right.

> To put a pixel is very difficult unlike the simple, AH=0Ch/Int 10h.

This ^^^ is the very worst idea ever (call BIOS to drop single pixels). Write into VGA or VESA RAM. Idea

> I don't know where to find useful and sufficient information on VESA.
> Can someone give me some links? Thanks!

There is a FAQ on the TOP Smile

> So I guess VESA is the only option left. Does it work in DOS?

YES (needs working VESA BIOS or TSR driver).

> (meaning, if I enter VESA mode in XP

then everything following is at your own risk Smile

me239 wrote:

> I reccomend that you use mode 12h. It may have only 16 colors,
> but it's fast and 640*480 I believe.

Good. 640x480x4bpp, but you have to switch planes. Also the palette registers are messed up. But works from real mode and no painful bank stuff.

_________________
Bug Nr.: 12345

Title: Hello World program compiles to 100 KB !!!

Status: Closed: NOT a Bug
Post 02 Feb 2011, 03:21
View user's profile Send private message Reply with quote
Dex4u



Joined: 08 Feb 2005
Posts: 1601
Location: web
Dex4u
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! Sad',13,10,'$'
Text_msg:  db  'Text mode Smile',13,10,'$'


include 'Dex.inc'                                   ; Here is where we includ our "DexFunctions.inc" file

    


It change to 800x600 32bpp and files the screen with color and returns to text mode.
Post 02 Feb 2011, 18:19
View user's profile Send private message Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  
Goto page Previous  1, 2

< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2020, Tomasz Grysztar.

Powered by rwasa.