Board index » delphi » HELP WITH VESA? PLEASE!!!!!!!!!!!!

HELP WITH VESA? PLEASE!!!!!!!!!!!!

Greetings fellow Pascalonians. :) (yes, if you must know, I am weird;)

Anyway, I'm making a game, and I'm having trouble with my VESA unit.

You see, I decided to make my own VESA unit, because every single
damned unit I've found, SWAG and elsewhere, will not do the proper
bank switching during pixel drawing. I got that working myself.

Now, my problems: (The whole thing is designed for 640x480x256)

- During a SetPalette, using port $03C8 in assembler, for some reason,
my palette entries are converted to EGA64 (6 bit) style - in other
words, only 0..63 for R, G, and B, not 0..255. Obviously, this shoots
my palette to HELL, and quite often back.

- Would some kind soul help me make a sprite routine? :) All I need it
for, actually, is drawing of 32x32 tiles... (if they're bigger,
they're all increments of 32 in size so they can be cut apart...)

- This is my current pixel routine (which works PERFECTLY and WITHOUT
A HITCH!). Someone mind showing me how I might be able to convert it
to assembler?

procedure pixel(x, y: integer);
var
  p: longint; { Gotta stay as a longint thing.. 639*479 (the biggest
pixel size possible in the mode I use) = 306,000, which don't quite
fit in a word.. }
  b: byte;  { Must stay as byte - for some reason, it wouldn't work if
it was a word/integer, but worked 100% when I made it a byte... }
begin
  p := y * MaxX + x;  { function MaxX: word;  returns max X pixel }
  b := p div 65536;
  SetBank(b);           { This is already a good ASM routine.. could
be inserted directly into the routine if needed }
  p := p - (b * 65536);
  mem[SegA000:p] := col;  { col is a global variable with the color }
end;

- Anybody got a good circle routine? I need one which produces results
like this: (o = pixel...:)
  oooo                        oooooo
 o    o                      oo    oo
o      o  not like this:     o      o  Squared edges I not like.
o      o                     o      o
 o    o                      oo    oo
  oooo                        oooooo

- Anybody got a good ASM line? My current line works perfectly, but
heck, ASM would be nice... :) (no squared angles! a diagonal line
should look like this
o                      o
 o     not like this   oo
  o                     oo
   o                     oo

- Anybody got a good fast text routine which I can use custom fonts
with? Small fonts mostly, kinda like System from Windows..

Anyway, thanks for any help. <G>

P.S. Please e-mail me any good graphics-related stuff you have.

--
Hilton Janfield --/-- val...@bcgroup.net --\-- darkfire productions
ICQ UIN: 5595904

I get knocked down, but I get up again, and your never gonna keep me down!

 

Re:HELP WITH VESA? PLEASE!!!!!!!!!!!!


Quote
Hilton Janfield wrote:

> Greetings fellow Pascalonians. :) (yes, if you must know, I am weird;)

> Anyway, I'm making a game, and I'm having trouble with my VESA unit.

> You see, I decided to make my own VESA unit, because every single
> damned unit I've found, SWAG and elsewhere, will not do the proper
> bank switching during pixel drawing. I got that working myself.

> Now, my problems: (The whole thing is designed for 640x480x256)

> - During a SetPalette, using port $03C8 in assembler, for some reason,
> my palette entries are converted to EGA64 (6 bit) style - in other
> words, only 0..63 for R, G, and B, not 0..255. Obviously, this shoots
> my palette to HELL, and quite often back.

I might be mistaken, but I have seen no 256-colour modes where this was
different. I don't know why that is. I even suspect that Windows
256-color-mode fools you into thinking it has more than 64 shades. If
you take a gray-scale picture I always feel there are greenish, blueish
and reddish grays.

- Show quoted text -

