Board index » delphi » HELP!! Tweaked VGA mode

HELP!! Tweaked VGA mode

HElp me!! I'm trying to display a pcx-pic that I converted to pas, and
yes, it works fine in regular mode 13h, but when I try to display it
on a tweaked-mode screen, it just don't work. Can anybode try to
explain why??
To display the pic, I used a
move(mem[segment:offset],mem[$a000,blabla],somthing);
something like that... where the first segment:offset is the picture
of course.
Again, HEEEEELPP ME PLEASE!!! :)

 

Re:HELP!! Tweaked VGA mode


Quote
Rikard Bj?rklind wrote:

> HElp me!! I'm trying to display a pcx-pic that I converted to pas, and
> yes, it works fine in regular mode 13h, but when I try to display it
> on a tweaked-mode screen, it just don't work. Can anybode try to
> explain why??
> To display the pic, I used a
> move(mem[segment:offset],mem[$a000,blabla],somthing);
> something like that... where the first segment:offset is the picture
> of course.
> Again, HEEEEELPP ME PLEASE!!! :)

Ok, the reason the above statement works in mode13h and not in tweaked
modes is that mode 13h is a linear mode starting at $a000,0000 and
ending at $a000:ffff.  Tweaked modes work different.  They use the same
range of memory as the above mode 13h, but Tweaked modes have access to
all 256K of the video card.  What this means is that in order to use all
this memory with only 64K buffer in memory, you have to use bank
switiching to get to it all.

If this is confusing you, consider this.  

Mode 13h is 320x200x256.  Tweaked modes, even though only 320x200 or
320x240 or...ect is visible, you are actually looking at a part of a
640x480x256 screen.  These deminsions can vary depending on how you set
the mode up.  This is why is takes 256K to store a tweaked mode.

Under mode 13h, memory location $a000:0000 is the top left most pixel,
and $a000:0001 is the pixel directly to the right of the top left most
pixel.  In Tweaked modes, $a000:0000 is the top left most pixel, and
$a000:0001 is the pixel 3 pixels over from the top left most pixel.
This means that you can change only every forth pixel until you switch
the memory bank.  then you can change the 2nd,5th,9th,ect pixels.  There
are 4 memory banks each 64K each.  

Ok...for the wrap up, when you run the above move command, what happens
is that your pcx is displayed.. but with 3 blank pixels inbetween each
pixel you set.  If you could zoom out, you would see you picture just
fine, but you can't.

I suggest you read the axphisia(sp) tutoriols on this subject, because
they are much better at explaining it than I.

Hope this helps,

Greg Breland

Re:HELP!! Tweaked VGA mode


Quote
Rikard Bj=F6rklind wrote:
> HElp me!! I'm trying to display a pcx-pic that I converted to pas, and
> yes, it works fine in regular mode 13h, but when I try to display it
> on a tweaked-mode screen, it just don't work. Can anybode try to
> explain why??
> To display the pic, I used a
> move(mem[segment:offset],mem[$a000,blabla],somthing);
> something like that... where the first segment:offset is the picture
> of course.

To understand why this doesn't work, it helps to know about video memory
and how it works.  Regardless of whatever mode you're using, ALL video
memory is planar.  To understand what planar is, imagine four plates of
glass all the same size, all stacked on top of each other.  Each plane
shares the same address space, but you have a flag that controls which
one gets the address space.

Mode 13h is a chained mode, which means that the video hardware "chains"
the planes together so that each address accesses data across all four
planes (this is handled behind the scenes by the video hardware).

OTOH, when you have a tweaked mode, graphics are handled as "unchained",
or pure planar.  Memory is no longer directly mapped.  Where (0,0) is at
0A0000h:0000h and (1,0) is at 0A000h:0001h, in tweaked mode pixel (0,0)
is at 0A000:0000h on plane 0, and (1,0) is at 0A000h:0000h on plane 1. =

Going through each plane, when you move across to pixel (4,0) the
address for the pixel is 0A000h:0001h on plane 1.

Essentially, the the location of the pixel on a 320-pixel-wide screen
is:

  plane :=3D x mod 4;
  offset :=3D (80*y+x) div 4;

320 pixels per line / 4 planes =3D 80 pixels per line on each plane (the
reason for the 80 above).

That's the basic math behind tweaked mode (aka mode X), and I'm not sure
if this explanation helps or not.  You probably want to do some further
reading to get a better idea of the what and how of mode X.

For some programming information ang background, you might want to fetch
and study:

ftp://x2ftp.oulu.fi/pub/msdos/programming/faq/modex.faq

Source is primarily assembler, I wouldn't think it'd be that difficult
to figure out, though.

Quote
> Again, HEEEEELPP ME PLEASE!!! :)

-- =

Scott Earnest                      | _,-""-_,-""-_,-""-_,-""-_,-""-_,-"
|
set...@ix.netcom.com (primary)     | We now return you to our regularly
|
siny...@{*word*104}space.org (alternate) | scheduled chaos and mayhem. . . . =

|

Other Threads