delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2000/12/05/15:27:46

From: "Alex Oleynikov" <alex AT compuweigh DOT com>
To: <djgpp AT delorie DOT com>
Subject: RE: Mapping a data structure into DOS memory space
Date: Tue, 5 Dec 2000 15:20:33 -0500
Message-ID: <NEBBKABEDKFPFBKEMBFOAEEOCAAA.alex@compuweigh.com>
MIME-Version: 1.0
X-Priority: 3 (Normal)
X-MSMail-Priority: Normal
X-Mailer: Microsoft Outlook IMO, Build 9.0.2416 (9.0.2910.0)
In-Reply-To: <3a2d42da$0$35011$6d6c75b@news.execpc.com>
X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4522.1200
Importance: Normal
Reply-To: djgpp AT delorie DOT com
Errors-To: nobody AT delorie DOT com
X-Mailing-List: djgpp AT delorie DOT com
X-Unsubscribes-To: listserv AT delorie DOT com

>How about this:


>#include <stdio.h> /* printf() */
>#include <sys/nearptr.h> /* __djgpp_conventional_base,
__djgpp_nearptr_enable() */
>#include <crt0.h> /* crtNNN */

>typedef unsigned char   u8;
>typedef unsigned short  u16;
>typedef unsigned long   u32;

>struct nvram_struct
>{
>        volatile u8 byte        __attribute__((packed));
>       volatile u16 word       __attribute__((packed));
>        volatile u32 dword      __attribute__((packed));
>};

Thanks, Chris
Actually, this is the most appropriate way to do it.

- Raw text -


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