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

📄 simulatordlg.cpp

📁 通过VC源代码
💻 CPP
📖 第 1 页 / 共 2 页
字号:
/*****************************************************************************
*           Change Log
*  Date     | Change
*-----------+-----------------------------------------------------------------
* 20-Mar-99 | Created
* 20-Mar-99 | WORD => UINT for registered window messages
* 20-Mar-99 | Added RST handlers
*****************************************************************************/
// SimulatorDlg.cpp : implementation file
//

#include "stdafx.h"
#include "Simulator.h"
#include <sys\timeb.h>
#include "TraceWnd.h"
#include "Regvars.h"
#include "NumericEdit.h"
  #include "InterruptMgt.h"
#include "SpinnerButton.h"
#include "register.h"
#include "RegData.h"
  #include "RegDisplay.h"
    #include "SimulatorDlg.h"
#include "buzzword.h"
#include "SetupDlg.h"
#include "About.h"
#include "comment.h"
#include "HdwTrace.h"

#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif


/****************************************************************************
*                                  UWM_PULSE
* Inputs:
*       WPARAM: ignored
*	LPARAM: ignored
* Result: LRESULT
*       Logically void, 0, always
* Effect: 
*       Indicates a single polling operation has started
****************************************************************************/

UINT UWM_PULSE = ::RegisterWindowMessage(
	             _T("UWM_PULSE-{71EDE612-AC36-11d1-8369-00AA005C0507}"));



/****************************************************************************
*                                  UWM_POLL
* Inputs:
*       WPARAM: ignored
*	LPARAM: ignored
* Result: LRESULT
*       Logically void, 0, always
* Effect: 
*       Starts the polling operation in the main thread
****************************************************************************/

UINT UWM_POLL = ::RegisterWindowMessage(
	              _T("UWM_POLL-{71EDE612-AC36-11d1-8369-00AA005C0507}"));



/****************************************************************************
*			       UWM_SET_TIMER_OUT
* Inputs:
*       WPARAM: ignored
*	LPARAM: ignored
* Result: LRESULT
*       Logically void, 0, always
* Effect: 
*       Starts a Go->Done output timer
****************************************************************************/

UINT UWM_SET_TIMER_OUT = ::RegisterWindowMessage(
	     _T("UWM_SET_TIMER_OUT-{71EDE612-AC36-11d1-8369-00AA005C0507}"));



/****************************************************************************
*			       UWM_SET_TIMER_IN
* Inputs:
*       WPARAM: ignored
*	LPARAM: ignored
* Result: LRESULT
*       Logically void, 0, always
* Effect: 
*       Starts a GO->Done input timer
****************************************************************************/

UINT UWM_SET_TIMER_IN = ::RegisterWindowMessage(
               _T("UWM_SET_TIMER_IN-{71EDE612-AC36-11d1-8369-00AA005C0507}"));



/****************************************************************************
*			       UWM_SET_MANUAL_MODE
* Inputs:
*       WPARAM: ignored
*	LPARAM: ignored
* Result: LRESULT
*       Logically void, 0, always
* Effect: 
*       Deferred Manual Mode request (handles queueing deadlock problem)
****************************************************************************/

UINT UWM_SET_MANUAL_MODE = ::RegisterWindowMessage(
           _T("UWM_SET_MANUAL_MODE-{71EDE612-AC36-11d1-8369-00AA005C0507}"));



/****************************************************************************
*                            UWM_OPEN_FAILED
* Inputs:
*       WPARAM: ignored
*	LPARAM: ignored
* Result: LRESULT
*       0, always (logically void)
* Effect: 
*       Handles notification that the open of the device failed
****************************************************************************/

UINT UWM_OPEN_FAILED = ::RegisterWindowMessage(
               _T("UWM_OPEN_FAILED-{15B50870-B191-11d1-836A-00AA005C0507}"));


/****************************************************************************
*                            UWM_IMGR_CLOSE
* Inputs:
*       WPARAM: ignored
*	LPARAM: ignored
* Result: LRESULT
*       0, always (logically void)
* Effect: 
*       Handles notification that the interrupt/error manager has closed
****************************************************************************/

UINT UWM_IMGR_CLOSE = ::RegisterWindowMessage(
                _T("UWM_IMGR_CLOSE-{15B50870-B191-11d1-836A-00AA005C0507}"));


