VESA

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
DennisCGc

Re:VESA

Post by DennisCGc »

Mike wrote:

Code: Select all

mov eax, [0x111FF+0x28]
mov byte [eax], 0xFF
inc eax
mov byte [eax], 0xFF
inc eax
mov byte [eax], 0xFF
inc eax
mov byte [eax], 0xFF
inc eax
The very first move is wrong. What you are doing is moving to eax the value stored at [0x111FF+0x28], not the address 0x111FF+0x28. If you change "mov" to "lea", it should work.
Or even simpler:

Code: Select all

mov eax, 0x111FF+0x28
User avatar
Brendan
Member
Member
Posts: 8561
Joined: Sat Jan 15, 2005 12:00 am
Location: At his keyboard!
Contact:

Re:VESA

Post by Brendan »

Hi,
DennisCGc wrote: Or even simpler:

Code: Select all

mov eax, 0x111FF+0x28
How about simplifying the whole thing to:

Code: Select all

mov dword  [0x111FF+0x28],0xFFFFFFFF
mov eax, 0x111FF+0x28+4

Cheers,

Brendan
For all things; perfection is, and will always remain, impossible to achieve in practice. However; by striving for perfection we create things that are as perfect as practically possible. Let the pursuit of perfection be our guide.
Vladaz

Re:VESA

Post by Vladaz »

It still don't work. It doesn't put pixel.
If i do a loop like this:
   mov eax, [0x111FF+0x28]
   mov ecx, 1024*768*3
   loopas:
      mov byte [eax], 0xFF
      inc eax
   loop loopas

It should fill the screen or just some space of the screen, but when I try it with Virtual PC, it shows me error:
An unrecoverable processor error has been encountered.
The virtual machine will reset now.
And a button named "Reset"

What's now wrong?
bkilgore

Re:VESA

Post by bkilgore »

Vladaz wrote:It still don't work. It doesn't put pixel.
If i do a loop like this:
???mov eax, [0x111FF+0x28]
Looks to me like you're still putting the contents of that address into eax, instead of the address itself.
mov byte [eax], 0xFF
can you even do that? I thought you had to use bx, si, di, or bp for indirection

Try instead:

Code: Select all

mov ebx, 0x111FF+0x28
mov ecx, 1024*768*3
loopas:
   mov byte [ebx], 0xFF
   inc ebx
loop loopas
Vladaz

Re:VESA

Post by Vladaz »

Yeah it works, but not like it should.
Now it just paints a line about 16 lines of pixels.
Limit is 64k now.
I think it didn't enabled LFB, or I am wrong?
Some weeks ago i had corrected that problem, but now I have no idea where is problem ???
mystran

Re:VESA

Post by mystran »

So, you had a working implementation, but don't have it anymore? Well, just check back from your version control system for the versions from the time period you think it worked. You don't have a version control system for your sources? Well, let this be a lesson of "why version control system is useful". =)
ASHLEY4

Re:VESA

Post by ASHLEY4 »

Blind leading the blind, first i gave you full working code and you changed it until it does not work, can you not see the difference ?.
Also take a calculator and do a 1024*768 *3 or 4 depending on your vesa, and you will see it goes well over the 1MB, so have you enabled the a20 ?

On my vesa mode of 640*480 *4 , the bottom quarter is black, if i do not enable a20, so you would get a lot more on your screen size.

\\\\||////
(@@)
ASHLEY4.
User avatar
Pype.Clicker
Member
Member
Posts: 5964
Joined: Wed Oct 18, 2006 2:31 am
Location: In a galaxy, far, far away
Contact:

Re:VESA

Post by Pype.Clicker »

Vladaz wrote: Yeah it works, but not like it should.
Now it just paints a line about 16 lines of pixels.
Limit is 64k now.
I think it didn't enabled LFB, or I am wrong?
Some weeks ago i had corrected that problem, but now I have no idea where is problem ???
Yes, that definitely sounds like you're missing LFB. Check you requested mode 4xxxh instead of 0xxxh (or 04xxh instead of 00xxh). That should do the trick. Then make sure you operate on the so-called linear buffer, rather than on 0xA0000.
Vladaz

Re:VESA

Post by Vladaz »

I still can get rid of it :'(
That's my bootloeder's second stage, where I init VESA and fill the screen, but it doesn't fill the screen. Just that 64K
Vladaz

Re:VESA

Post by Vladaz »

Code: Select all

[BITS 16]
[ORG 0x8000]

jmp 0x0000:start

