m6502.cpp

来自「在网上搜集的一些关于6502的资料,在win2000下调试通过了,有vb也有vc」· C++ 代码 · 共 78 行

CPP
78
字号
/*-----------------------------------------------------------------------------
	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.
-----------------------------------------------------------------------------*/

// Asembler dla mikroprocesor體 M65XX i M65C02

#include "stdafx.h"
#include "resource.h"
#include "typeinfo.h"
#include "MarkArea.h"
#include "IOWindow.h"	// this is sloppy, but right now there's no mechanism to let framework know about requested new terminal wnd size

#ifdef _DEBUG
#define new DEBUG_NEW
#endif

bool CAsm6502::case_insensitive= false;	// true -> small/capital letters in label names are treated as same
bool CAsm6502::generateBRKExtraByte= false;	// generate extra byte after BRK command?
UINT8 CAsm6502::BRKExtraByte= 0x0;			// value of extra byte generated after BRK command
//-----------------------------------------------------------------------------
char* CLeksem::CLString::s_ptr_1= 0;
char* CLeksem::CLString::s_ptr_2= 0;
char CLeksem::CLString::s_buf_1[258];
char CLeksem::CLString::s_buf_2[258];
const size_t CLeksem::CLString::s_cnMAX= 256;

CLeksem::CLeksem(const CLeksem &leks) : type(leks.type)
{
	memcpy(this, &leks, sizeof *this);	// copy whole union and type field
	if (leks.type==L_STR || leks.type==L_IDENT || leks.type==L_IDENT_N)	// contains string?
		str = new CLString(*leks.str);	// duplicate string
}


CLeksem & CLeksem::operator = (const CLeksem &leks)
{
//  ASSERT(type == leks.type);
	if (type==L_STR || type==L_IDENT || type==L_IDENT_N)	// leksem docelowy zawiera 砤馽uch znak體?
	{
		delete str;
		str = NULL;
	}
//  type = leks.type;
	memcpy(this,&leks,sizeof *this);	// skopiowanie ca砮j unii i pola typu
	if (leks.type==L_STR || leks.type==L_IDENT || leks.type==L_IDENT_N)	// leksem 焤骴硂wy zawiera 砤馽uch znak體?
		str = new CLString(*leks.str);	// zdublowanie 砤馽ucha znak體
	return *this;
}


CLeksem::~CLeksem()
{
	switch (type)
	{
	case L_STR:
	case L_IDENT:
	case L_IDENT_N:
		if (str)
		{
#ifdef _DEBUG
			if (str->GetLength())
				str->SetAt(0,'X');		// zmiana tekstu dla ew. wisz筩ych odwo砤

⌨️ 快捷键说明

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