delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2000/08/10/08:09:43

From: "ClaudioF" <mpolve AT tin DOT it>
Newsgroups: comp.os.msdos.djgpp
Subject: memset etc.
Date: Thu, 10 Aug 2000 13:12:55 +0200
Organization: TIN
Lines: 51
Message-ID: <8mu28b$202$1@nslave1.tin.it>
NNTP-Posting-Host: a-bn4-41.tin.it
X-Trace: nslave1.tin.it 965905483 2050 212.216.192.104 (10 Aug 2000 11:04:43 GMT)
X-Complaints-To: newsmaster AT tin DOT it
NNTP-Posting-Date: 10 Aug 2000 11:04:43 GMT
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 5.00.2014.211
X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2014.211
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

Sorry I'm newbie. I've a little problem with a code I've ported from Watcom:
"General Protection Fault at eip=00002e95 etc. etc."

Here's the code. It writes with memset() to the video memory:

 #include <stdio.h>
#include <dos.h>

void Set_Text_Mode (void)
 {
  union REGS registers;

  registers.h.ah = 0x00;
  registers.h.al = 0x03;
  int386 (0x10, &registers, &registers);
 }

void Set_Vga_Mode (void)
 {
  union REGS registers;

  registers.h.ah = 0x00;
  registers.h.al = 0x13;
  int386 (0x10, &registers, &registers);
 }

void PutPixel (int x, int y, char color)
 {
  unsigned char *ScreenPointer;

  ScreenPointer = (unsigned char *) 0x0a0000;
  memset (ScreenPointer+(x + (y*320)), color, 1);              //  Here's
the problem. I can't resolve it
 }

void main (void)
 {
  Set_Vga_Mode ();
  PutPixel (160, 100, 150);
  getch();
  Set_Text_Mode ();
 }



Thanks at all.
ByeZ




- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019