🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.os.msdos.programmer
Article #2814

Re: point to an address above 1M ?

#2814
From: Midn. John W. Fancher
Date: Fri, 28 Sep 1990 02:18
75 lines
4115 bytes
In article <1990Sep24.204400.26052@Octopus.COM> steve.resnick@f105.n143.z1.FIDONET.ORG writes:
>In article <14016@hydra.gatech.EDU> gb7@prism.gatech.EDU (Joe Bradley) writes:
>>
>>Can someone tell me how to set a pointer (in MS C) to an address above
>>1M? I have a video card which maps its video RAM into the PC address
>>space from 8M - 10M. I want to access video RAM directly, but I can't
>>initialize a pointer to this address range presumably because I only
>>have 16 bits of addressability with the segment portion of a huge pointer.
>>I don't see how you can point to a physical address above FFFF:FFFF ?!
>>I tried the following, but the compiler gives the error: "Constant too big."
>>
>>#define VIDEO_BASE 0x800000000
>>
>>main() {
>>    unsigned char huge *ram_p;
>>
>>    ram_p = ( unsigned char huge * )VIDEO_BASE;
>>}
>
>You can't do that without entering protected mode, or by some "hidden" 
>paging hardware on the video card. The FFFF:FFFF address is the top limit
>on a far pointer. That address cannot be reached, normally, unless the A20
>line is activated. 

   There is another way to get that high into extended memory space (
above 1M).
  
   I am assuming that you have a 286 based machine. (Since if you have 
a 386 then the problem is just a matter of using the chips 
extended memory mapping capabilities which is documented quite well.)

   First off, there is an "undocumented" instruction on the 286 called
LOADALL.  It was probably included for use for INTEL to test the chip
at the factory.  It has the special ability to, in one instruction, set
every single register on the 286, even some that you didn't know existed.
To say the least, it is a very complicated touchy problem.  It requires
setting up a table for this instruction to read and do the appropriate
changes to the chip.  

   The important part of this instruction is that it gives you access to 
the segment register discriptor cache registers.  These registers actually
define what PHYSICAL address (full 24 bit) the segment registers really 
want to look at.  When you load the DS segment register with an address, the
address is expanded to 24 bits and copied to the SRDCs.  Since with the 
LOADALL instruction you can change these SRDCs independent of the segment
registers then you can tell them to point anywhere in the 16M addressing
space of the 286.  

    However, there are more pitfalls to using this method than you can wave
a floppy disk at.  These are too numerous to list here.  These problems 
have nothing to do with being or not being in protected mode.  This method
can be used in real mode or protected mode equally.  

    There is a company that has software libraries and documentation for
sale and some at a shareware type of deal to entice you to get the whole
package.  
	The company is:

			Semi-Intelligent Systems
				PO BOX 4492
			ALBUQUERQUE, NM 87196

    They produce the HYPER-SPACE NAVIGATOR'S GUIDE which talks about all
sorts of neat tricks of using LOADALL and accessing extended memory.  The
last I remember the whole book and included software cost about $40-$50.


I hope this helps....

John W. Fancher

----------------------------------------------------------------------------
--	Me?  I said that?  You must be joking.  I can't even balance my   --
--	checkbook.                                                        --
----------------------------------------------------------------------------
Technical Details
Message-ID: <337@usna.NAVY.MIL>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!mailrus!cs.utexas.edu!uunet!usna!m912208
References: <14016@hydra.gatech.EDU> <1990Sep24.204400.26052@Octopus.COM>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!mailrus!cs.utexas.edu!uunet!usna!m912208
From: m912208@usna.NAVY.MIL (Midn. John W. Fancher)
Newsgroups: comp.os.msdos.programmer
Subject: Re: point to an address above 1M ?
Summary: There are other ways!
Keywords: Extended Memory
Message-ID: <337@usna.NAVY.MIL>
Date: 28 Sep 90 02:18:28 GMT
References: <14016@hydra.gatech.EDU> <1990Sep24.204400.26052@Octopus.COM>
Reply-To: m912208@cad.usna.mil.UUCP (Midn. John W. Fancher (912208) <m912208@usna.navy.mil>)
Distribution: usa
Organization: U.S. Naval Academy, Annapolis
Lines: 75