WARNING - not in comments so won't compile as-is.

This is the skeletal program used to create PEEKPOKE.S 
IT is NOT intended to be used in a program...

it was made to give a template for peeks and pokes... 

the file is compiled with the -S option to make the CC produce an assembler version of this file

then the assembly file is edited to replace the data accesses via the pointer 
with a special emulator only instruction that accessess memory while bypassing the MMU.

see peekpoke.s


char peakb (paddress)
  char *paddress;
{
  register char data;
  register char *address;

  address = paddress;

  data = *address;

  return (data);
}

short peakw (paddress)
  short *paddress;
{
  register short data;
  register short *address;

  address = paddress;

  data = *address;

  return (data);
}

int peakl (paddress)
  int *paddress;
{
  register int data;
  register int *address;

  address = paddress;

  data = *address;

  return (data);
}

void pokeb (paddress,pdata)
  char *paddress;
  char pdata;
{
  register char data;
  register char *address;

  address = paddress;

  data = pdata;

  *address = data;
}