Quote
> - Would some kind soul help me make a sprite routine? :) All I need it
> for, actually, is drawing of 32x32 tiles... (if they're bigger,
> they're all increments of 32 in size so they can be cut apart...)

> - This is my current pixel routine (which works PERFECTLY and WITHOUT
> A HITCH!). Someone mind showing me how I might be able to convert it
> to assembler?

> procedure pixel(x, y: integer);
> var
>   p: longint; { Gotta stay as a longint thing.. 639*479 (the biggest
> pixel size possible in the mode I use) = 306,000, which don't quite
> fit in a word.. }
>   b: byte;  { Must stay as byte - for some reason, it wouldn't work if
> it was a word/integer, but worked 100% when I made it a byte... }
> begin
>   p := y * MaxX + x;  { function MaxX: word;  returns max X pixel }
>   b := p div 65536;
>   SetBank(b);           { This is already a good ASM routine.. could
> be inserted directly into the routine if needed }
>   p := p - (b * 65536);
>   mem[SegA000:p] := col;  { col is a global variable with the color }
> end;

> - Anybody got a good circle routine? I need one which produces results
> like this: (o = pixel...:)
>   oooo                        oooooo
>  o    o                      oo    oo
> o      o  not like this:     o      o  Squared edges I not like.
> o      o                     o      o
>  o    o                      oo    oo
>   oooo                        oooooo

I don't know very much about it, but if you have a fast line routine you
might consider using a method where you calculate a limited number of
points on a circle and connect these. This way you can adapt the
'resolution' of the circle (number of points calculated) to your needs.

Quote
> - Anybody got a good ASM line? My current line works perfectly, but
> heck, ASM would be nice... :) (no squared angles! a diagonal line
> should look like this
> o                      o
>  o     not like this   oo
>   o                     oo
>    o                     oo

Did you look at the routine in Denthor's tutorial series?
I have something like that. It's written for mode13h but it shouldn't be
difficult converting it to VESA.

Quote
> - Anybody got a good fast text routine which I can use custom fonts
> with? Small fonts mostly, kinda like System from Windows..

You can try some fonts from my fontpage. There are large and small ones,
the smaller naturally being the faster ones.

Quote
> Anyway, thanks for any help. <G>

> P.S. Please e-mail me any good graphics-related stuff you have.

> --
> Hilton Janfield --/-- val...@bcgroup.net --\-- darkfire productions
> ICQ UIN: 5595904

> I get knocked down, but I get up again, and your never gonna keep me
> down!

I'd be interested in the results if you get the thing going.

Regards,

Remco de Korte
Soft Machine
http://www.xs4all.nl/~remcodek/

Re:HELP WITH VESA? PLEASE!!!!!!!!!!!!


Re:HELP WITH VESA? PLEASE!!!!!!!!!!!!


A couple requests..

- Anybody have a good, free sound kit?
Oh wait, I just remembered one that I liked, but can't remember what
it was.. maybe somebody can help me.. the whole thing was MOD-based.
You had a MOD or several MODs, it plays in the background
automatically, and you insert any other sound effects you want into
unused instrument slots (therefore, the use of S3M - ain't gonna be
limited to 31 instruments:), and you can play them with a simple
play(#) routine. Although I would have to try and extend it for my
purposes.. namely, having two MOD's in memory - the music one, and the
SFX one, since putting all the SFX in every music file would be time
consuming and disk wasting...

- Can somebody teach me how I can apply a layering effect on the play
area? Basically, there will be the world map on the bottom (layer-1),
the player and other things on layer-2, and some "above" textures on
layer-3, under which the player only partially or doesn't appear.
There will also be some layer-1 (probably layer-2 actually...)
textures under which the player will only PARTIALLY appear (only the
top half).

- Can somebody supply me with a good floodfill?
I figure it would probably be best as a stripped-down version of a
sprite routine (WHICH I'M STILL LOOKING FOR), but you tell me..

- What would be the best way to implement animated sprites & tiles?
Ones that are continuous, like a waterfall, the ocean, etc, and others
that aren't, like the player (only animated when he moves)...

Quote
>> - During a SetPalette, using port $03C8 in assembler, for some reason,
>> my palette entries are converted to EGA64 (6 bit) style - in other
>> words, only 0..63 for R, G, and B, not 0..255. Obviously, this shoots
>> my palette to HELL, and quite often back.

>I might be mistaken, but I have seen no 256-colour modes where this was
>different. I don't know why that is. I even suspect that Windows
>256-color-mode fools you into thinking it has more than 64 shades. If
>you take a gray-scale picture I always feel there are greenish, blueish
>and reddish grays.

If dat were true, then how come the advanced VESA standard will only
let me use 64 shades when mode13 will let me use 256?
No, it not make sense to me why VESA use EGA64-style 6-bit colors...
Please don't make me switch to 16m mode! Yeah, anybody with a meg of
video memory can use 640x480x16m, but that would mean big-time
modification to my vesa unit (only made for 256c)!

Quote
>> - Anybody got a good circle routine? I need one which produces results
>> like this: (o = pixel...:)
>>   oooo                        oooooo
>>  o    o                      oo    oo
>> o      o  not like this:     o      o  Squared edges I not like.
>> o      o                     o      o
>>  o    o                      oo    oo
>>   oooo                        oooooo

>I don't know very much about it, but if you have a fast line routine you
>might consider using a method where you calculate a limited number of
>points on a circle and connect these. This way you can adapt the
>'resolution' of the circle (number of points calculated) to your needs.

Eeeewwww... :) That would either look really shitty (say, 8 segments),
or take too long (say, 32 or 64 segments). :)

Just realized that I don't need circles for my current project.... But
I probably will in the future.

Quote
>> - Anybody got a good ASM line? My current line works perfectly, but
>> heck, ASM would be nice... :) (no squared angles! a diagonal line
>> should look like this
>> o                      o
>>  o     not like this   oo
>>   o                     oo
>>    o                     oo

>Did you look at the routine in Denthor's tutorial series?
>I have something like that. It's written for mode13h but it shouldn't be
>difficult converting it to VESA.

Where can I get them? Not to mention any OTHER tutorial sets for any
mode? :) I can convert mode13 to VESA easily, since my VESA unit uses
direct access... just gotta add bank switching.

