From: "Max Erhard" Newsgroups: comp.os.msdos.djgpp References: Subject: Re: beginner mode13 question Lines: 75 X-Newsreader: Microsoft Outlook Express 4.72.3110.1 X-MimeOLE: Produced By Microsoft MimeOLE V4.72.3110.3 Message-ID: Date: Sat, 19 Dec 1998 15:06:19 -0000 NNTP-Posting-Host: 194.119.176.183 X-Complaints-To: news AT u-net DOT net X-Trace: newsr2.u-net.net 914080048 194.119.176.183 (Sat, 19 Dec 1998 15:07:28 BST) NNTP-Posting-Date: Sat, 19 Dec 1998 15:07:28 BST Organization: (Posted via) U-NET Internet Ltd. To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Reply-To: djgpp AT delorie DOT com I have now found the nearptr.h file, I had an old djdev.zip file. I would still be pleased for any general help etc. Max Erhard wrote in message ... >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 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 >#include >#include > >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(); >} > > >