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

📄 bom.h

📁 8051编程例子讲解 一些基本使用方法通过例子有详细说明
💻 H
📖 第 1 页 / 共 5 页
字号:
  BYTE          xbase0;      // BaseAddr of Seg-0 Xram for all modes
  BYTE          xbase1;      // BaseAddr of Seg-1 Xram for all modes
  BYTE          xsize0;      // Size of Seg-0 Xram, user mode
  BYTE          xsize1;      // Size of Seg-1 Xram, user mode
  WORD16         cbas0;      // CodeBaseAdr Seg-0, user mode
  WORD16         cbas1;      // CodeBaseAdr Seg-1, user mode
  BYTE          csize0;      // Size CodeSeg-0, user mode
  BYTE          csize1;      // Size CodeSeg-1, user mode
  BYTE             lbs;      // Low bank select
  BYTE             hbs;      // High bank select
};
#endif


struct Reg251  {         // 80251 Registers
  union  {
    BYTE    bregs [16];
    WORD16  wregs [16];
    DWORD   dregs [16];
  } r;

  DWORD            nPC;  // full address !
  BYTE              sp;  // SP
  BYTE             psw;  // PSW-sfr
  BYTE            psw1;  // PSW1-sfr
  BYTE               b;  // B-sfr
  BYTE             acc;  // ACC-sfr
  BYTE             dpl;  // DPL-sfr
  BYTE             dph;  // DPH-sfr
  BYTE        ports[4];
  INT64        nCycles;  // cycle counter
};

struct RegS6  {          // iMCS51 - SLE66Cxx (ECO2000) 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

  WORD16    dptx [8];    // DPTR save area
};

struct RegARM   {            // iMCSARM Registers
  DWORD  cur[16];            // Current Mode:   R0..R15(PC)
  DWORD  CPSR;               // CPSR
  DWORD  SPSR;               // Current SPSR
  DWORD  usr[7];             // User & System:  R8..R14
  DWORD  fiq[8];             // Fast Interrupt: R8..R14, SPSR
  DWORD  irq[3];             // Interrupt:      R13,R14, SPSR
  DWORD  svc[3];             // Supervisor:     R13,R14, SPSR
  DWORD  abt[3];             // Abort:          R13,R14, SPSR
  DWORD  und[3];             // Undefined:      R13,R14, SPSR
  INT64  nCycles;            // cycle counter
};

#pragma pack()

#define SZ_R166   (OFO (struct Reg166, macc))
#define SZ_ST10   (sizeof (struct Reg166))
#define SZ_RX51   (sizeof (struct Regx51))
#define SZ_SLSZ   (sizeof (struct RegS6))
#define SZ_S251   (sizeof (struct Reg251))
#define SZ_51MX   (sizeof (struct Reg51MX))
#define SZ_RARM   (sizeof (struct RegARM))


/*
 * iMCS-51 SFR-Attribute codes
 */

#define nSF   0x0000      // SFR not present
#define iSF   0x8000      // SFR is present
#define pSF   0x4000      // SFR is present and is Port-0...3
#define cSF   0x2000      // ECO 'external SFR' (EEPROM,TIMER,UART)
#define dSF   0x1000      // 80320: Sfr is DPL/DPH or DPL1/DPH1
// Note: the above need to be combined with ATR_READ/ATR_WRITE
//       for selectively attribute configuration
//       iAV replaced by ATR_READ/ATR_WRITE


/*
 * Memory spaces
 */

#define   mmNONE   0x0000           // not spaced
#define   mmXDATA  0x0001           // XDATA
#define   mmBANK0  0x0080           // BANK0
#define   mmBANK31 0x009F           // BANK31
#define   mmDATA   0x00F0           // DATA
#define   mmBIT    0x00F1           // BIT
#define   mmEDATA  0x00F2           // EDATA (i251)
#define   mmIDATA  0x00F3           // IDATA
#define   mmECODE  0x00F4           // 251 ecode
#define   mmHDATA  0x00F5           // 251 hdata
#define   mmHCONS  0x00F6           // 251 hconst
#define   mmCONST  0x00F7           // 251 const
#define   mmPDATA  0x00FE           // PDATA (c51 macht das bei generic)
#define   mmCODE   0x00FF           // CODE 
#define   mmPHYS   0x0100           // Physical SLE66+ Memory
#define   mmPHLIM  0x0110           // 1MB Physical Memory