Quote
>> - Anybody got a good fast text routine which I can use custom fonts
>> with? Small fonts mostly, kinda like System from Windows..

>You can try some fonts from my fontpage. There are large and small ones,
>the smaller naturally being the faster ones.

Don't the SMfonts require graph? I not think graph would interact well
with my unit.. <G>

Quote
>I'd be interested in the results if you get the thing going.

Sure.

--
Hilton Janfield --/-- val...@bcgroup.net --\-- darkfire productions
ICQ UIN: 7107014

I get knocked down, but I get up again, and your never gonna keep me down!

Re:HELP WITH VESA? PLEASE!!!!!!!!!!!!


Quote
Hilton Janfield wrote:

> A couple requests..

<snip>

(no help here)

Quote

> >> - During a SetPalette, using port $03C8 in assembler, for some
> reason,
> >> my palette entries are converted to EGA64 (6 bit) style - in other
> >> words, only 0..63 for R, G, and B, not 0..255. Obviously, this
> shoots
> >> my palette to HELL, and quite often back.

> >I might be mistaken, but I have seen no 256-colour modes where this
> was
> >different. I don't know why that is. I even suspect that Windows
> >256-color-mode fools you into thinking it has more than 64 shades. If
> >you take a gray-scale picture I always feel there are greenish,
> blueish
> >and reddish grays.

> If dat were true, then how come the advanced VESA standard will only
> let me use 64 shades when mode13 will let me use 256?

I didn't think it did. But as I said: I might be mistaken.

Quote
> No, it not make sense to me why VESA use EGA64-style 6-bit colors...
> Please don't make me switch to 16m mode! Yeah, anybody with a meg of
> video memory can use 640x480x16m, but that would mean big-time
> modification to my vesa unit (only made for 256c)!

<snip>

(no help here)

