Page 2 of 3
Re:VESA
Posted: Wed Oct 13, 2004 7:25 am
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:
Re:VESA
Posted: Wed Oct 13, 2004 8:29 am
by Brendan
Hi,
DennisCGc wrote:
Or even simpler:
How about simplifying the whole thing to:
Code: Select all
mov dword [0x111FF+0x28],0xFFFFFFFF
mov eax, 0x111FF+0x28+4
Cheers,
Brendan
Re:VESA
Posted: Wed Oct 13, 2004 1:33 pm
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?
Re:VESA
Posted: Wed Oct 13, 2004 2:25 pm
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
Re:VESA
Posted: Wed Oct 13, 2004 3:07 pm
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 ???
Re:VESA
Posted: Wed Oct 13, 2004 4:06 pm
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". =)
Re:VESA
Posted: Wed Oct 13, 2004 5:11 pm
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.
Re:VESA
Posted: Thu Oct 14, 2004 2:09 am
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.
Re:VESA
Posted: Sat Oct 23, 2004 5:58 pm
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
Re:VESA
Posted: Sat Oct 23, 2004 6:00 pm
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
Re:VESA
Posted: Sat Oct 23, 2004 9:23 pm
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.
Re:VESA
Posted: Sun Oct 24, 2004 5:08 pm
by Vladaz
It still writes the same error like it was earlier
![Sad :(](./images/smilies/icon_sad.gif)
Re:VESA
Posted: Sun Oct 24, 2004 8:53 pm
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.
Re:VESA
Posted: Mon Oct 25, 2004 7:33 am
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?
Re:VESA
Posted: Mon Oct 25, 2004 8:08 am
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
![Smile :)](./images/smilies/icon_smile.gif)
Thanks to all.