#define   mmU1MEM  0x00F8           // UsrMem #1 (E2-PROM)
#define   mmU2MEM  0x00F9           // UsrMem #2 (undefined)
#define   mmU3MEM  0x00FA           // UsrMem #3 (undefined)
#define   mmU4MEM  0x00FB           // UsrMem #4 (undefined)
#define   mmU5MEM  0x00FC           // UsrMem #5 (undefined)
#define   mmU6MEM  0x00FD           // UsrMem #6 (undefined)

#define   mmSFR000 0x0200           // SFR-Bank 0...255
#define   mmSFR255 0x02FF           // SFR-Bank 255 (D:255)



#if 0
//--- SLE88Cxx specific's: -------------------------------

struct RegSle  {
  union  {
//  WORD16   wregs[16];      // ECO-2 word regs
    DWORD    dregs [9];      // SLE R0-R7,A
  } r;
  DWORD            nPC;      // LoWord is relevant !!!
  DWORD            Psw;      // SLE PSW (32-Bit)
  DWORD           Reco;      //
  DWORD           Aram;      // 
  INT64        nCycles;      // cycle counter
  WORD16            sp;
  BYTE              cs;
  BYTE              ss;
  BYTE             ds0;
  BYTE             ds1;
  BYTE             ts0;
  BYTE             ts1;
};
#endif


//--------------------------------------------------------------

#define iSLE88     100     // dead !
#define i80x51     0x00    // generic 80x51
#define iEXTMAC    0x01    // MAC167
#define iSLE66     0x02    // SLE66
#define iC51MX     0x03    // Philips 80C51MX
#define iRF5016    0x04    // Philips P8RF5016 (Mifare pro X)
#define iSMARTMX   0x05    // Philips SmartMX


#define xxMENU    UsrDwrd[0]   // holds CAN-Extension Menu (DYM *)
#define xxUPDATE  UsrDwrd[1]   // holds 'void (*CanUpdate) (DWORD nCode)'
#define xxMEMCB   UsrDwrd[2]   // holds 'DWORD (*pFlashAcc) (DWORD nAdr, DWORD nCnt)

#define xxSFRMUX  UsrDwrd[13]  // holds 'SfrMux' ((BYTE *) &SfrMux[0])  /SLE66/
 
#define xxDCIPRM  UsrDwrd[14]  // holds 'DWORD &_dciUV2' for DCI Interface
#define Dio    ((struct dciUV2 *)(pio->UsrDwrd[14]))->dio
#define Dconn  ((struct dciUV2 *)(pio->UsrDwrd[14]))->dconn

//
// Sle66: ioc.pUv[0] = WORD16 *pTab;  // 256 Words fuer Peripheral-Config
//


#define   CMD_EXTCOVER   0x1000
// S8051/S166: Extended Coverage:
//      DWORD bR = ioc.SimFunc (CMD_EXTCOVER, char *"filename", DWORD nFlags);
//   bR:      1:=Ok, 0:=Error (file open/close/io)
//   nFlags:  1:=show jump-coverage details (like 'coverage details')




struct bom  {
  DWORD          nSize;
  WORD16  bInitialized;
  WORD16          iMCS;    // ToolSet Definitions 0=51, 1=251, 2=166, 3=Fox
  WORD16        iMinor;    // SubCode: iMCS166(1):=MAC167
  DWORD         iModel;    // memory model (based on iMCS)
  DWORD           iRtx;    // which RTX (0=none, 1=RtxTiny, 2=RtxFull)

  DWORD     RunDeb : 1;    // dScope is running
  DWORD     CmdLog : 1;    // 1 := command log file is active
  DWORD     SerLog : 1;    // 1 := serial log file active
  DWORD       iRun : 1;    // GO or Step currently running
  DWORD   InfoiRun : 1;    // Sim about to start running
  DWORD      iBoot : 1;    // currently starting up Sim
  DWORD     iReset : 1;    // Reset issued via Button
  DWORD   wdog_rst : 1;    // Reset via Watchdog Timer
  DWORD     logmod : 1;    // 0:=LOG, 1:=SLOG
  DWORD     target : 1;    // 1:=target mode
  DWORD    jSilent : 1;    // kill function without query

  DWORD    MemAccR : 1;    // Memory-access possible while running
  DWORD    RegAccR : 1;    // Register-access possible while running
  DWORD     hTrace : 1;    // trace support
  DWORD     hCover : 1;    // code coverage support
  DWORD    hPaLyze : 1;    // Performance Analyzer support
  DWORD    hMemMap : 1;    // Memory-Map support
  DWORD     ResetR : 1;    // Reset possible while running
  DWORD     WinAcc : 1;    // ReadMem/WriteMem/LoadTyp activated
                           // by some non-simulation vehicle

