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

📄 common.h

📁 该模拟器是在Keil7.0中使用。 只要把Ex02Dll.dll复制到 X:KeilC51BIN目录下。 打开测试程序
💻 H
字号:
#ifndef __COMMON_H__
#define __COMMON_H__


// Callback functions that are ONLY allowed to call during the initialisation process
typedef AGSIEXPORT BOOL      (*tAgsiDefineSFR) (const char* pszSfrName, AGSIADDR dwAddress, AGSITYPE eType, BYTE bBitPos);
typedef AGSIEXPORT AGSIVTR   (*tAgsiDefineVTR) (const char* pszVtrName, AGSITYPE eType, DWORD dwValue);
typedef AGSIEXPORT BOOL      (*tAgsiDeclareInterrupt)(AGSIINTERRUPT *pInterrupt);
typedef AGSIEXPORT BOOL      (*tAgsiSetWatchOnSFR) (AGSIADDR SFRAddress, AGSICALLBACK pfnReadWrite, AGSIACCESS eAccess);
typedef AGSIEXPORT BOOL      (*tAgsiSetWatchOnVTR) (AGSIVTR hVTR, AGSICALLBACK pfnReadWrite, AGSIACCESS eAccess);
typedef AGSIEXPORT BOOL      (*tAgsiSetWatchOnMemory) (AGSIADDR StartAddress, AGSIADDR EndAddress, AGSICALLBACK pfnReadWrite, AGSIACCESS eAccess);
typedef AGSIEXPORT AGSITIMER (*tAgsiCreateTimer) (AGSICALLBACK pfnTimer);
typedef AGSIEXPORT BOOL      (*tAgsiDefineMenuItem)(AGSIMENU *pDym);

// Callback functions that are NOT allowed to call during the initialisation process
typedef AGSIEXPORT BOOL      (*tAgsiWriteSFR) (AGSIADDR SFRAddress, DWORD dwValue, DWORD dwMask);
typedef AGSIEXPORT BOOL      (*tAgsiReadSFR)  (AGSIADDR SFRAddress, DWORD* pdwCurrentValue, DWORD* pdwPreviousValue, DWORD dwMask);
typedef AGSIEXPORT BOOL      (*tAgsiWriteVTR) (AGSIVTR hVTR, DWORD dwValue);
typedef AGSIEXPORT BOOL      (*tAgsiReadVTR) (AGSIVTR hVTR, DWORD* pdwCurrentValue);
typedef AGSIEXPORT BOOL      (*tAgsiSetSFRReadValue)(DWORD dwValue);
typedef AGSIEXPORT BOOL      (*tAgsiReadMemory) (AGSIADDR Address, DWORD dwCount, BYTE* pbValue);
typedef AGSIEXPORT BOOL      (*tAgsiWriteMemory)(AGSIADDR Address, DWORD dwCount, BYTE* pbValue);
typedef AGSIEXPORT AGSIADDR  (*tAgsiGetLastMemoryAddress)(void);
typedef AGSIEXPORT BOOL      (*tAgsiIsSimulatorAccess)(void);
typedef AGSIEXPORT BOOL      (*tAgsiSetTimer)(AGSITIMER hTimer, DWORD dwClock);
typedef AGSIEXPORT UINT64    (*tAgsiGetStates)(void);
typedef AGSIEXPORT AGSIADDR  (*tAgsiGetProgramCounter)(void);
typedef AGSIEXPORT DWORD     (*tAgsiIsInInterrupt)(void);
typedef AGSIEXPORT BOOL      (*tAgsiIsSleeping)(void);
typedef AGSIEXPORT void      (*tAgsiStopSimulator)(void);
typedef AGSIEXPORT void      (*tAgsiTriggerReset)(void);
typedef AGSIEXPORT void      (*tAgsiUpdateWindows)(void);
typedef AGSIEXPORT void      (*tAgsiHandleFocus) (HWND hwndDialog);
typedef AGSIEXPORT DWORD     (*tAgsiGetExternalClockRate)(void);
typedef AGSIEXPORT DWORD     (*tAgsiGetInternalClockRate)(void);
typedef AGSIEXPORT double    (*tAgsiGetClockFactor)(void);
typedef AGSIEXPORT void      (*tAgsiMessage)(const char* pszFormat, ...);
typedef AGSIEXPORT const char*(*tAgsiGetTargetKey)(const char* pszKey);
typedef AGSIEXPORT BOOL      (*tAgsiSetTargetKey)(const char* pszKey, const char *pszString);
typedef AGSIEXPORT DWORD     (*tAgsiGetSymbolByName) (AGSISYMDSC *vp);
typedef AGSIEXPORT DWORD     (*tAgsiGetSymbolByValue)(AGSISYMDSC *vp);

