Date : Tue, 23 Aug 1994 09:34:06 EST
From : Stephen Quan <quan@...>
Subject: Re: xbeeb updated on ftp.pipex.net
> James Bonfield wrote:
>
> > Tim M. writes:
> >
> > >The 'problem' is that Config.h assumes it is on a litle endian
> > >machine, and defines LITTLE_ENDIAN. This breaks ReadWordAtPC on big
> > >endian machines. However you do mention in the INSTALL file that the
> > >LITTLE_ENDIAN flag may have to be changed. It might be worth putting
> > >in a little bit more detail so that more people notice it....
> >
> > Even on a little endian machine (Alpha) defining LITTLE_ENDIAN broke
> > things for me!
What I have in my emulator (in C), is the following typedef's
typedef unsigned char byte;
typedef unsigned short word;
This defines 8-bit and 16-bit storage classes.
To allow for MS-DOS support (Borland C), I have typedef and #defines
in my bbc_defs.h module, listed below. By using these types I can
freely move my code between UNIX and DOS and worry less about the
64K boundaries (I only partially slow the problem).
> #ifndef BBC_DEFS_H
> #define BBC_DEFS_H
>
> #ifdef _DOS_
> /* The IBM-PC has unusual ways for using memory beyond 64K. */
> #include <alloc.h>
> #define Malloc farmalloc
> #define Free farfree
> #define charfar char far
> #define shortfar short far
> #define charptr char far *
> #define shortptr short far *
> #define byte unsigned char
> #define word unsigned short
> #define bytefar unsigned char far
> #define wordfar unsigned short far
> #define byteptr unsigned char far *
> #define wordptr unsigned short far *
> #endif
>
> #ifdef _UNIX_
> /* UNIX versions of the macros. */
> #include <stdlib.h>
> #define Malloc malloc
> #define Free free
> #define charfar char
> #define shortfar short
> #define charptr char *
> #define shortptr short *
> #define byte unsigned char
> #define word unsigned short
> #define bytefar unsigned char
> #define wordfar unsigned short
> #define byteptr unsigned char *
> #define wordptr unsigned short *
> #endif
>
> #endif
With the above #define, a 64K memory allocation is possible
memory = (byteptr *) Malloc(0x10000);
And I can define far compatible arrays
bytefar osrom[0x4000];
However, this does not completely oblitherate the 64K boundary, as
the following is not legal.
bytefar memory[0x10000];
The compiler rejects it, eventhough I am able to allocate this memory
at run-time.
--
Stephen Quan (quan@... ), SysAdmin, Analyst/Programmer.
Centre for Spatial Information Studies, University of Tasmania, Hobart.
GPO BOX 252C, Australia, 7001. Local Tel: (002) 202898 Fax: (002) 240282
International Callers use +6102 instead of (002).