/****************************************************************************
*                            UWM_REG_CLOSE
* Inputs:
*       WPARAM: ignored
*	LPARAM: ignored
* Result: LRESULT
*       0, always (logically void)
* Effect: 
*       Handles notification that the register display has closed
****************************************************************************/

UINT UWM_REG_CLOSE = ::RegisterWindowMessage(
                 _T("UWM_REG_CLOSE-{15B50870-B191-11d1-836A-00AA005C0507}"));


/****************************************************************************
*                            UWM_UPDATE_REGS
* Inputs:
*       WPARAM: ignored
*	LPARAM: (LPARAM)(HDW_SIM_REGS)
* Result: LRESULT
*       0, always (logically void)
* Effect: 
*       Handles notification that the register display has closed
****************************************************************************/

UINT UWM_UPDATE_REGS = ::RegisterWindowMessage(
               _T("UWM_UPDATE_REGS-{15B50870-B191-11d1-836A-00AA005C0507}"));


/****************************************************************************
*                                 UWM_GO_HACK_IN
* Inputs:
*       WPARAM: ignored
*	LPARAM: ignored
* Result: void
*       LRESULT 0
* Effect: 
*       The "Go" output bit has been set; initiate the action sequence required
*	to complete the GO action
****************************************************************************/

UINT UWM_GO_HACK_IN = ::RegisterWindowMessage(
                 _T("UWM_GO_HACK_IN-{71EDE610-AC36-11d1-8369-00AA005C0507}"));


/****************************************************************************
*                                 UWM_GO_HACK_OUT
* Inputs:
*       WPARAM: ignored
*	LPARAM: ignored
* Result: void
*       LRESULT 0
* Effect: 
*       The "Go" output bit has been set; initiate the action sequence required
*	to complete the GO action
****************************************************************************/

UINT UWM_GO_HACK_OUT = ::RegisterWindowMessage(
                _T("UWM_GO_HACK_OUT-{71EDE610-AC36-11d1-8369-00AA005C0507}"));


/****************************************************************************
*				 UWM_SET_PROB
* Inputs:
*       WPARAM: code which indicates what probability variable is being updated
*	LPARAM: value which is to be set
* Result: void
*       LRESULT 0
* Notes: 
*       Sent from the InterruptMgt modeless dialog to its parent
****************************************************************************/

UINT UWM_SET_PROB = ::RegisterWindowMessage(
                  _T("UWM_SET_PROB-{71EDE610-AC36-11d1-8369-00AA005C0507}"));

// The Messages below are nominally obsolete (wait for next set of tests)

/****************************************************************************
*                                 UWM_GO_OUT_SET
* Inputs:
*       WPARAM: ignored
*	LPARAM: ignored
* Result: void
*       LRESULT 0
* Effect: 
*       The "Go" output bit has been set; initiate the action sequence required
*	to complete the GO action
****************************************************************************/

UINT UWM_GO_OUT_SET = ::RegisterWindowMessage(
                _T("UWM_GO_OUT_SET-{71EDE610-AC36-11d1-8369-00AA005C0507}"));


/****************************************************************************
*                                 UWM_GO_IN_SET
* Inputs:
*       WPARAM: ignored
*	LPARAM: ignored
* Result: void
*       LRESULT 0
* Effect: 
*       The "Go" output bit has been set; initiate the action sequence required
*	to complete the GO action
****************************************************************************/

UINT UWM_GO_IN_SET = ::RegisterWindowMessage(
                  _T("UWM_GO_IN_SET-{71EDE610-AC36-11d1-8369-00AA005C0507}"));


/****************************************************************************
*                                 UWM_IACK_OUT_SET
* Inputs:
*       WPARAM: ignored
*	LPARAM: ignored
* Result: void
*       LRESULT 0
* Effect: 
*       The "IACK" output bit has been set; initiate the action sequence
*       required to complete the IACK action
****************************************************************************/

UINT UWM_IACK_OUT_SET = ::RegisterWindowMessage(
              _T("UWM_IACK_OUT_SET-{71EDE610-AC36-11d1-8369-00AA005C0507}"));


/****************************************************************************
*                                 UWM_IACK_IN_SET
* Inputs:
*       WPARAM: ignored
*	LPARAM: ignored
* Result: void
*       LRESULT 0
* Effect: 
*       The "IACK" output bit has been set; initiate the action sequence
*       required to complete the IACK action
****************************************************************************/

UINT UWM_IACK_IN_SET = ::RegisterWindowMessage(
               _T("UWM_IACK_IN_SET-{71EDE610-AC36-11d1-8369-00AA005C0507}"));

