🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.sys.ibm.pc
Article #9256

Re: Direct memory access in Turbo C

#9256
From: Robert Adsett
Date: Wed, 24 Jan 1990 23:35
35 lines
1787 bytes
In article <3181@plains.UUCP> bakke@plains.UUCP (Jeff Bakke) writes:
>In article <25b6a0d3:4290comp.sys.ibm.pc@vpnet.UUCP> msm@vpnet.UUCP (Matt Minogue) writes:
>>
>>     I am a fairly new C programmer, just converting from Pascal.  I need to
>>access screen memory at 0xb800 ... in Pascal I would use the array MemW[],
>>but I can't seem to find a function in my Turbo C library to do this.  Any
>>help appreciated...
>
>Its a lot simpler to do in C than in Pascal.  Simple do this...
>set up a pointer to 0xB800 by
>
>unsigned int *display;
>( or if you need byte size access )
>unsigned short int *display;
 
  Nope.
      1) a short int is not byte sized it's word sized
      2) To work in all models it should be a far pointer
      3) the pointer is not initialized so it does not point at display
         memory

  It should be something like:

#include <dos.h>

unsigned char far *display = MK_FP( 0xb800, 0);
   
   Also take a look at gettext, puttext, movetext, getimage and putimage.
They may already do what you want and you won't have to develop all the device
specific code yourself.  TC also has a set of routines that write directly
to the screen.
 
--
		Robert Adsett  <semicon@watsci.UWaterloo.ca>
		Dept. of Phys, Univ. of Waterloo, Waterloo Ont. Canada
Technical Details
Message-ID: <727@watserv1.waterloo.edu>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!watserv1!watsci!semicon
References: <25b6a0d3:4290comp.sys.ibm.pc@vpnet.UUCP> <3181@plains.UUCP>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!watserv1!watsci!semicon
From: semicon@watsci.uwaterloo.ca (Robert Adsett)
Newsgroups: comp.sys.ibm.pc
Subject: Re: Direct memory access in Turbo C
Message-ID: <727@watserv1.waterloo.edu>
Date: 24 Jan 90 23:35:49 GMT
References: <25b6a0d3:4290comp.sys.ibm.pc@vpnet.UUCP> <3181@plains.UUCP>
Sender: daemon@watserv1.waterloo.edu
Reply-To: semicon@watsci.UUCP (Robert Adsett)
Organization: University of Waterloo, Waterloo Ontario, Canada
Lines: 35