Re: Graphics mode 257 memory address(es)

new topic     » goto parent     » topic index » view thread      » older message » newer message

There is a small virtual screen library for handling higher resolutions with the
program "faster fill" in the (recent?) contributions at RDS's Eu page.  It has
some functions that you might find useful in the include file vesa.e

Most super vga cards present their memory to the computer through a window
located
at #A0000 that is only 64k in size.  When using mode #13 the amount of memory
needed for a picture is only 320 * 200 = 64000, which fits nicely in one window.
This makes it possible to peek or poke colour values as offsets with ease.
Graphics modes that use more memory than this can be accessed piecemeal by
moving
the 64k window over parts of the video ram.  This can be achieved by calling the
right vesa video interrupt function with the position of the window.  The
overall
operation is not trivial however, as the position value is given in granularity
units, the minimum step possible, and this value varies between cards.

So one must first call the vesa video interrupt mode information function to
retrieve pertinent information about the mode, preferably when or during setting
it.   refresh(mode) from vesa.e is an example of this.
To then plot a pixel, one calculates the page/offset for the pixel
using:
mem_pos = y_pos * x_max + x_pos
page=remainder(mem_pos, 65536)
offset = floor(mem_pos, 65536)
One then sets the page with a function like set_page() and pokes the pixel at
#A0000 + offset.
Changing the page before poking the pixel is expensive and should be avoided by
keeping a variable that tracks the active page and skips the set_page step if
the
new page is already active.  It is also important to reset the page to 0 before
using any Eu screen routines.

As a different approach, one could use a flat frame buffer or virtual screen in
memory, poking colour values directly into offsets and when finished copying the
entire virtual screen to the display using procedures like splat_screen().  This
may seem easier, and a snappy display is preferable sometimes.  Overall though,
the process is slower than the previous one due to the relatively expensive
process of  copying the entire picture in such an inefficient manner.

Other methods exist which overcome many of these limitations but I believe they
would be somewhat trickier in the world of Eu.  I believe there exist much more
comprehensive graphics librarys that can manage true colour, sprites and more,
for
instance Pete Eberlein's neil.e as a good complete example, but in general such
librarys are large and complicated beasts, unweildy in small applications.

I hope I havn't forgotten too much, and I wont be held responsible for major
causeway crashes if I did  B^)  Give it a try anyway, don't hesitate to ask more
questions....

Cheers,
Nick


Roderick Jackson wrote:

> Does anyone know what memory address(es) the video data for graphics
> mode 257 (640 x 480, at 256 colors) is stored at?
>
> I would *really* love to use a virtual screen for plotting points, but I'm not
> sure where to poke the data when I'm done drawing. I assume mode
> 257 only has one "page", even if broken up over several locations.
>
> Help! smile

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu