www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/01/12/20:38:17

From: gpt20 AT thor DOT cam DOT ac DOT uk (G.P. Tootell)
Newsgroups: comp.os.msdos.djgpp
Subject: linear screen access under vbe2.00
Date: 12 Jan 1997 20:44:11 GMT
Organization: University of Cambridge, England
Lines: 39
Sender: gpt20 AT hammer DOT thor DOT cam DOT ac DOT uk (G.P. Tootell)
Message-ID: <5bbier$1j6@lyra.csx.cam.ac.uk>
NNTP-Posting-Host: hammer.thor.cam.ac.uk
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

im trying to write to a 65k screen mode using djgpp. i managed this quite easily
with the far pointer method, but it was slow so i decided to go for the nearptr
method instead. sadly i keep getting page faults and can't find the reason. can
anyone tell me where i've gone wrong..

thanks,
nik

---

code snippets and stuff...

#include <go32.h>
#include <dpmi.h>
#include <sys/nearptr.h>

__dpmi_meminfo mi;
unsigned long linear_address;
unsigned short *videoptr;

   VBE_detect();
   VBE_getModeInfo();
   setmode(0x4111);             // set 640x480x65k
   mi.size=614400L;		// 640x480x2 bytes long
   mi.address=modeinfo.PhysBasePtr;
   __dpmi_physical_address_mapping(&mi);
   linear_address=mi.address;
   videoptr=(unsigned short *)linear_address;

    __djgpp_nearptr_enable();
    videoptr[320+640*240+__djgpp_conventional_base]=0xffff;
    __djgpp_nearptr_disable();

which should plot a white dot in the centre of the screen - but crashes instead :(



-- 

- Raw text -


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