  ZBK            *pScp;    // current Scope via WaScope()
  ZXFIL         *pScpF;    // and the associated file
  LIN             *pLn;    // and the line number
  SYM            *SfrH;    // SFR-Symbols supplied by Cpu/Peri-DLL
  SYM           *hIntr;    // head of Intrinsic's
  SYM           *tIntr;    // head of Intrinsic's
  SYM           *hFunc;    // head of Functions (User/Signal

  struct szPAT  *hSrcP;    // head of search pathes (via 'set src')
  struct szPAT  *tSrcP;    // tail of search pathes (via 'set src')

  DWORD       startasm;    // DasmFox exports for LWinVw
  DWORD       altstart;
  DWORD         MarkPC;

                           // for enhancements:
  BYTE     UsrByte[16];    // currently not used.
  WORD16   UsrWord[16];    // currently not used.
  DWORD       movb : 1;    // MOVB instruction executed (SLE66)
  DWORD     SfrRdy : 1;    // data from sfr is valid (SLE66)
  DWORD      DemoF : 1;    // about to debug a demo file...
  DWORD      ModV2 : 1;    // 166 MODV2
  DWORD    Loading : 1;    // flag: loading a file
  DWORD  FlashLoad : 1;    // Flash-Load mode

  DWORD           : 26;    // currently not used.
  DWORD    UsrDwrd[15];    // currently not used.


//--- debug specific flags: -----------------------------------

  DWORD   periodic : 1;    // periodic window update Flag
  DWORD      aLwin : 1;
  DWORD     aCover : 1;
  DWORD      aSer1 : 1;
  DWORD      aSer2 : 1;
  DWORD        aPa : 1;
  DWORD       aBox : 1;
  DWORD   viewmode : 3;    // LwinVw: view mode
  DWORD      vrSel : 4;    // LwinVw: address-range selection
  DWORD       aSym : 1;    // Symbols Dialog active
  DWORD      aTbox : 1;    // ToolBox is active
  DWORD      AscS1 : 1;    // Serial #1 - 0:=Ascii, 1:=Hex mode
  DWORD      AscS2 : 1;    // Serial #2 - 0:=Ascii, 1:=Hex mode

  BYTE           trace;    // Record trace information
//-------------------------------------------------------------

  BYTE           ptree;    // dump expression tree (_ptree_)
  BYTE           traps;    // enable/disable interrupt/trap messages
  BYTE           *trap;    // Trace buffer
  int           curtra;    // current trace index
  int           numtra;    // records in buffer

  int          cbreaks;    // number of C-breaks
  BKS          *BpHead;    // List head of Breakpoints
  BKS          *BpTail;    // List tail of Breakpoints
  DWORD         AccOff;    // if > 0: ignore access breaks
  BYTE     BpBlock : 1;    // Block Bp-commands if Bp-Dialog is active
  BYTE     PaBlock : 1;    // Block PA-commands if PA-Dialog is active
  BYTE       PaDlg : 1;    // PA-Dialog is open
  BYTE       PaRun : 1;    // PA is running
  BYTE       PaTim : 1;    // Update PA time information
  BYTE         FuncGen;
  BYTE          KeyEsc;    // Escape key has been pressed

                           // log file
  char        *CmdLogN;    // name of command log file
  FILE        *CmdLogH;    // file handle of command log file
  char        *SerLogN;    // name of serial log file
  FILE        *SerLogH;    // file handle of serial log file

  
  HMODULE        Linst;    // DLL Instance handle
  HMODULE        Ginst;    // AGDI Instance handle
  HMODULE        Rinst;    // RTX-DLL Instance handle
  HWND            hwnd;    // CMainFrame's m_hWnd, Parent for Dll-Dialogs
  DWORD           hmsg;    // WM_OUTOUT Message

  DYM           *pMenu;    // attached by peripheral dll
  DYM           *pMtrg;    // attached via AGDI
  DYM           *pMrtx;    // attached via RTX dll

  int       (*vp) (struct bom *pioc, DWORD nCode);   // DLL init/uninit
  int      (*rvp) (DWORD nCode, void *p1);           // RTX-DLL init/uninit

