Mail Archives: djgpp/1998/12/19/11:47:44
I won't tell you how to do it because I haven't done it myself, but I
read this great article that shows you how to initiate mode 13h,
change the palete, and plot pixels. The best thing is its centered
toward DJGPP and the examples are all for DJGPP. Its really
helped me understand mode 13h and I would be confident to try
and do it myself now that I have read it. The biggest thing that blew
me away was it talks about mode 13h for DJGPP. Its so hard to
find documents like that. And the best thing is it was written
recently. Well I will stop telling you why you should read it, and let
you see for yourself. I hope this helps. If anyone has any articles or
web address that talk about DJGPP specifically please email them
to the list so I can learn more. Thank you.
http://www.gameprog.com/graphics.htm
-- scroll down and you will see the header and 3 links below:
Mode 13h
The Video Mode 13h by Nathan Vegdahl
The Color Palette
Plotting Pixels
From: "Max Erhard" <erhard AT banstead DOT u-net DOT com>
Subject: beginner mode13 question
Date sent: Sat, 19 Dec 1998 14:29:22 -0000
Organization: (Posted via) U-NET Internet Ltd.
To: djgpp AT delorie DOT com
Send reply to: djgpp AT delorie DOT com
> I am having trouble getting mode13 programs to work. Plotting pixels using
> bios interupts works OK. But as soon as I try to directly address the video
> memory, I start to get horrible GPFs. I have tried A000, A0000 and A0000000
> as the address for video memory but no luck. I have read about special
> commands for near pointers or something but they need <sys/nearptr.h> and I
> do not have this file in my /include/sys folder, only farptr.h. Also is
> there a memory model setting for gcc that I need to know about.
>
> Errors look like this:-
>
> General Protection Fault at eip=211
> eax=00000001 ebx=00051d00 ecx=000a0141 edx=000a0141 esi=00000000
> edi=00000000
> ebp=00051d50 esp=00051d4c cs=bf ds=b7 es=b7 fs=b7 gs=b7 ss=c7 cr2=00001fec
> Call frame traceback EIPs:
> 0x00000211
> 0x00000285
>
> My code is:- (which should make a rainbow of all of the 256 colours on
> screen.)
>
> #include <stdio.h>
> #include <bios.h>
> #include <dos.h>
>
> int a;
> int dx;
> int dy;
> unsigned char *VGA=(unsigned char *)0xA0000L;
>
> void set_mode13()
> {
> union REGS regs;
> regs.h.ah = 0x00;
> regs.h.al = 0x13;
> int86(0x10,®s,®s);
> }
>
> void set_textmode()
> {
> union REGS regs;
> regs.h.ah = 0x00;
> regs.h.al = 0x03;
> int86(0x10,®s,®s);
> }
>
> void plot_pixel(int x, int y, int colour)
> {
> VGA[y*320+x]=colour;
> }
>
> void main ()
> {
> set_mode13();
> for(a=0;a<=256;a+1)
> {
> for(dx=1;dx<=320;dx++)
> {
> for(dy=1;dy<=200;dy++)
> {
> plot_pixel(dx,dy,a);
> }
> }
> }
> set_textmode();
> }
>
>
>
>
-Michael
- Raw text -