/****************************************************************************
*                                 UWM_RST_OUT_SET
* Inputs:
*       WPARAM: ignored
*	LPARAM: ignored
* Result: void
*       LRESULT 0
* Effect: 
*       The "RST" output bit has been set; initiate the action sequence
*       required to complete the RST action
****************************************************************************/

UINT UWM_RST_OUT_SET = ::RegisterWindowMessage(
		_T("UWM_RST_OUT_SET-{71EDE610-AC36-11d1-8369-00AA005C0507}"));


/****************************************************************************
*                                 UWM_RST_IN_SET
* Inputs:
*       WPARAM: ignored
*	LPARAM: ignored
* Result: void
*       LRESULT 0
* Effect: 
*       The "RST" output bit has been set; initiate the action sequence
*       required to complete the RST action
****************************************************************************/

UINT UWM_RST_IN_SET = ::RegisterWindowMessage(
 	       _T("UWM_RST_IN_SET-{71EDE610-AC36-11d1-8369-00AA005C0507}"));

/****************************************************************************
*                             UWM_UPDATE_CONTROLS
* Inputs:
*       WPARAM: ignored
*	LPARAM: ignored
* Result: void
*       0
* Effect: 
*       Notifies the main thread to update the control status
****************************************************************************/

UINT UWM_UPDATE_CONTROLS = ::RegisterWindowMessage(
           _T("UWM_UPDATE_CONTROLS-{71EDE611-AC36-11d1-8369-00AA005C0507}"));

UINT UWM_IE_IN_SET = ::RegisterWindowMessage(
	         _T("UWM_IE_IN_SET-{71EDE612-AC36-11d1-8369-00AA005C0507}"));

UINT UWM_IE_OUT_SET = ::RegisterWindowMessage(
	        _T("UWM_IE_OUT_SET-{71EDE612-AC36-11d1-8369-00AA005C0507}"));
/////////////////////////////////////////////////////////////////////////////
// CSimulatorDlg dialog

/****************************************************************************
*                        CSimulatorDlg::CSimulatorDlg
* Inputs:
*       CWnd * parent:
* Effect: 
*       Constructor
****************************************************************************/

CSimulatorDlg::CSimulatorDlg(CWnd* pParent /*=NULL*/)
	: CDialog(CSimulatorDlg::IDD, pParent)
{
	//{{AFX_DATA_INIT(CSimulatorDlg)
	//}}AFX_DATA_INIT
	// Note that LoadIcon does not require a subsequent DestroyIcon in Win32
	m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME);
	pollthread = NULL;
	polling = FALSE;
	pollInterval = 50; // 50ms unless otherwise specified
	imgr = NULL;
	regdisp = NULL;
	err = FALSE;
	debug = FALSE;
	manual = TRUE;
	singleStep = FALSE;
	GoDoneMinimum = 100;  // no particular reason, sounds like good default
	GoDoneVariance = 250; // no particular reason, sounds like good default
	ProbErr = 0;
	ProbLost = 0;
	ProbSpurious = 0;
	ProbOvrUnd = 0;
}

void CSimulatorDlg::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(CSimulatorDlg)
	DDX_Control(pDX, IDC_SINGLESTEP, c_SingleStep);
	DDX_Control(pDX, IDC_GETSTATE, c_GetState);
	DDX_Control(pDX, IDC_IACK_OUT, c_IACKOut);
	DDX_Control(pDX, IDC_IACK_IN, c_IACKIn);
	DDX_Control(pDX, IDC_GO_HACK_IN, c_GoHackIn);
	DDX_Control(pDX, IDC_GO_HACK_OUT, c_GoHackOut);
	DDX_Control(pDX, IDC_INTERRUPT, c_Interrupt);
	DDX_Control(pDX, IDC_TRANSFER, c_Transfer);
	DDX_Control(pDX, IDC_INT, c_Int);
	DDX_Control(pDX, IDC_OVR_IN, c_OvrIn);
	DDX_Control(pDX, IDC_UND_OUT, c_UndOut);
	DDX_Control(pDX, IDC_OVRUND, c_OverUnder);
	DDX_Control(pDX, IDC_INT_OUT, c_IntOut);
	DDX_Control(pDX, IDC_INT_IN, c_IntIn);
	DDX_Control(pDX, IDC_IE_OUT, c_IEOut);

⌨️ 快捷键说明

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