  HWND          curDlg;    // currently active modeless dialog

  union rstat       st;    // Run-Status Info
  DWORD            nPC;    // Offset (16-bit) of the PC
  INT64         cycles;    // number of cycles executed
  int            etime;    // execution time, counts down from tdelay to 0
  int           tdelay;    // Time till next time watch
  WORD16         error;    // Error-code
  DWORD         ErrAdr;    // Opt. Error-address

  DWORD         OscFrq;    // Oscillator frequency

  VTR            *pVTA;    // allocated array of MAXVTR VtReg's
  WATCH        **pVTwa;    // and watch pointer list
  DWORD            nVT;    // number of currently used VtReg's

  CSTK           *pStk;    // call-stack entries
  int             nStk;    // call-stack depth tracker

  int              tos;    // PA-stack index
  PAST           *StPa;    // PA-stack slots
  PA           *PaBgHd;    // background PA always present.
  PA           *PaHead;    // Head of PA ranges
  PA           *PaTail;    // Tail of PA ranges
  DWORD         paEadr;    // PA current range entry/exit address
  INT64         CapCyc;    // captures cycles


//  struct FoxCont   fox;
#if 1
  union itrp      itrp;    // Interrupt status
  BYTE           sleep;    // CPU sleep mode
  BYTE         _break_;    // Stop execution, if _break_ := 1
  BYTE           radix;    // number base, for compat. to dScope
  BYTE       intchange; 
  DWORD        intvect;    // interrupt vector address if itrp.w.flag = 1
  BYTE          intdis;
  DWORD           cPsw;    // current PSW
  DWORD           oPsw;    // old PSW
#endif

  DWORD     EINIT_exec;    // 0=EINIT not yet executed / 1=EINIT executed
  DWORD    SRVWDT_exec;    // 0=SRVWDT not yet executed / 1=SRVWDT executed
  DWORD     WDOGACTIVE;    // 0=Watchdog disabled / 1=Watchdog enabled

                                         // Polymorphic function
  DWORD      (*SimFunc) (DWORD nCode, void *p1, void *p2);

  void         (*LFwLF) (CRT *X);        // DasmFox exports for LwinVw
  void         (*LRwLF) (CRT *X);
  void        (*CrtAtt) (CRT *X);
  char         *(*LGet) (CRT *X);
  BYTE      (*FileLine) (ZXFIL *pF, DWORD nLine);
  ZXFIL   *(*FileScope) (DWORD nAdr);    // End of DasmFox exports
  ZXFIL    *(*DocToZXF) (LPCTSTR pN);    // Map Docname to ZXFIL

  WORD16    *(*GetAttr) (DWORD nAdr);    // get attr for address

  void       (*StopRun) (void);          // Uv3-Stop-Button was pressed
  void      (*ServeWDT) (void);          // Watchdog timer function
  void         (*GoTil) (DWORD nAdr);    // Go until for Fox-Sim test

  int       (*HistFunc) (int nCode, int indx, int n1, BYTE *pR);
  DWORD       (*PaFunc) (int nCode, int nAdr, void *p);

  void        (*GetOpc) (DWORD nAdr, DWORD *vp); // get 4-Bytes Opcode
  DWORD       (*SetOpc) (DWORD nAdr, BYTE *pB, DWORD mMany);
  DWORD      (*ReadMem) (DWORD nAdr, DWORD nMany, BYTE *vp);
  DWORD     (*WriteMem) (DWORD nAdr, DWORD nMany, BYTE *vp);

  void	        (*Step) (DWORD nMany, DWORD type);   // Step function
  void	        (*Stop) (void);          // Notbremse
  void         (*Reset) (WORD16 nFlags); // Reset Simu
  void       (*GetRegs) (void *vp /*struct FoxReg *vp*/);
  void       (*SetRegs) (void *vp /*struct FoxReg *vp*/);
  DWORD       (*MapMem) (DWORD SegTyp, DWORD nAdr1, DWORD nLen);

  int       (*ValidAdr) (DWORD nAdr, int nCode);
  DWORD       (*BpInfo) (DWORD nAdr, WORD16 nCode);
  DWORD     (*BpExists) (DWORD nAdr);
  BKS     *(*BreakFunc) (WORD16 nCode, WORD16 n1, DWORD nAdr, BKS *pB);
  BKS      *(*NewBreak) (DWORD nAdr, WORD16 nType, WORD16 nCode);
  void         (*

⌨️ 快捷键说明

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