www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/09/14/22:37:39

From: "Andreas Björk" <97andbj AT ostrabo DOT uddevalla DOT se>
Newsgroups: comp.os.msdos.djgpp
Subject: Problem with virtual screens in mode 0x13
Date: Sun, 14 Sep 1997 21:15:24 +0200
Organization: Algonet/Tninet
Lines: 86
Message-ID: <341C37CC.C1EAE070@ostrabo.uddevalla.se>
NNTP-Posting-Host: du206-97.ppp.algonet.se
Mime-Version: 1.0
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

When i try to compile this code below everythin is ok...  only one
warning which says:

D:\DJGPP\prj>gxx test.cpp -o test.exe
test.cpp: In function `void copybuffer()':
test.cpp:23: warning: passing `unsigned char *' to argument 3 of
`dosmemput(cons
t void *, long unsigned int, long unsigned int)' lacks a cast

and when i try to run it i get this error:

Page fault at eip=00006c49, error=0006
eax=00000000 ebx=ffee7140 ecx=00003e80 edx=000b8fff esi=000a0000
edi=006fd004
ebp=006fcf94 esp=006fcf84 program=D:\DJGPP\PRJ\TEST.EXE
cs: sel=00af  base=82885000  limit=ffef4fff
ds: sel=00b7  base=82885000  limit=ffef4fff
es: sel=00c7  base=00000000  limit=ffffffff
fs: sel=0087  base=00025220  limit=0000ffff
gs: sel=00c7  base=00000000  limit=ffffffff
ss: sel=00b7  base=82885000  limit=ffef4fff

Call frame traceback EIPs:
  0x00006c49
  0x00005a2a
  0x00001585
  0x00001679
  0x00001c1a

Here is the source for program.
#include <go32.h>
#include <sys/movedata.h>
#include <conio.h>
#include <stdio.h>
#include <mem.h>
#include <stdlib.h>
#include <dpmi.h>

unsigned char *buffer=(unsigned char *)malloc(64000);

char *video=(char *)0xa0000;

void done()
{
  free (buffer);
}
void copybuffer()
{
  dosmemput(video,64000,buffer);
}

void setmode(int mode)
{
  __dpmi_regs r;
  r.x.ax=mode;
  __dpmi_int(0x10, &r);
}

void putpixel(int x, int y ,char c)
{
  video[(y<<6)+(y<<8)+x]=c;
}

void main()
{
  setmode(0x13);

  for(int x=0;x<320;x++) {
    for(int y=0;y<320;y++) {
      putpixel(x,y,rand()%16+16);
    }
  }
  copybuffer();

  while(!kbhit());
  getch();
  done();
  setmode(0x3);
}

---------------

Can anyone please help me...
I have read everything availabe to read about graphics programming in
DJGPP..

- Raw text -


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