struct AGSIFUNCS {
  tAgsiDefineSFR             DefineSFR;
  tAgsiDefineVTR             DefineVTR;
  tAgsiSetWatchOnSFR         SetWatchOnSFR;
  tAgsiSetWatchOnVTR         SetWatchOnVTR;
  tAgsiSetWatchOnMemory      SetWatchOnMemory;
  tAgsiCreateTimer           CreateTimer;
  tAgsiDefineMenuItem        DefineMenuItem;
  tAgsiWriteSFR              WriteSFR;
  tAgsiReadSFR               ReadSFR;
  tAgsiWriteVTR              WriteVTR;
  tAgsiReadVTR               ReadVTR;
  tAgsiSetSFRReadValue       SetSFRReadValue;
  tAgsiReadMemory            ReadMemory;
  tAgsiWriteMemory           WriteMemory;
  tAgsiGetLastMemoryAddress  GetLastMemoryAddress;
  tAgsiIsSimulatorAccess     IsSimulatorAccess;
  tAgsiSetTimer              SetTimer;
  tAgsiGetStates             GetStates;
  tAgsiGetProgramCounter     GetProgramCounter;
  tAgsiDeclareInterrupt      DeclareInterrupt;
  tAgsiIsInInterrupt         IsInInterrupt;
  tAgsiIsSleeping            IsSleeping;
  tAgsiStopSimulator         StopSimulator;
  tAgsiTriggerReset          TriggerReset;
  tAgsiUpdateWindows         UpdateWindows;
  tAgsiHandleFocus           HandleFocus;
  tAgsiGetExternalClockRate  GetExternalClockRate;
  tAgsiGetInternalClockRate  GetInternalClockRate;
  tAgsiGetClockFactor        GetClockFactor;
  tAgsiMessage               Message;
  tAgsiGetTargetKey          GetTargetKey;
  tAgsiSetTargetKey          SetTargetKey;
  tAgsiGetSymbolByName       GetSymbolByName;
  tAgsiGetSymbolByValue      GetSymbolByValue;
};

extern struct AGSIFUNCS  Agsi;
extern AGSICONFIG  AgsiConfig;

union fv {      // float value union
  float f;
  DWORD DW;
};

// SFR's
#define P0 0x80
#define P1 0x90
#define P2 0xA0
#define P3 0xB0

//#define IP1     0xB8

struct vtrlist {
  char     *pName;       // name of VTREG
  AGSITYPE Type;         // type of VTREG
  DWORD    Value;        // value of VTREG
  AGSIVTR  hVTR;         // handle of VTREG
};

// VTR's
extern struct vtrlist VTREG[];

#define PORT1  (VTREG[ 0].hVTR)


void timer3(void);

DWORD GetFunctionPointers(void);           // get all function pointers
void StringHex2 (CWnd * pCWnd, DWORD val);
void StringHex4 (CWnd * pCWnd, DWORD val);
void StringHex6 (CWnd * pCWnd, DWORD val);
void StringFloat (CWnd * pCWnd, float val);
long GetDlg8BNumber (CWnd * pCWnd, DWORD oldval);
long GetDlg16BNumber (CWnd *pCWnd, DWORD oldval);
long GetDlg24BNumber (CWnd *pCWnd, DWORD oldval);
float GetDlgFloat (CWnd * pCWnd, float oldval);
void HandleByteInput(CWnd * pCWnd, AGSIADDR sfr);
void HandleWordInput(CWnd * pCWnd, AGSIADDR sfrl, AGSIADDR sfrh);
void Handle3ByteInput(CWnd * pCWnd, AGSIADDR sfrl, AGSIADDR sfrh, AGSIADDR sfrp);
void HandleFloatInput(CWnd * pCWnd, AGSIVTR vtr);
void WriteBit(AGSIADDR sfr, DWORD mask, DWORD set);
void WriteBitVTR(AGSIVTR vtr, DWORD mask, DWORD set);

#endif  // __COMMON_H__


⌨️ 快捷键说明

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