www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/03/16/08:56:49

From: ao950 AT FreeNet DOT Carleton DOT CA (Paul Derbyshire)
Newsgroups: comp.os.msdos.djgpp
Subject: Re: DJGPP and stdprn
Date: 16 Mar 1997 11:54:41 GMT
Organization: The National Capital FreeNet
Lines: 41
Message-ID: <5ggn21$78l@freenet-news.carleton.ca>
References: <Pine DOT LNX DOT 3 DOT 95 DOT 970315162537 DOT 114B-100000 AT localhost>
Reply-To: ao950 AT FreeNet DOT Carleton DOT CA (Paul Derbyshire)
NNTP-Posting-Host: freenet5.carleton.ca
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp


2 possibilities come to mind.

One: your program has a subtle bug, like dereferencing an uninitialized
pointer or writing one unit past the end of an array (char x[6] allocates
6 chars char[0] thru char[5], but char[6] is not allowed) but these errors
can only be caught at runtime. Your previous compiler was "real mode":
these errors weren't trapped at runtime. However they may have managed to
be harmless. Of course if you have had weird crashes it might be your
program did fandango on core. DJGPP is "protected mode", which means these
bugs are trapped at runtime and the program exits gracefully. (As much so
as it can anyways.)

Secondly: You may be accessing some address in DOS memory directly. I.e.

int *com1=(int *)0x2f8;

or
(char *video=(char *)0xA0000;

These won't work in DJGPP, a side effect of the same error protection. You
must use farpoke and farpeek functions and selectors:

_farsetsel (_dos_ds);
_farpokeb (0x2f8,(unsigned char)my_byte);  (syntax?)
_farpokew (0xA0000+y*320+x,(unsigned short)my_word;
_farpokel (0x3e8+my_offset,(unsigned long)my_longword;

_dos_ds is a "selector" for accessing DOS conventional memory. I think a
header like dpmi.h or some such defines this.


(Since I'm not clear on the exact syntax here you might want to check it
out with info libc a _farpokeb or whatever.)

--
    .*.  Where feelings are concerned, answers are rarely simple [GeneDeWeese]
 -()  <  When I go to the theater, I always go straight to the "bag and mix"
    `*'  bulk candy section...because variety is the spice of life... [me]
Paul Derbyshire ao950 AT freenet DOT carleton DOT ca, http://chat.carleton.ca/~pderbysh

- Raw text -


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