delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1995/05/05/06:00:34

From: "A.Appleyard" <A DOT APPLEYARD AT fs2 DOT mt DOT umist DOT ac DOT uk>
To: DJGPP AT SUN DOT SOE DOT CLARKSON DOT EDU
Date: Fri, 5 May 1995 08:31:02 BST
Subject: Text screen address: 0xb8000 or 0xb0000?

  Sometimes the text screen address is 0xb0000, sometimes it is 0xb8000. At
the moment I find that this works:-
    c_short_addr textscreen((int)ScreenPrimary&0xfffff);
    c_byte_addr gscreen(0xa0000);
  (c_byte_addr, c_byte, c_short_addr, c_short, are class types to handle
real-mode-address values that I wrote; they are defined hereinunder.)

  The question is: when v2 comes in, having no go32, PLEASE supply an easy way
for the program to tell whether the (text screen in whatever PC it is running
on at the time) is at 0xb0000 or 0xb8000. One way would be to keep the
existing library preset variable ScreenPrimary.

#define uns unsigned
/*-----*/
class c_byte_addr; class c_short_addr;
/*-----*/
class c_byte {public: uns int addr;
inline c_byte_addr&adr();
inline void operator=(char c){dosmemput(&c,1,addr);};};
/*-----*/
class c_byte_addr {public: uns int addr;
inline c_byte_addr(uns int Addr=0){addr=Addr;};
inline c_byte operator[](int i){c_byte x; x.addr=addr+i; return x;};};
/*-----*/
class c_short {public: uns int addr;
inline short(){short c; dosmemget(addr,2,&c); return c;};
inline short val(){short c; dosmemget(addr,2,&c); return c;};
inline uns short operator=(short c){dosmemput(&c,2,addr); return c;};};
/*-----*/
class c_short_addr {public: uns int addr;
inline c_short_addr(uns int Addr=0){addr=Addr;};
inline c_short operator[](int i){c_short x; x.addr=addr+2*i; return x;};};

- Raw text -


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