Quote
> >> - Anybody got a good ASM line? My current line works perfectly, but
> >> heck, ASM would be nice... :) (no squared angles! a diagonal line
> >> should look like this
> >> o                      o
> >>  o     not like this   oo
> >>   o                     oo
> >>    o                     oo

> >Did you look at the routine in Denthor's tutorial series?
> >I have something like that. It's written for mode13h but it shouldn't
> be
> >difficult converting it to VESA.

> Where can I get them?

Last URL I got: http://www.vironix.co.za/grants/Asphyxia/Asphyxia.htm
(don't know if it works)
But it's on several other places too. Try any searchengine.

Not to mention any OTHER tutorial sets for any

Quote
> mode? :) I can convert mode13 to VESA easily, since my VESA unit uses
> direct access... just gotta add bank switching.

> >> - Anybody got a good fast text routine which I can use custom fonts
> >> with? Small fonts mostly, kinda like System from Windows..

> >You can try some fonts from my fontpage. There are large and small
> ones,
> >the smaller naturally being the faster ones.

> Don't the SMfonts require graph? I not think graph would interact well
> with my unit.. <G>

Well, the BGI-versions use Graph, the mode13h versions don't. Neither do
the VESA and Delphi-versions.

Regards,

Remco de Korte
Soft Machine

Re:HELP WITH VESA? PLEASE!!!!!!!!!!!!


Quote
>> Don't the SMfonts require graph? I not think graph would interact well
>> with my unit.. <G>

>Well, the BGI-versions use Graph, the mode13h versions don't. Neither do
>the VESA and Delphi-versions.

Delphi... gotta start saving up... for the first time in my life I'm
actually going to pay for software. <G> (Hey! I'm 15, okay? I just got
my first job, and I spent my allowance a year in advance to get this
damned computer 11 months ago!)

Anyway, I just thought I'd make a suggestion (if your not already
doing this in the VESA one):

Make a version in which the user can specify the pixel and color
routines.

i.e. have global variables in the unit: (this is all approximate and I
don't know how exactly it would work)

type
  pPixel(x, y: integer; color: byte);

var
  PixelProc: pPixel;

The user would then set PixelProc to point to their pixel procedure.
If they don't have a pixel procedure that matches this, they can add
one -- Should they use a global color variable, they can account for
that too.

i.e.

uses SMfont01, vesa;
{ vesa unit has global "col"or var, and PutPixel(x, y: integer) }
procedure SMpixel(x, y: integer; color: byte);
begin
  col := color;
  PutPixel(x, y);
end;

begin
  PixelProc := SMpixel;
  SetMode/InitGraph/Whatever
  ...
end;

--
Hilton Janfield --/-- val...@bcgroup.net --\-- darkfire productions
ICQ UIN: 7107014

I get knocked down, but I get up again, and your never gonna keep me down!

Re:HELP WITH VESA? PLEASE!!!!!!!!!!!!


Quote
On Sun, 15 Feb 1998, Hilton Janfield wrote:
> - Anybody have a good, free sound kit?
> Oh wait, I just remembered one that I liked, but can't remember what
> it was.. maybe somebody can help me.. the whole thing was MOD-based.

You can download such things from
ftp://x2ftp.oulu.fi/pub/msdos/programming/ (If I remember the URL
properly)

<snip>

Quote
> >> - During a SetPalette, using port $03C8 in assembler, for some reason,
> >> my palette entries are converted to EGA64 (6 bit) style - in other
> >> words, only 0..63 for R, G, and B, not 0..255. Obviously, this shoots
> >> my palette to HELL, and quite often back.

<snip>

The standard VGA RAMDAC only has 6-bit resolution for the R,G & B
levels... This allows for up to 256Kcolors. Only the HiColor-RAMDACs which
came later used the upper two bits but the special mode needs to be
enabled and it's support is not standard across all video cards... Until
then, divide your RGB values by 4 so that the range is from 0 to 63
instead of 0 to 255.

Quote
> >> - Anybody got a good circle routine? I need one which produces results
> >> like this: (o = pixel...:)
> >>   oooo                        oooooo
> >>  o    o                      oo    oo
> >> o      o  not like this:     o      o  Squared edges I not like.
> >> o      o                     o      o
> >>  o    o                      oo    oo
> >>   oooo                        oooooo

> >I don't know very much about it, but if you have a fast line routine you
> >might consider using a method where you calculate a limited number of
> >points on a circle and connect these. This way you can adapt the
> >'resolution' of the circle (number of points calculated) to your needs.

Ugh.. slow... There is a fast integer-based circle routine, I think it's
called a "Doros Circle" routine and it works in a similar way to the
Bresnham algorithm.. I don't have it's source at hand.

