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

📄 registerbar.cpp

📁 专门为65XX系列芯片设计的变异调试环境的源代码
💻 CPP
字号:
/*-----------------------------------------------------------------------------
	6502 Macroassembler and Simulator

Copyright (C) 1995-2003 Michal Kowalski

This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
-----------------------------------------------------------------------------*/

// RegisterBar.cpp : implementation file
//

#include "stdafx.h"
//#include "6502.h"
#include "RegisterBar.h"
#include "Sym6502.h"
#include "Deasm.h"

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


bool CRegisterBar::m_bHidden= FALSE;

/////////////////////////////////////////////////////////////////////////////
// CRegisterBar dialog

CRegisterBar::CRegisterBar()
{
  m_bInUpdate = FALSE;
//  m_bHidden = FALSE;
  //{{AFX_DATA_INIT(CRegisterBar)
		// NOTE: the ClassWizard will add member initialization here
  //}}AFX_DATA_INIT
}



BEGIN_MESSAGE_MAP(CRegisterBar, CDialogBar)
  //{{AFX_MSG_MAP(CRegisterBar)
  ON_EN_CHANGE(IDC_REGS_A, OnChangeRegA)
  ON_EN_CHANGE(IDC_REGS_X, OnChangeRegX)
  ON_EN_CHANGE(IDC_REGS_Y, OnChangeRegY)
  ON_EN_CHANGE(IDC_REGS_S, OnChangeRegS)
  ON_EN_CHANGE(IDC_REGS_P, OnChangeRegP)
  ON_EN_CHANGE(IDC_REGS_PC, OnChangeRegPC)
  ON_BN_CLICKED(IDC_REGS_NEG, OnRegFlagNeg)
  ON_BN_CLICKED(IDC_REGS_CARRY, OnRegFlagCarry)
  ON_BN_CLICKED(IDC_REGS_DEC, OnRegFlagDec)
  ON_BN_CLICKED(IDC_REGS_INT, OnRegFlagInt)
  ON_BN_CLICKED(IDC_REGS_OVER, OnRegFlagOver)
  ON_BN_CLICKED(IDC_REGS_ZERO, OnRegFlagZero)
  ON_BN_CLICKED(IDC_REGS_BRK, OnRegFlagBrk)
  ON_WM_WINDOWPOSCHANGING()
  ON_BN_CLICKED(IDC_REGS_CYCLES_CLR, OnRegsCyclesClr)
  //}}AFX_MSG_MAP
  ON_MESSAGE(CBroadcast::WM_USER_UPDATE_REG_WND, OnUpdate)
  ON_MESSAGE(CBroadcast::WM_USER_START_DEBUGGER, OnStartDebug)
  ON_MESSAGE(CBroadcast::WM_USER_EXIT_DEBUGGER, OnExitDebug)
//  ON_MESSAGE(WM_IDLEUPDATECMDUI, OnIdleUpdateCmdUI)
END_MESSAGE_MAP()


/////////////////////////////////////////////////////////////////////////////
// CRegisterBar message handlers

bool CRegisterBar::Create(CWnd* pParentWnd, UINT nStyle, UINT nID){  bool ret= CDialogBar::Create(pParentWnd,IDD,nStyle,nID);
  if (!ret)
    return FALSE;

  ShowWindow(SW_HIDE);

  CString title;
  if (title.LoadString(IDD))
    SetWindowText(title);

  UINT vTabs[]= { 16, 12 };
  SendDlgItemMessage(IDC_REGS_A_MEM, EM_SETTABSTOPS, 2, reinterpret_cast<LPARAM>(vTabs));
  SendDlgItemMessage(IDC_REGS_X_MEM, EM_SETTABSTOPS, 2, reinterpret_cast<LPARAM>(vTabs));
  SendDlgItemMessage(IDC_REGS_Y_MEM, EM_SETTABSTOPS, 2, reinterpret_cast<LPARAM>(vTabs));

  return TRUE;
}

bool CRegisterBar::UpdateItem(int itemID)	// od渨ie縠nie obiektu okna dialogowego
{ 
  HWND hWnd= ::GetDlgItem(m_hWnd,itemID);
  if (hWnd)
    return ::UpdateWindow(hWnd);
  return FALSE;
}

void CRegisterBar::Update(const CContext *pCtx, const CString &stat, const CContext *pOld /*= NULL*/, bool bDraw /*= TRUE*/){
  ASSERT(pCtx != NULL);
  if (m_bInUpdate)
    return;

  SetDlgItemByteHex(IDC_REGS_A, pCtx->a);
  UpdateRegA(pCtx);
//  SetDlgItemInf(IDC_REGS_A_MEM, pCtx->a);

  SetDlgItemByteHex(IDC_REGS_X, pCtx->x);
  UpdateRegX(pCtx);
//  SetDlgItemInf(IDC_REGS_X_MEM, pCtx->x);

  SetDlgItemByteHex(IDC_REGS_Y, pCtx->y);
  UpdateRegY(pCtx);
//  SetDlgItemInf(IDC_REGS_Y_MEM, pCtx->y);

  SetDlgItemByteHex(IDC_REGS_P, pCtx->get_status_reg());
  UpdateRegP(pCtx);
/*
  CheckDlgButton(IDC_REGS_NEG,pCtx->negative);
  CheckDlgButton(IDC_REGS_ZERO,pCtx->zero);
  CheckDlgButton(IDC_REGS_OVER,pCtx->overflow);
  CheckDlgButton(IDC_REGS_CARRY,pCtx->carry);
  CheckDlgButton(IDC_REGS_INT,pCtx->interrupt);
  CheckDlgButton(IDC_REGS_BRK,pCtx->break_bit);
  CheckDlgButton(IDC_REGS_DEC,pCtx->decimal);
*/
  SetDlgItemByteHex(IDC_REGS_S, pCtx->s);
  UpdateRegS(pCtx);
/*
  if (pCtx->s != 0xFF)		// jest co

⌨️ 快捷键说明

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