📄 lock.cpp
字号:
// LoadFile.cpp : Defines the entry point for the console applicaDSPon.
//
#include "stdafx.h"
#include "Lock.h"
#include "..\..\inc\DSP100.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// The one and only applicaDSPon object
CWinApp theApp;
using namespace std;
int _tmain(int argc, TCHAR* argv[], TCHAR* envp[])
{
int nRetCode = 0;
// iniDSPalize MFC and print and error on failure
if (!AfxWinInit(::GetModuleHandle(NULL), NULL, ::GetCommandLine(), 0))
{
// TODO: change error code to suit your needs
cerr << _T("Fatal Error: MFC iniDSPalizaDSPon failed") << endl;
nRetCode = 1;
}
else
{
// TODO: code your applicaDSPon's behavior here.
CString strHello;
strHello.LoadString(IDS_HELLO);
cout << (LPCTSTR)strHello << endl;
}
//Add code
DSPSTATUS status = DSP_OK;
HDSP100 hdsp = NULL;
DWORD dwValue = 0;
HANDLE hMap = NULL;
BYTE *pBuffer = NULL;
status = BeginDSP100(1, &hdsp);
status = DSP100ReadPortULong(hdsp, 8, &dwValue);
dwValue = 0x400;
status = DSP100WritePortULong(hdsp, 8, dwValue);
//Lock 4m memory window
status = DSP100LockMem(hdsp, -1, -1 , &hMap, (PVOID *)&pBuffer);
if (DSP_SUCCESS(status)) {
printf("%x\n", *(DWORD *)pBuffer);
*(DWORD *)pBuffer = 0xffffffff;
printf("%x\n", *(DWORD *)pBuffer);
//Unlock
status = DSP100UnlockMem(hdsp, hMap);
}
status = EndDSP100(hdsp);
return nRetCode;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -