⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 bom.h

📁 8051编程例子讲解 一些基本使用方法通过例子有详细说明
💻 H
📖 第 1 页 / 共 5 页
字号:
extern void   CreaWatch (IRX *pX);
extern WORD16  AsnWatch (char *exp, int nLen); // Assignment via WatchVw
extern WORD16 WatchCalc (EXP *ep, char *pB);
extern ZBK     *WaScope (DWORD nAdr);          // DasmFox.c
extern LIN    *FindLine (DWORD nAdr);          // search for Line

extern void      VaShow (char *pVar, WORD16 nIndex);
extern void       VaSet (char *pVar, WORD16 index1, char *pVal, WORD16 index2);
extern void     VaReset (char *pVar, WORD16 index);
extern void   InitLpath (char *name);

extern void    DoLogSet (int nMode, char *name, WORD16 index);
extern void   DoInclude (char *name, WORD16 index);
extern void       GoCmd (EXP *e1, EXP *e2);
extern void      DoStep (int type, EXP *ep);
extern EXP     *CalcAdr (EXP *ep);

extern void      SetBrk (EXP *ep, int ndx, int acc);
extern void       DlgBp (struct BpBlk *pB);     // create Dialog Bp
extern void      LstBrk (void);
extern void      BpComm (int nCode, EXP *ep);

extern void      PaDisp (void);        // list PA items
extern void      PaKill (EXP *ep);     // kill all or given PA items
extern void       PaDef (int ndx, EXP *e1, EXP *e2);


extern void     dirsym (void);                  // dir syms of current block
extern void     dirQua (SQUAL *sq, BYTE lines); // syms/lines of given module
extern void     dirlin (void);                  // dir lines of current module
extern void     dirpbs (void);                  // dir publics
extern void     dirioc (void);                  // dir VtRegs
extern void     dirmod (void);                  // dir modules
extern void    dirdsym (void);                  // dir 'define type id' symbols
extern void     dirfnc (int nSel);              // dir functions
extern void   dirScope (SQUAL *sq);             // display scope

extern WORD16   RunCmd (char *cmd, int nLen);
extern void    BootExp (void);

extern void     ClrExp (void);
extern EXP  *UpNodeTop (EXP *ep);            // NodeFox.c
extern void    DumpExp (EXP *ep);            // PriFox.c






//--- Show/Set/Reset env-vars:

#define  VST   struct vset
struct vset  {
  char    name [14];                               // name of env-var
  void    (*sfc) (VST *pV, char *pS, WORD16 ndx);  // 'set' function
  void    (*xfc) (VST *pV);                        // 'show' function
  void    (*rfc) (VST *pV);                        // 'reset' function
  int     which;
};

struct szPAT  {                // search path list
  struct szPAT  *next;
  char          *text;
};


/*
 * CALL-Stack
 */

struct calstk  {
  DWORD      caller;      // callers opcode address
  DWORD      callee;      // called address
  DWORD          sp;      // stack pointer value before call
  DWORD       nextA;      // instruction after Call
  BYTE        icall;      // indirect call mark
};
#define CSTK      struct calstk
#define MAXCSTK   256




/*
 * Performance Analyzer
 */

struct pa  {
  struct pa     *next;     // next PA range
  struct pa     *prev;     // prev PA range
  DWORD         entry;     // PA-Range entry address
  DWORD          exit;     // PA-Range exit address
  DWORD        icount;     // Invocation count
  UINT64          cyc;     // cycles of last measure
  UINT64       mincyc;     // minimum cycles (for average)
  UINT64       maxcyc;     // maximum cycles (for average)
  UINT64       totcyc;     // total cycles of PA-Range
  WORD16         Slot;     // Slot-Number
  char         *ptext;     // PA-Expression
  int            nLen;     // Length of PA-Expr. Text
  int          Extent;     // Extent from GetTextExtent ...
//float        spcent;     // Percent on Screen
  float        cpcent;     // current Percent

  BYTE           type;     // 1:=FuncPA, 0:=RangePA
  BYTE     active : 1;     // active bit
};

struct past  {             // used for PA-Runtime-Stack
  UINT64      ecyc;
  DWORD     paexit;        // for PA entry,  return address, otherwise 0
  struct pa    *pa;
};

#define  PA      struct pa
#define  PAST    struct past
#define  PADEP   256
#define  RPAT    0         // Range-PA
#define  FPAT    1         // Function-PA Range

extern void    PaDef (int ndx, EXP *e1, EXP *e2);
extern void   PaKill (EXP *ep);
extern void   PaDisp (void);
extern void  PaReset (void);

extern DWORD  PaFunc (int nCode, int nAdr, void *p);



//extern void SimInit (WORD16 nFamily);
//extern void SimStep (DWORD nCount);



/*
 * Dynamic Menu construction and maintanance
 */

#pragma pack(1)

#define DLGD struct DlgDat
struct DlgDat   {            // every dialog has it's own structure
  DWORD             iOpen;   // auto reopen dialog (pos := 'rc')
  HWND                 hw;   // Hwnd of Dialog
  BOOL (CALLBACK *wp) (HWND hw, UINT msg, WPARAM wp, LPARAM lp);
  RECT                 rc;   // Position rectangle
  void   (*Update) (void);   // Update dialog content
  void (*Kill) (DLGD *pM);   // Kill dialog
  void                *vp;   // reserved for C++ Dialogs (Dlg *this)
};

#define DYM  struct DynaM
struct DynaM  {             // Menu item data structure
  int              nDelim;  // Menu template delimiter
  char            *szText;  // Menu item text
  void    (*fp) (DYM *pM);  // create/bringDlgtoTop function
  DWORD               nID;  // uv3 assigned ID_xxxx
  DWORD            nDlgId;  // Dialog ID
  DLGD              *pDlg;  // link to dialog attributes
};
#pragma pack()

/*
 * nDelim:  1 := normal Menu entry
 *          2 := Popup-Entry (nested submenu)
 *         -2 := end of Popup-Group-List
 *         -1 := total end of Menu-List
 *  text:   the name for the menu/popup-menu entry
 *    fp:   Function to be activated on menu-selection
 */


/*
 * Dll-Query structure
 */

struct qdll  {
  HWND       parent;        // parent window handle
  char     *pathUv3;        // path of Target-DLL
  HMODULE     Linst;        // DLL Instance handle

  int       ValSize;        // size of 'value[]' Buffer
  char         *key;        // Register key for driver DLL's
  char       *value;        // some command line, for example
                            // more info could be here ...
  char     *prjname;        // project path+name
};
#define QDLL  struct qdll




/* Memory Management */
struct  MM {
  BYTE    *mem;            // Pointer to Memory Image
  WORD16  *atr;            // Pointer to Memory Attributes
};



union op  {                /* Opcode of current instruction */
  BYTE       b[8];
  WORD16     w[4];
  DWORD        ul;
  DWORD    ula[2];
  UINT64      u64;
};

//static union op      op;     // Opcodes

union rstat  {             /* Execution Status of dScope */
  BYTE          status;

  struct  {
    BYTE     BreakOp : 1;    /* Break-Opcode reached */
    BYTE     CntZero : 1;    /* Step-count reached zero. */
    BYTE     SomeErr : 1;    /* some error occurred */
    BYTE     StopBut : 1;    /* Stop-Button has been pressed. */ 
    BYTE     ExecBrk : 1;    /* stopped by an execution breakpoint */
    BYTE      AccBrk : 1;    /* stopped by an access breakpoint */
    BYTE      CndBrk : 1;    /* stopped by a conditional breakpoint */
    BYTE        Stop : 1;    /* stopped via '_break_' variable */
  } inf;
};

#define  TIMS  256           // 100
#define  TMW   struct tmw

struct tmw  {
  INT64             tmv;     /* Cycle value */
  void     (*tmf)(void);     /* function to be activated */
  int              tndx;     /* Time-Watch Number */
  DWORD            uSec;     // micro-seconds based timewatch
};

extern TMW   tixx [TIMS];    /* Array of Time-Watches */
extern int   numtim;         /* # of time-entries */
extern int   tndx;
extern int   tact;           /* TimeWatch-Activators id */


//--- FOX specific:

union itrp  {              /* Interrupt Status of Instructions */
  struct  {
    WORD16   hwtrap;         /* Hardware Traps */
    WORD16     flag;         /* Interrupt Flag */
  } w;
  DWORD      stat;
};


struct FoxReg  {
  union rfox   {
    DWORD   dregs [16];      /* D0  ... D30 */
    WORD16  wregs [16];      /* R0  ... R15 */
    BYTE    bregs [16];      /* RL0 ... RH7 */
  } r;
  DWORD        Ndpp[4];      /* Normierte DPP Register */ 
  DWORD            nPC;      /* full address ! */
  DWORD           cPsw;      /* DPSW */
  DWORD            cCP;      /* DCP */
  INT64        nCycles;      /* cycle counter */
  DWORD        cGPRCON;      /* DGPRCON */
};

struct FoxCont  {
  union itrp      itrp;    // Interrupt status
  BYTE           sleep;    // CPU sleep mode
  BYTE           trace;    // record trace information
  BYTE       intchange; 
  BYTE          intdis;
  DWORD           cPsw;    // current PSW
  DWORD           oPsw;    // old PSW
  struct FoxReg      r;    // Fox-Registers
};


//--- 166/167 specific's: -------------------------------

#define OFO(s,m)   (DWORD)&(((s *) 0)->m)     /* Offsetof Macro */

#pragma pack(1)
struct Reg166  {
  union  {
    WORD16  wregs [16];      // R0  ... R15
    BYTE    bregs [16];      // RL0 ... RH7
  } r;
  DWORD        Ndpp[4];      // full linear base address values
  DWORD            nPC;      // full address !
  WORD16          cPsw;      // current Psw
  WORD16           cSP;
  WORD16          cMDL;      // current MDL
  WORD16          cMDH;      // current MDH
  DWORD            cCP;      // CP
  INT64        nCycles;      // cycle counter

  INT64           macc;      // 40-Bit value
  WORD16           mah;      // MAH MAC-Unit Accumulator High
  WORD16           mal;      // MAL MAC-Unit Accumulator Low
  WORD16           mas;      // MAS limited MAH/signed
  WORD16           msw;      // MSW MAC-Unit Status Word
  WORD16           mcw;      // MCW MAC-Unit Control Word
  WORD16           mrw;      // MRW MAC-Unit Repeat Word

  WORD16          idx0;
  WORD16          idx1;
  WORD16           qx0;
  WORD16           qx1;
  WORD16           qr0;
  WORD16           qr1;
};

#pragma pack()
                             // use default packing !!!
struct Regx51  {             // iMCS51-Registers
//union  {
//  BYTE    bregs [16];      // R0 ... R7
//} r;
  BYTE      bregs [16];
  DWORD            nPC;      // full address !
  BYTE              sp;      // SP
  BYTE             psw;      // PSW-sfr
  BYTE               b;      // B-sfr
  BYTE             acc;      // ACC-sfr

  BYTE          dpl[8];      // DPL-sfr (a0...a7)
  BYTE          dph[8];      // DPH-sfr (a8...a15)
  BYTE          dpx[8];      // DPX-sfr (a16...a23) /Dallas C390/
  BYTE           dpSel;      // DPSEL-sfr
  BYTE             esp;      // ESP-sfr /Dallas C390/

//BYTE        ports[8];
  INT64        nCycles;      // cycle counter
};


#pragma pack(1)
struct Reg51MX  {            // 80C51MX-Registers (Philips)
  BYTE       bregs [8];      // R0...R7
  BYTE              sp;      // SP
  BYTE             spe;      // MX SP-extendend (high byte)
  BYTE             psw;      // PSW-sfr
  BYTE               b;      // B-sfr
  BYTE             acc;      // ACC-sfr

  BYTE          dpl[2];      // DPL0 (DPL sfr)
  BYTE          dph[2];      // DPH0 (DPH sfr)
  BYTE           mxcon;      // MXCON sfr
  BYTE           auxr1;      // AUXR1 sfr
  BYTE             epl;      // EPL sfr
  BYTE             epm;      // EPM sfr
  BYTE             eph;      // EPH sfr
  BYTE        ports[4];

  DWORD            nPC;      // full address !
  INT64        nCycles;      // cycle counter
  DWORD         ZF : 1;      // Zero-Flag: 80C51MX+Ext
};

#if 0
struct Rg5016 {              // Mifare Pro X P8RF516 Registers
  DWORD            nPC;
  INT64        nCycles;      // cycle counter
  BYTE             psw;
  BYTE              sp;
  BYTE               b;
  BYTE             acc;
  BYTE             dpl;
  BYTE             dph;
  BYTE       bregs [8];
  BYTE           dpsel;
  BYTE           adrxh;      // page for MOVX @Ri

  BYTE          rename;      // Accu rename sfr
  WORD16           ssp;      // SP - system mode
  WORD16           usp;      // SP - user mode
  BYTE            pswh;      // PSW high (mode register)
  BYTE          repeat;      // Repeat instr. n times

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -