1. Mode 18 memory access

Hi all,

I think someone was trying to access graphic_mode(18) memory in one of the
earlier messages, this is how you can do it.

Mode 18 is arranged in 4 "Pixel Planes" of 38400 bytes each, each plane is
the same structure as Mode 17 (640 x 480 x 2 colours, 1 byte = 8 pixels).

You can write to 1,2,3 or 4 planes at the same time by setting port #3C4 =
2 and setting the appropriate bits in port #3C5 (ie BIT 0=1 for plane 0,
BIT 1=1 for plane 1, BIT 2=1 for plane 2, etc ...) and POKE in your data,
don't forget the screen base address is #A0000 (NOT #A000 as in DOS)

To read data from each plane set port #3CE = 4 and set port #3CF to the
plane number (ie 0 for plane 0, 1 for plane 1, 2 for plane 2, 3 for plane
3) and PEEK the data.

If any of you need more detail I will write some code to demonstrate
grabbing and replacing an image in mode 18.

Have fun - Peter Blue

new topic     » topic index » view message » categorize

2. Re: Mode 18 memory access

Thanks Peter. Any example would be appreciated. I'm trying to save/restore
chunks of screen that are covered up by rectangular windows.

My initial question was a bit different, but it turns out I need this
information as well.

The first question still remains unanswered - how to write text to mode 18
with different color backgrounds (say, RED on GREEN), without altering the
color BLACK.

For example, I want to put up a menu bar with black text on a white
background, and display a gray dialog box with black text with a title bar
of blue text on a bright white background that contains a window of cyan
text against a blue background, all at the same time.

You get the idea...

 -- David Cuny

new topic     » goto parent     » topic index » view message » categorize

3. Re: Mode 18 memory access

Peter Blue wrote:

> To read data from each plane set port #3CE = 4 and set port #3CF to the
> plane number (ie 0 for plane 0, 1 for plane 1, 2 for plane 2, 3 for plane
> 3) and PEEK the data.

Thanks for the help. Moving bitmaps in memory (as opposed to sequences) is
blindingly fast, even on my 386. Using the built-in Euphoria routines made
me wonder if I could ever get the code running fast enough to be useful.

> You can write to 1,2,3 or 4 planes at the same time by setting port #3C4 =
> 2 and setting the appropriate bits in port #3C5 (ie BIT 0=1 for plane 0,
> BIT 1=1 for plane 1, BIT 2=1 for plane 2, etc ...) and POKE in your data,
> don't forget the screen base address is #A0000 (NOT #A000 as in DOS)

I see that I can write all 4 planes at once, but can I read them at once as
well?

The code I wrote allocates four seperate buffers (actually, four contigious
buffers) for each of the planes, and reads them in. Writing is the reverse.

If I could read all 4 planes at once, I'm assuming that I could use 1/4 the
memory, and I could write them out faster.

Thanks again!

 -- David Cuny

new topic     » goto parent     » topic index » view message » categorize

Search



Quick Links

User menu

Not signed in.

Misc Menu