start:   
   cli
   xor ax, ax
   mov ds, ax
   mov es, ax
   mov fs, ax
   mov gs, ax
   mov ss, ax
   mov sp, 0x8000
   sti

   mov si, msgLoad
   call Print


   A20:
      cli
      xor cx, cx

      .clrbuffer1
         in al, 0x64
         test al, 0x2
         loopnz .clrbuffer1

         mov al, 0xD1
         out 0x64, al

      .clrbuffer2
         in al, 0x64
         test al, 0x2
         loopnz .clrbuffer2

         mov al, 0xDF
         out 0x60, al
         mov CX, 0xFF

      .wkbc
         out 0xED, ax
         loop .wkbc

      .finish
         sti
         mov si, msgDot
         call Print


   SectorLoader:
      mov ah, 2
      mov al, 3
      mov ch, 0
      mov cl, 3
      mov dx, 0
      
      xor bx, bx
      mov es, bx
      mov bx, 0x8600

      jmp .read

      .error
         mov si, msgX
         call Print
      
      .read
         int 13h
         jc .error

         mov si, msgDot
         call Print
   
   
   ; 0x1000
   ; 0x0FFF


   ; 0x1000
   ; 0x11FF

   VESA:
      mov ax, 4f00h                             
      mov bx, 0x1000
      mov es, bx
      mov di, 0x0FFF      
      int 10h
    
      cmp ax, 004Fh
      jne novesa     

      mov ax, 4f01h                                       ; set vesa screen mode information
      mov bx, 0x1000
      mov es, bx
      mov di, 0x11FF   
      mov cx, 0x4118
      int 10h 
      
          
      mov ax, 4f02h                                       ; set vesa screen mode
      mov bx, 0x4118
      int 10h
          
      cmp ax, 004Fh
      jne novesa2
      
      jmp PMode

   novesa:
      mov si, msgNoVesa
      call Print

   novesa2:
      mov si, msgNoVesa2
      call Print
      


   PMode:
      cli

      lgdt [gdtr]

      mov eax, cr0
      or eax, 1
      mov cr0, eax
         
      jmp code_selector:flush_pipe



;;;;;;;;;;   Functions

   Print:
      cld
      
      .checkchar
         lodsb
         or al, al
         jz .end
         mov ah, 0x0E
         mov bh, 0x00
         int 10h
         jmp .checkchar

   .end
   ret

[BITS 32]
   flush_pipe: 
   
   mov ax, data_selector
   mov ds, ax
   mov es, ax
   mov fs, ax
   mov gs, ax
   mov ss, ax
   mov sp, 0x8000

   ;mov eax, 0xB8000
   ;mov byte [eax], "a"
   ;inc eax
   ;mov byte [eax], 0x07 


   mov ebx, 0x111FF+0x28
   mov ecx, 1024*768*3
   loopas:
      mov byte [ebx], 0xFF
      inc ebx
   loop loopas


   ;jmp code_selector:0x8600


   jmp $

;;;;;;;;;;   GDT 
gdt:
null_selector EQU $-gdt
    dw  0
         dw  0
         db  0
         db  0
         db  0
         db  0

         dw  0
         dw  0
         db  0
         db  0
         db  0
         db  0

code_selector EQU $-gdt
   dw 0xFFFF
   dw 0x0

   db 0x0
   db 0x9A            ; 10011010b
   db 0xCF            ; 11001111b
   db 0x0

data_selector EQU $-gdt
   dw 0xFFFF
   dw 0x0

   db 0x0
   db 0x92            ; 10010010b
   db 0xCF            ; 11001111b
   db 0x0

gdt_end:

gdtr:
   dw gdt_end-gdt
   dd gdt



;;;;;;;;;;   Variables
msgLoad db 13, 10, "I am on bootloader SECOND STAGE", 0
msgDot db ".", 0
msgX db "x", 0
msgNoVesa db "Your video card does not support VESA", 0
msgNoVesa2 db "Your video card does not support VESA 222222", 0


;;;;;;;;;;   Required code
times 512*2-($-$$) db 0
ASHLEY4

Re:VESA

Post by ASHLEY4 »

Here are some thinks to try:

Code: Select all

render_screen:
        mov   edi,[0x111ff+0x28]
        mov   ecx,1024*768
        mov   eax, 0xffffffff              
        rep    stosd
Also do not think that all A20 code, works on all pc, one person tryed 6 A20 snips untill he found a working bit of code for is pc.

Try writing some data above 1MB and reading it back.

\\\\||////
(@@)
ASHLEY4.
Vladaz

Re:VESA

Post by Vladaz »

It still writes the same error like it was earlier :(
ASHLEY4

Re:VESA

Post by ASHLEY4 »

Try this:

Code: Select all

mov   esi,0x111ff + 0x28
lodsd
mov   dword [PhysBasePtr],eax
Now you should be able to use the var like i do eg:

Code: Select all

mov   edi,[PhysBasePtr]
mov   ecx,1024*768
mov   eax,0xffffffff
rep    stosd
\\\\||////
(@@)
ASHLEY4.
Vladaz

Re:VESA

Post by Vladaz »

If I use struct like it is in your vesa256 example that you told me to download, then I can't use that LFB and that struct when I am in kernel. Maybe you have some idea how to get access to that struct in kernel?
Vladaz

Re:VESA

Post by Vladaz »

Yahoo! It works, I think. I was trying tu run it on Virtual PC, but there it doesn't worked properly. Now I tried it on my Real PC and it filled all the screen using this:
render_screen:
mov edi, [0x111ff+0x28]
mov ecx,1024*768
mov eax, 0xffffffff
rep stosd

I put [ and ], because earlier it worked with it. I think I have to find the bug in Virtual PC and why it didn't work with it :)
Thanks to all.
Post Reply