#ifndef _MACHINE_H_e5d18aee_ #define _MACHINE_H_e5d18aee_ /* This file is in the public domain. */ typedef unsigned long int ADDR; typedef unsigned char CFLAG; /* Changing semantics of existing values will break old save files. */ #define CF_NULL 0 #define CFO_INST 1 /* obsolete */ #define CFO_PINST 2 /* obsolete */ #define CF_BYTE 3 #define CF_WORD 4 #define CF_LONG 5 #define CF_PREV 6 #define CF_CHAR 7 #define CF_STR 8 #define CF_SPC 9 #define CF_PTR 10 #define CF_CHUNK 11 #define CF_CPREV 12 #define CF_SBLK 13 #define CF_CSTR 14 /* 15 is free */ #define CF_INST 16 /* through 31 */ #define CFF_INST_PARALLEL 1 #define CFF_INST_PTRLITS 2 #define CFF_INST_MS1 4 #define CFF_INST_MS2 8 #define CFF_INST 15 #define CF_MSPEC 0x40 #define ISINST(x) (((x)&~CFF_INST)==CF_INST) #define ISPREV(x) (((x)==CF_PREV)||((x)==CF_CPREV)) typedef struct win WIN; typedef struct line LINE; typedef struct note NOTE; typedef struct dpos DPOS; typedef struct symbol SYMBOL; typedef struct machine MACHINE; typedef struct coloncmd COLONCMD; typedef struct annotation ANNOTATION; /* * DLT_NOSUCH: A nonexistent line (eg, before corebase). No other * fields are used. * * For all others: laddr is the address of the line. ann is the * annotation attached to it, or nil if none. * * DLT_ON: u.addr is the address, which may be != laddr if the location * is within a multi-byte line; u.aoff is u.addr minus corebase. * * DLT_BEFORE, DLT_AFTER: ann must not be nil. u.alno is the line * number within the before or after note of the annotation; it must * be >= 0 and <= the ann->before->nlines or ann->after->nlines, as * the case may be. * * DLT_LEGACY: just like DLT_NOSUCH except it indicates a location * synthesized when reading in a legacy savefile. This can appear in * a comparatively restricted set of places. */ struct dpos { int type; #define DLT_NOSUCH 1 #define DLT_ON 2 #define DLT_BEFORE 3 #define DLT_AFTER 4 #define DLT_LEGACY 5 ADDR laddr; ANNOTATION *ann; union { struct { /* DLT_ON */ ADDR addr; ADDR aoff; } on; int alno; /* DLT_BEFORE, DLT_AFTER */ } u; } ; struct note { int nlines; int alines; char **text; } ; struct annotation { ADDR addr; NOTE *before; NOTE *on; NOTE *after; } ; struct win { WIN *flink; WIN *blink; int firstline; int lastline; DPOS top; int redraw; } ; struct line { int type; #define LT_BLANK 1 #define LT_DIS 2 #define LT_CURDIS 3 #define LT_MODE 4 #define LT_CURMODE 5 DPOS loc; /* used only for DIS and CURDIS */ int flags; #define LF_REDRAW 0x00000001 } ; struct symbol { char *name; ADDR addr; } ; struct coloncmd { const char *cmd; void (*handler)(void); } ; struct machine { const char **names; unsigned int ptrsize; void (*init)(void); int (*cmd)(char); int (*dis)(ADDR, void (*)(char)); unsigned long int (*corefetch)(const void *, int); const COLONCMD *coloncmds; } ; extern MACHINE *machines[]; extern int nmachines; extern unsigned long int coresize; extern ADDR corebase; extern ADDR coreend; extern DPOS loc; extern CFLAG *flags; #undef getstr /* grrr */ #define getstr getstr_ /* double grr */ extern int getstr(const char *, char **, char **); extern DPOS locaddr(ADDR); #define locoff(a) locaddr((a)+corebase) extern DPOS loc_upline_nosuch(DPOS); extern DPOS loc_dnline_nosuch(DPOS); extern DPOS loc_upline_stop(DPOS); extern DPOS loc_dnline_stop(DPOS); extern SYMBOL *symbol_for_addr(ADDR); extern ANNOTATION *annotation_for_addr(ADDR); extern long int corefetchs(ADDR, int); extern unsigned long int corefetchu(ADDR, int); extern int checkchange(void); extern int changecur_(void); extern void disas_beep(void); extern void disas_redraw_cur(void); extern void print_symbol_or_hex(void (*)(char), ADDR); extern void maybe_print_stringptr(void (*)(char), ADDR); extern void maybe_print_ptrlit(void (*)(char), unsigned long int); #define PQS_TONUL (-1) #define PQS_CFPREV (-2) #define PQSF_NOQUOTES 0x00000001 extern int print_quoted_string(void (*)(char), ADDR *, int, int, unsigned int); #endif