/* bp.c Breakpoint handling bp NUMBER set ADDRESS set break at address bp NUMBER rem bp NUMBER dis disable break bp NUMBER en enable break bp clear clear all bp:s bp show bp:s */ #include "defs.h" #define BPOPCODE 0xBE00 // BKPT #0 typedef struct bp_entry{ unsigned short * address; unsigned short opcode; /* 16 bits of opcode */ char active; }BP_ENTRY; static struct bp_entry bp_tab[MAXBP]; /* peek/poke are used to insert and remove BP opcodes */ #define peek( x ) *((unsigned short *)(x)) #define poke( x , y) (*((unsigned short *)(x)) = y) void atbreak() { smallprintf( "\nBREAKPOINT:\n%X ",alregs.pc); Instruction( alregs.pc, 1 ); } void inibp( void ) /* called from "init" */ { static int valbp; /* "magic" flag, for reset clear of BP-tab */ int i; if(valbp==0x7322) return; /* bp_table already cleared */ for(i=0;i