Qbasicnews.com

Full Version: SVGA PEEK problems
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi all ! ... GLENN , I think u'll love answering me ! lol

Here is a new SVGA problem !
I don't manage to get the good RGB values ...

Example : I poke the (1000 , 450) pixel with red=255 , green=255 and blue=0
Then , when I peek this pixel , I have wrong values !

It seems to be a bank problem ... so to avoid from bank problm , I calculate each time the new ( or not ) bank
and I make a classical bankswitching .

My code is like this : ( I can't show it coze it's on another computer )

Code:
DEF SEG = &HA000

offsetblue = ( y * 1024 + x ) * bitperpixel
offsetgreen = offsetblue + 1
offsetred = offsetgreen + 1

bluebank = INT ( offsetblue / 65536 )
greenbank = INT ( offsetgreen / 65536 )
redbank = INT ( offsetred / 65536 )

bluepixel = offsetblue - bluebank * 65536
greenpixel = offsetgreen - greenbank * 65536
redpixel = offsetred - redbank * 65536

REGS.ax = &H4F05
REGS.bx = 0
REGS.dx = bluebank
INTERRUPTX &H10 , REGS , REGS
blue = PEEK ( bluepixel )

REGS.ax = &H4F05
REGS.bx = 0
REGS.dx = greenbank
INTERRUPTX &H10 , REGS , REGS
green = PEEK ( greenpixel )

REGS.ax = &H4F05
REGS.bx = 0
REGS.dx = redbank
INTERRUPTX &H10 , REGS , REGS
red = PEEK ( redpixel )

DEF SEG

Is my code wrong ? or is it once again because of my OS ? ( Win ME )
Cry
I've just test my program on another machine ...

So , here is the result : I have 2 solutions :
1st : I run my program on Win ME .. where my mouse can work on the whole screen , but where the POINT function doen't work !
2nd : I run my program under Win 2K ... where my mouse only works in a 640*200 window , but where the POINT functino works perfectly ....

I don't understand anything anymore !

( 3rd solution .. sucide ? .... lol ) :wink:
From your first post, I was going to say that I was hoping that your "bitsperpixel" variable was really referring to the number of bytes per pixel. However, if that routine works with any version of windows, it seems you'd have to be defining that variable right. Just a shot in the dark, instead of doing INT(offset / 65536), try offset \ 65536 . And I'll look at your code more when I get home. (I'm once again goofing off at work.)

Well, also, if those two different versions of windows involved two different computers, it could be your assumption that window 0 (BX in your 4F05 call) is the window for reading. It might be 1 on the other computer.
Oh GLENN !!! O my GOD

You're a GOD for me !!!!!!
IT WOOOORRRRRKKKKSSS !!!!!!!!
U're a GOD man !

THX a lot .

But can u pleaze tell me how can I detect if I should put a 0 or a 1
in the REGS.bx variable ? .. ( just to generalize my program on every machines )
call.

1. Change to the video mode you care about. (It may not be necessary, but some information may not be returned correctly unless you're in the video mode you're querying your VBE about.)

2. Make an array that holds 256 bytes.

3. Put &H4F01 in AX. Put the video mode number in CX. Put the memory segment of the above mentioned array in ES (use VARSEG). Put the memory offset of that array in DI (use VARPTR).

4. Call interrupt 10h.

5. Get window A's attribute byte. (Window A is also window 0.) This byte is at offset 2 into your array. Use DEF SEG and VARSEG to point to the beginning of the array and then VARPTR to get the offset. You add 2 to what VARPTR returns to get the memory offset for window A's attribute byte.

6. Then you look at the bits in that byte. If bit 0 (rightmost bit) is 0, window A isn't supported at all. Otherwise, it is. If bit 1 is one, window A is readable. Otherwise, it's not. If bit 2 is one, window A is writable. Otherwise, it's not. (If both bits 1 and 2 are one, you can read from and write to the same window.)

7. Do the same for window B's attribute byte. (Window B is also called window 1.) This byte is at offset 3 into your array. The bits are interpreted the same way as in window A's attribute byte.


In

http://geocities.com/gstumpff/vs.zip

is FINDVESA.ZIP. It has a routine that does this kind of stuff. (VS1 in VS.ZIP also does, but FINDVESA is more amenable to including in code.)