flat assembler
Message board for the users of flat assembler.
Index
> OS Construction > Vbe - Wrong way to calculate positions? |
Author |
|
Another Stupid Coder 26 Jun 2005, 14:50
Hi
I've got a little problem with vesa. wrote a bit of code (putpixel,...) a while ago and now i wanted to use it again, but: it doesn't work correctly. when i wrote it, i put only 1 pixel on the screen so i did not realize the bug in that time: pixels are always a bit to far right... Source: Code: PutPixel: push ebp ; save extended base pointer. mov ebp, esp ; move the stackpointer to ebp. push eax push ebx push edi mov edi, [LinearFrameBuffer] mov eax, [ebp + 8] shl eax, 10 add edi, eax mov eax, [ebp + 8] shl eax, 9 add edi, eax mov eax, [ebp + 8] shl eax, 6 add edi, eax mov eax, [ebp + 8] shl eax, 1 add edi, eax mov eax, [ebp + 12] shl eax, 1 add edi, eax mov ax, 1111111111111111b ; color ( 1 unused, 5 red, 5 green, 5 blue). mov [edi], ax ; draw the pixel. pop edi pop ebx pop eax pop ebp ; restore the basepointer. retn 8 ; return to the main-code and delete the 2 args on the stack. mode is 113h here's a screenshot: http://ffo-tbc.ath.cx/asc/Bildschirmfoto.png (server is often down -_-) well, the code with uses putpixel is only: Code: push 0 push 0 call PutPixel push 1 push 1 call PutPixel push 2 push 2 call PutPixel push 3 push 3 call PutPixel push 4 push 4 call PutPixel push 5 push 5 call PutPixel push 6 push 6 call PutPixel _________________ terribly bad english speaker. |
|||
26 Jun 2005, 14:50 |
|
f0dder 26 Jun 2005, 20:40
Humm, don't you need to take surface *pitch* and not *width* into account under VESA?
|
|||
26 Jun 2005, 20:40 |
|
Another Stupid Coder 27 Jun 2005, 11:14
well, i said 113h...in vesa3 docs its 800x600 with 16bit depth...(1:5:5:5)
EDIT: Hm...its possible that this is the fault: maybe i used 1024x768x24, when using it first. _________________ terribly bad english speaker. |
|||
27 Jun 2005, 11:14 |
|
Octavio 27 Jun 2005, 11:58
Another Stupid Coder wrote: well, i said 113h...in vesa3 docs its 800x600 with 16bit depth...(1:5:5:5) Your are doing a multiplication for 1602 not 1600. Why you donĀ“t use 'mul' instruction? |
|||
27 Jun 2005, 11:58 |
|
Another Stupid Coder 27 Jun 2005, 12:03
aerhmm...because mul is quite slow, i think...and putpixel should be fast
_________________ terribly bad english speaker. |
|||
27 Jun 2005, 12:03 |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.