
4.4 P E E K I N G A N D P O K I N G T H E 68000
The Message-Based Interface allows the user t o "poke" and "peek" words and bytes
to/from any location within the 68000's address space. T h e intent of these commands is
to allow the user to exercise
I/O
ports and circuitry. T h e adventurous Message-Based
Interface user will soon realize that programs can be "poked" uncommitted R A M or the
user global area. T h e following C program illustrates this point. I t will endlessly toggle
a selected bit of a specified I/O port. It's intended to be run from the command line of the
host system. I t "pokes" a simple loop into the beginning o f the user global area, and
selects this simple routine as the "application parser" to be repeatedly called.
#include <stdio.h>
#include <ctype.h>
extern void exit(int);
/* loop
* /
/* each elem = "Ox" + 4 hex N U L L * /
char Instrs[][6+11 =
"0x207c", / * movea.1 #<address>, a0
"" , I* upper 16 address bits * /
" , /* lower 16 address bits * /
"0x70ff", / * moveq #-1, dO ; 64K loop iters
"Ox1210", / * move.b (a0), d l * /
"0x0841", 1* bchg #<bitnum>, d l * /
"" , /* bit to toggle * /
"Ox1081", / * move.b d l , (a0) * /
"0x51c8", / * d b f dO, loop * /
"0xfff6", / * offset back to 'loop' label * /
"0x4e75", / * its * /
* 1
#define N U M _ I N S T R U C T I O N S (sizeof(Instrs)/(6+1))
void pokeNrunToggleBitCocie unsigned long addr,unsigned bitnum)
char buf[100];
int i, ud;
const unsigned long targaddr = 0x00401000L;
unsigned upper, lower;
ud = ibfind ("VXITECH");
upper = ((addr & 0xffff0000L) >> 16);
lower = ( a d d r & Ox0000ffffL);
sprintf(&Instrs(11, "Ox%.4x", upper);
sprintf(&Instrs[2], "Ox%.4x", lower);
4-11
Summary of Contents for 7064
Page 2: ...Racal Instruments...
Page 6: ...I 1 1 1 1 1...
Page 21: ...I 1 I I I I I I I I I 1 1 I I I I I I...
Page 29: ...I I I I I I I I I I I I I I I I I I I...
Page 57: ...1 I I I I I I I I I I I I I I I I I I...
Page 77: ...1...
Page 111: ...0 00 0 00 tI I 4 0 0 I7 r i 6 4 7 4 7 0 T 6 0 0 7 28...
Page 112: ......
Page 113: ...7 30 I I I 1 I I I I I I I I I I I I I I I...
Page 115: ...7 32...
Page 148: ......
Page 164: ...I I I I I I I I I I 1 I I I I I I I I...
Page 176: ...extern char error_msg_lookup unsigned errdes endif ERROR_INCLUDE C 8...