Quote
> >> - Anybody got a good ASM line? My current line works perfectly, but
> >> heck, ASM would be nice... :) (no squared angles! a diagonal line
> >> should look like this

Lots available - all generally based on the basic Bresnham's algorithm.
Many modern compilers will optimise the code well enough to eliminate the
need for coding it in assembler.

Quote
> >> - Anybody got a good fast text routine which I can use custom fonts
> >> with? Small fonts mostly, kinda like System from Windows..

> >You can try some fonts from my fontpage. There are large and small ones,
> >the smaller naturally being the faster ones.

> Don't the SMfonts require graph? I not think graph would interact well
> with my unit.. <G>

I have a unit somewhere which enables the use of the Windows .FON files in
a Pascal program... Wrote it ages ago - have to see if I could find it.

Regards,
        Antony.

ssu95...@reading.ac.uk

... There are four kinds of lies:
...   There are lies,
...     Damned lies...
...
...  And party political broadcasts.

[END]

Re:HELP WITH VESA? PLEASE!!!!!!!!!!!!


Re:HELP WITH VESA? PLEASE!!!!!!!!!!!!


In article: <34E6E9D5.E3A24...@xs4all.nl>  Remco de Korte <remco...@xs4all.nl>
writes:

Quote

>Hilton Janfield wrote:

[...]

Quote
>> Now, my problems: (The whole thing is designed for 640x480x256)

>> - During a SetPalette, using port $03C8 in assembler, for some reason,
>> my palette entries are converted to EGA64 (6 bit) style - in other
>> words, only 0..63 for R, G, and B, not 0..255. Obviously, this shoots
>> my palette to HELL, and quite often back.

This 6-bit per primary (18-bit video DAC) is a VGA thing, not an EGA thing,
which didn't have a DAC of any description.

Quote
>I might be mistaken, but I have seen no 256-colour modes where this was
>different. I don't know why that is. I even suspect that Windows
>256-color-mode fools you into thinking it has more than 64 shades. If
>you take a gray-scale picture I always feel there are greenish, blueish
>and reddish grays.

Many SVGA video cards support 8-bit per primary (24 bit DAC) video palettes, but
you have to use the appropriate VBE 1.2 function to switch it from the default
(backwards compatible) 18-bit mode.

-- Jay

 -----------------------------------------
| Jason Burgon - author of Graphic Vision |
| g...@jayman.demon.co.uk                   |
| http://www.jayman.demon.co.uk           |
 -----------------------------------------

Re:HELP WITH VESA? PLEASE!!!!!!!!!!!!


In article: <34e6affd.14867...@news.mag-net.com>  val...@bcgroup.net (Hilton

Quote
Janfield) writes:

>- This is my current pixel routine (which works PERFECTLY and WITHOUT
>A HITCH!).

Yes, I'm sure it does on YOUR machine. The tricky bit about writing a VESA VBE
client is making it work on all (or at least most) machines.

Quote
> Someone mind showing me how I might be able to convert it
>to assembler?

>procedure pixel(x, y: integer);
>var
>  p: longint; { Gotta stay as a longint thing.. 639*479 (the biggest
>pixel size possible in the mode I use) = 306,000, which don't quite
>fit in a word.. }
>  b: byte;  { Must stay as byte - for some reason, it wouldn't work if
>it was a word/integer, but worked 100% when I made it a byte... }
>begin
>  p := y * MaxX + x;  { function MaxX: word;  returns max X pixel }

MaxX should return the logical scanline length, as returned by VBE function 1
(GetModeInfo). This should be a variable (for speed) rather than a function.

Quote
>  b := p div 65536;
>  SetBank(b);           { This is already a good ASM routine.. could
>be inserted directly into the routine if needed }

Does your SetBank proceure take different window granularities into account?

Quote
>  p := p - (b * 65536);
>  mem[SegA000:p] := col;  { col is a global variable with the color }
>end;

procedure pixel(x, y: integer); assembler;
asm
        mov   ax,[Y]
        mul   [MaxX]    { MaxX must be a globally declared word variable }

{       DX:AX now contains the result of the unsigned multiplication }

        add   ax,[X]
        adc   dx,0

{       DX is now the 64k "bank", ax is the offset into the video segment }

        push  ax                { Save the video offset for later }

        push  dx                { Push the "Bank" argument to SetBank }
        call  SetBank

        pop   di                { DI is video segment offset }
        mov   es,[SegA000]      { ES:SI now points to the pixel at X,Y }
        mov   al,[Col]
        mov   [es:di],al        { Write the pixel }
end;

Quote
>- Anybody got a good circle routine? I need one which produces results
>like this: (o = pixel...:)
>- Anybody got a good ASM line? My current line works perfectly, but
>heck, ASM would be nice... :) (no squared angles! a diagonal line
>- Anybody got a good fast text routine which I can use custom fonts
>with? Small fonts mostly, kinda like System from Windows..

Yes thank you. All available in my Graphic Vision toolkit. You are welcome to
purchase a copy of it any time.

-- Jay

 -----------------------------------------
| Jason Burgon - author of Graphic Vision |
| g...@jayman.demon.co.uk                   |
| http://www.jayman.demon.co.uk           |
 -----------------------------------------

Re:HELP WITH VESA? PLEASE!!!!!!!!!!!!


Re:HELP WITH VESA? PLEASE!!!!!!!!!!!!


Quote
>You can download such things from
>ftp://x2ftp.oulu.fi/pub/msdos/programming/ (If I remember the URL
>properly)

