#Opps!
This message turned up in search, but its forum couldn’t be identified from the original transcript, so it may not be linked into its thread.
Hi Bela. Your code looks like it will work (in Aztec where int == word), but
your routines are pretty scummy, even for C code. You are assuming that all
pointers are stored in a long (and in the Amiga you are right), but it is
better to avoid assumtions, and coerce the pointer in the call (it's usually
a compile-time function anyway), so that the values passed on the stack are
known to be of the correct length. What I'm trying to say looks like this:
char peek(address)
char *address;
{
return *address;
}
and
void poke(address,value)
char *address, value;
{
*address = value;
}
To be called by:
c = peek( (char *)num); or poke( (char *)num, c);
This makes sure that the correct value length (for a pointer) is passed onto
the stack without assumptions. However, the routines are SO simple, that
they should probably be code macros or inline code. Like:
#define pokew(ptr,x) ((short *)ptr = x)
#define peekl(ptr) ((long *)ptr)
(notice the lack of semi-colons in the definitions, since they are supplied
in the actual code they are substituting into. The extra parens help to keep
the item well grouped in any type of code). I hope at least some of this was
useful. –Wayne