1. Screen Memory
Hello All
Where is the screen memory for SVGA graphics modes?
I am writing a program that mem_copy()s a chunk of data to the pixel
graphics memory in mode 19. I found out from perform.doc that it could be
used to speed up graphics a bit.
Here's a little test program I wrote to try out poking directly to the
screen:
include graphics.e
if graphics_mode(19) then
end if
constant SCREEN = #A0000 --memory address ror screen
for y = 0 to 199 do
for x = 0 to 319 do
poke(SCREEN + y*320 + x, rand(255))
end for
end for
This worked fine in mode 19. It covered the whole screen with random colored
pixels. If I change the graphics mode to 257 it also worked ok, but only
covered the top part of the screen. This is normal because the screen is on
a higher res. But if I changed the for loop code to:
for y = 0 to 479 do
for x = 0 to 639 do
poke(SCREEN + y*320 + x, rand(255))
end for
end for
where the only difference is the numbers in the for loop, it crashed my
computer. I obviously poked to a bad memory address. If someone could tell
me where the rest of the screen is stored, it would be helpful.
_________________________________________________________________________
Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com.
2. Re: Screen Memory
>for y = 0 to 479 do
> for x = 0 to 639 do
> poke(SCREEN + y*320 + x, rand(255))
> end for
>end for
>
I think it should be y*640, not y*320..
>If someone could tell me where the rest of the screen is stored, it >would
>be helpful.
I might be wrong about this, but I *think* that mode 257 has a planar on
most video cards. Wich means that the memory isn't ordered in the linear
fashion for wich mode 19 is known.
My suggestion is for you to download Pete Eberlein's VESA20 library, it's
really easy to use and saves you from problems like the one you've
mentioned.
_________________________________________________________________________
Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com.
3. Re: Screen Memory
- Posted by Graeme <graemeburke at CROSSWINDS.NET>
Dec 20, 2000
-
Last edited Dec 21, 2000
At 05:52 PM 20/12/00 +1030, you wrote:
>Hello All
>
>Where is the screen memory for SVGA graphics modes?
>I am writing a program that mem_copy()s a chunk of data to the pixel
[snip]
>This worked fine in mode 19. It covered the whole screen with random colored
>pixels. If I change the graphics mode to 257 it also worked ok, but only
>covered the top part of the screen.
>If someone could tell
>me where the rest of the screen is stored, it would be helpful.
The short answer is its all in the same place.
svga can only access a limited section of memory so it does a
sort of a time share arrangement.
The hi res screen is split up into 'banks', each covering a
band of the screen. You first select the bank you want then
write the data for that section of the screen, then select the
next bank and write the data for that part of the screen to the
same address you wrote the first lot....etc
So when you were in mode 257 you were only accessing bank 0 which
would be the top part of the screen.
The bank switching and other neat tricks can be achieved by
dos interrupt calls. Check out svga.e by Pete Eberlein in the
archive for an example of this.
I posted a display_image routine on the list a year or so ago
that used this method along with Michael Bolin's fast ML mem_copy
routines to get some reasonably quick results. Mail me privately
if you get stuck and I'll try to help.
Graeme.
----------------------------------------------------
4. Screen Memory
- Posted by Yogesh Gupta <yoglad at GIASDLA.VSNL.NET.IN>
May 13, 1998
-
Last edited May 14, 1998
Hi All
I found out that you can use mem_copy() to poke directly into memory
#A0000 while in mode 19, with colors. But when poking into vga memory
while in mode 18 results in loss of color - only black & white graphics
appear. Why is this so ? Is there any way to get the colors.
Bye
Abhimanyu Lad
5. Re: Screen Memory
Abhimanyu Lad wrote:
>I found out that you can use mem_copy() to poke directly into memory
>#A0000 while in mode 19, with colors. But when poking into vga memory
>while in mode 18 results in loss of color - only black & white graphics
>appear. Why is this so ? Is there any way to get the colors.
In some graphic modes you can only access one color plane at a time.
If you've downloaded my EE editor, take a look at the VGA.E file. It has =
an example of peeking and poking screen memory, and works in mode 18. If =
there's a better way to do it, I'd be glad to hear it!
-- David Cuny