Been a long time since I've been around x2ftp :) Should go visit Garbo
again now that you've reminded me... thanks! :)

Quote
>The standard VGA RAMDAC only has 6-bit resolution for the R,G & B
>levels... This allows for up to 256Kcolors. Only the HiColor-RAMDACs which
>came later used the upper two bits but the special mode needs to be
>enabled and it's support is not standard across all video cards... Until
>then, divide your RGB values by 4 so that the range is from 0 to 63
>instead of 0 to 255.

Aw shit. :) Could you maybe tell me how to enable this? I wouldn't
mind switching to 16 bit mode... would look a helluva lot nicer
anyway. :) And anybody with a meg of ram can do 640x480x64k.. anybody
with half a meg can do 640x480x256 tho.. ah well.

And if their card doesn't support it, it must be ages old... And
seeing as I got a good Jaton video card with a Cirrus Logic 5446 PCI
chip at it's heart with 1 meg of vram for only $40 CDN (which is
around $30 US), I can't think of much of a reason they wouldn't
upgrade anyway :)

And don't say the card sucks - theres only one problem with it, and
that is that when using codepage 850 (Multilingual), any
graphics-based program which tries to read the 8x16 RAM font from
memory (like SimCity Classic) will get garbage - fixed by editting
your autoexec.bat and adding/changing a couple simple MODE commands to
set your codepage to 437 or whatever it is (the north america
codepage)

Quote
>Ugh.. slow... There is a fast integer-based circle routine, I think it's
>called a "Doros Circle" routine and it works in a similar way to the
>Bresnham algorithm.. I don't have it's source at hand.

Doros.. I'll keep an eye out for it.

Quote
>> >> - Anybody got a good ASM line? My current line works perfectly, but
>> >> heck, ASM would be nice... :) (no squared angles! a diagonal line
>> >> should look like this

>Lots available - all generally based on the basic Bresnham's algorithm.
>Many modern compilers will optimise the code well enough to eliminate the
>need for coding it in assembler.

Like which one? :) I'm currently using TP7... any good free compilers
which will let me keep all my code and TPU's, AND MY ASM, and
hopefully offer a nice IDE to work in?
I wouldn't mind finding one which would give me easy access to Dword's
(unsigned 32 bit integers).

Quote
>I have a unit somewhere which enables the use of the Windows .FON files in
>a Pascal program... Wrote it ages ago - have to see if I could find it.

PLEASE! And does anyone have one with which I can use TTF files? :)

--
Hilton Janfield --/-- val...@bcgroup.net --\-- darkfire productions
ICQ UIN: 7107014

I get knocked down, but I get up again, and your never gonna keep me down!

Re:HELP WITH VESA? PLEASE!!!!!!!!!!!!


Re:HELP WITH VESA? PLEASE!!!!!!!!!!!!


In article <34e6affd.14867...@news.mag-net.com>, val...@bcgroup.net says...

Quote

>Greetings fellow Pascalonians. :) (yes, if you must know, I am weird;)

Hi

Have yo ever tried the VESA unit of Stefan from Rostock, Germany ?.

Im very satisfied with it. You can download it at Geocities:

http://www.geocities.com/SiliconValley/Bay/9553

The Vesa Unit is complete with sourcecode and you might change it for you
purposes.Furthermore he included some accerlation (?) routines for ATI and
Cirrus graphiccards.

Lars from Kiel, Germany

My homepage: http://www.geocities.com/Area51/Rampart/7527

Other Threads