ack/lang/basic/lib/peek.c

25 lines
328 B
C
Raw Permalink Normal View History

#include "lib.h"
1984-11-29 14:22:02 +00:00
2016-12-12 20:15:25 +00:00
int peek(int addr)
1984-11-29 14:22:02 +00:00
{
/* this can not work properly for machines in which the
POINTERSIZE differs from the integer size
*/
char* p;
1984-11-29 14:22:02 +00:00
int i;
p = (char*)addr;
i = *p;
1984-11-29 14:22:02 +00:00
#ifdef DEBUG
printf("peek %d = %d\n", addr, i);
1984-11-29 14:22:02 +00:00
#endif
return (i);
1984-11-29 14:22:02 +00:00
}
2016-12-12 20:15:25 +00:00
void _poke(int i, int j)
1984-11-29 14:22:02 +00:00
{
char* p;
p = (char*)i;
*p = j;
1984-11-29 14:22:02 +00:00
}