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

📄 deasm6502doc.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.
-----------------------------------------------------------------------------*/

// Deasm6502Doc.cpp : implementation file
//

#include "stdafx.h"
//#include "6502.h"
#include "Deasm6502Doc.h"
#include "DeasmSaveOptions.h"
#include <locale.h>
#include "Deasm.h"

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

/////////////////////////////////////////////////////////////////////////////
// CDeasm6502Doc

IMPLEMENT_DYNCREATE(CDeasm6502Doc, CDocument)

CDeasm6502Doc::CDeasm6502Doc()
{
  m_pCtx = NULL;
  m_nPointerAddr = -1;

  m_uStart  = 0x0000;
  m_uEnd    = 0xFFFF;
  m_uLength = 0x10000;
  m_bSaveAsData = false;
}


BOOL CDeasm6502Doc::OnNewDocument()
{
  if (!CDocument::OnNewDocument())
    return FALSE;

  SetContext( theApp.m_global.GetSimulator()->GetContext() );
  SetStart( theApp.m_global.GetStartAddr() );

  return TRUE;
}

CDeasm6502Doc::~CDeasm6502Doc()
{
}


BEGIN_MESSAGE_MAP(CDeasm6502Doc, CDocument)
  //{{AFX_MSG_MAP(CDeasm6502Doc)
  // NOTE - the ClassWizard will add and remove mapping macros here.
  //}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CDeasm6502Doc diagnostics

#ifdef _DEBUG
void CDeasm6502Doc::AssertValid() const
{
  CDocument::AssertValid();
}

void CDeasm6502Doc::Dump(CDumpContext& dc) const
{
  CDocument::Dump(dc);
}
#endif //_DEBUG

/////////////////////////////////////////////////////////////////////////////
// CDeasm6502Doc serialization

void CDeasm6502Doc::Serialize(CArchive& ar)
{
  if (ar.IsStoring())
  {
    CWaitCursor wait;
    DeassembleSave(ar, *m_pCtx, m_uStart, m_uEnd, 0);
  }
  else
  {
    // TODO: add loading code here
  }
}

/////////////////////////////////////////////////////////////////////////////
// Zapisanie deasemblatu

BOOL CDeasm6502Doc::DoSave(LPCTSTR lpszPathName, BOOL bReplace/* = TRUE*/)
{
  CDeasmSaveOptions dlg;
  dlg.m_uStart  = m_uStart;
  dlg.m_uEnd    = m_uEnd;
  dlg.m_uLength = m_uLength;
  dlg.m_bSaveAsData = m_bSaveAsData;
  if (dlg.DoModal() == IDOK)		// opcje deasemblacji
  {
    m_uStart  = dlg.m_uStart;
    m_uEnd    = dlg.m_uEnd;
    m_uLength = dlg.m_uLength;
    m_bSaveAsData = dlg.m_bSaveAsData;
    return CDocument::DoSave(lpszPathName, bReplace);
  }
  return FALSE;
}

/////////////////////////////////////////////////////////////////////////////
// CDeasm6502Doc commands
void CDeasm6502Doc::SetStart(UINT16 addr, bool bDraw){  m_uStartAddr = addr;}
void CDeasm6502Doc::SetContext(const CContext *pCtx){
  ASSERT(m_pCtx == NULL);		// nie mo縩a zmienia

⌨️ 快捷键说明

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