//
//	Потоковый дизассемблер для эмулятора CPU типа 1801ВМ1
//	by Patron
//	с адаптацией кода под мои нужды
//	Использует глобальные переменные:
//
//          PC           - счётчик команд
//          PSW          - слово состояния CPU
//          aMemory      - массив 64К байтов памяти
//          abReadAccess - массив 64К признаков возможности чтения для байтов памяти ( true - есть память, false - нет памяти )
//          r            - массив регистров процессора
//
//	Вызов:          DisAsm( PC );  // Дизассемблирует текущую инструкцию.
//
#include "pch.h"
#include "CPU.h"
#include "Platform.h"

#pragma warning(disable:4996)

// EM_LOG(str) - вывод строки дизассемблинга в файл
#define EM_LOG(str)      fputs(str, m_hDisAsmLog)

// DebugOut(str) - вывод строки дизассемблинга на отладочную консоль
#define DebugOut(str)

// LNG(str) - подстановка перевода сообщения на выбранный язык при помощи API локализации
#define LNG(str)         str

#define GET_WORD(a) g_Platform.GetWordIndirect(a)
#define GET_BYTE(a) g_Platform.GetByteIndirect(a)


///////////////////////////////////////////////////////
// Эти переменные нужно заменить на ссылки в эмулятор //
///////////////////////////////////////////////////////
std::array<uint16_t, 8> r;                    // Регистры
///////////////////////////////////////////////////////


int                 nPrintPosition;
std::array<int, 9>  nR_Operand;

uint16_t &R0 = r[0];
uint16_t &R1 = r[1];
uint16_t &R2 = r[2];
uint16_t &R3 = r[3];
uint16_t &R4 = r[4];
uint16_t &R5 = r[5];
uint16_t &R6 = r[6];
uint16_t &R7 = r[7];
uint16_t &SP = r[6];
uint16_t &PC = r[7];

////////////////////////////////////
void CCPU::OnStartStreamDisasm(CString n)
{
	if (!m_hDisAsmLog)
	{
		CString strName = CString(g_Config.m_strSavesPath.c_str()) + _T("\\disasm_") + n + _T(".txt");
		m_hDisAsmLog = _tfopen(strName.GetString(), _T("wt"));
		ASSERT(m_hDisAsmLog);
	}
}

void CCPU::OnStopStreamDisasm()
{
	if (m_hDisAsmLog)
	{
		fclose(m_hDisAsmLog);
		m_hDisAsmLog = nullptr;
	}
}

void CCPU::DisAsmPrint(const char *str)
{
	nPrintPosition += static_cast<int>(strlen(str));
#ifdef EM_LOG

	if (m_hDisAsmLog)
	{
		EM_LOG(str);
	}
	else
#endif
	{
		DebugOut(str);
	}
}

void CCPU::SkipPrintToOperandPosition()
{
	if (m_hDisAsmLog)
	{
		while (nPrintPosition < 6)
		{
			DisAsmPrint(" ");
		}
	}
	else
	{
		DisAsmPrint(" ");
	}

	nR_Operand.fill(-1);
}

void CCPU::SkipPrintToCommentsPosition()
{
	if (m_hDisAsmLog)
	{
		while (nPrintPosition < 28)
		{
			DisAsmPrint(" ");
		}
	}
	else
	{
		while (nPrintPosition < 31)
		{
			DisAsmPrint(" ");
		}
	}
}


int CCPU::PrintOperand(uint8_t nOpMode, int nOpSize)
{
	int nReg = nOpMode & 07;
	int nMode = (nOpMode & 070) >> 3;
	int nOffset = 0;
	uint16_t wAddr = 0;
	int nOppAddr = 0;
	bool bByteMode = !(bool)(nOpSize - 1);
	char str[256];
	static char acReg[16];

	if (nReg <= 5)
	{
		sprintf(acReg, "R%u", nReg);
	}
	else
	{
		switch (nReg)
		{
			case 6:
				sprintf(acReg, "SP");
				nOpSize = 2;
				break;

			case 7:
				sprintf(acReg, "PC");
				nOpSize = 2;
				break;
		}
	}

	switch (nMode)
	{
		case 00:
		{
			sprintf(str, "%s", acReg);
			nOppAddr = -1 * (nReg + 1);
		}
		break;

		case 01:
		{
			sprintf(str, "(%s)", acReg);
			nOppAddr = r[nReg];
		}
		break;

		case 02:
		{
			if (nReg != 7)
			{
				sprintf(str, "(%s)+", acReg);
				nOppAddr = r[nReg];
				nR_Operand[nReg] = (uint16_t)(r[nReg] + nOpSize);
			}
			else
			{
				wAddr = PC & (~1);
				/*
				int nData = (signed short)(GET_WORD(wAddr));
				PC += 2;

				if (nData > 7 || nData < -7)
				{
				    sprintf(str, "#%i.", nData);
				}
				else
				{
				    sprintf(str, "#%i", nData);
				}
				Вот не надо десятичных чисел.
				Это ведь и адреса могут быть
				*/
				uint16_t nData = GET_WORD(wAddr);
				PC += 2;
				sprintf(str, "#%06o", nData);
				nOppAddr = wAddr;
			}
		}
		break;

		case 03:
		{
			if (nReg != 7)
			{
				sprintf(str, "@(%s)+", acReg);
				nOppAddr = GET_WORD(r[nReg] & (~1));
				nR_Operand[nReg] = (uint16_t)(r[nReg] + 2);
			}
			else
			{
				wAddr = GET_WORD(PC & (~1));
				PC += 2;
				sprintf(str, "@#%06o", wAddr);
				nOppAddr = wAddr;
			}
		}
		break;

		case 04:
		{
			sprintf(str, "-(%s)", acReg);
			nOppAddr = r[nReg] - 2;
			nR_Operand[nReg] = (uint16_t)(r[nReg] - nOpSize);
		}
		break;

		case 05:
		{
			sprintf(str, "@-(%s)", acReg);
			nOppAddr = GET_WORD((r[nReg] - 2) & (~1));
			nR_Operand[nReg] = (uint16_t)(r[nReg] - 2);
		}
		break;

		case 06:
		{
			nOffset = (signed short)(GET_WORD(PC & (~1)));
			PC += 2;

			if (nReg != 7)
			{
				/*
				if (nOffset > 7 || nOffset < -7)
				{
				    sprintf(str, "%i.(%s)", nOffset, acReg);
				}
				else
				{
				    sprintf(str, "%i(%s)", nOffset, acReg);
				}
				*/
				sprintf(str, "%06o(%s)", nOffset, acReg);
			}
			else
			{
				wAddr = PC + nOffset;

				if (!bByteMode)
				{
					wAddr &= (~1);
				}

				sprintf(str, "%06o", wAddr);
			}

			uint16_t wOppAddr = (uint16_t)nOffset + r[nReg];
			nOppAddr = wOppAddr;
		}
		break;

		case 07:
		{
			nOffset = (signed short)(GET_WORD(PC & (~1)));
			PC += 2;

			if (nOffset)
			{
				/*
				if (nOffset > 7 || nOffset < -7)
				{
				    sprintf(str, "@%i.(%s)", nOffset, acReg);
				}
				else
				{
				    sprintf(str, "@%i(%s)", nOffset, acReg);
				}
				*/
				sprintf(str, "@%06o(%s)", nOffset, acReg);
			}
			else
			{
				sprintf(str, "@(%s)", acReg);
			}

			nOppAddr = GET_WORD((uint16_t)((r[nReg] + (uint16_t)nOffset) & (~1)));
		}
		break;
	}

	DisAsmPrint(str);

	if (!bByteMode && nOppAddr >= 0)
	{
		nOppAddr &= (~1);
	}

	return nOppAddr;
}
int CCPU::PrintOperand2(uint8_t nOpMode, int nOpSize)
{
	int nReg = nOpMode & 07;
	int nMode = (nOpMode & 070) >> 3;
	int nOffset = 0;
	uint16_t wAddr = 0;
	int nOppAddr = 0;
	bool bByteMode = !(bool)(nOpSize - 1);
	char str[256];
	static char acReg[16];

	if (nReg <= 5)
	{
		sprintf(acReg, "R%u", nReg);
	}
	else
	{
		switch (nReg)
		{
			case 6:
				sprintf(acReg, "SP");
				break;

			case 7:
				sprintf(acReg, "PC");
				break;
		}
	}

	switch (nMode)
	{
		case 00:
		{
			sprintf(str, "%s", acReg);
			nOppAddr = -1 * (nReg + 1);
		}
		break;

		case 01:
		{
			sprintf(str, "(%s)", acReg);

			if (nR_Operand[nReg] < 0)
			{
				nOppAddr = r[nReg];
			}
			else
			{
				nOppAddr = nR_Operand[nReg];
			}
		}
		break;

		case 02:
		{
			if (nReg != 7)
			{
				sprintf(str, "(%s)+", acReg);

				if (nR_Operand[nReg] < 0)
				{
					nOppAddr = r[nReg];
				}
				else
				{
					nOppAddr = nR_Operand[nReg];
				}
			}
			else
			{
				wAddr = PC & (~1);
				/*
				int nData = (signed short)(GET_WORD(wAddr));
				PC += 2;

				if (nData > 7 || nData < -7)
				{
				    sprintf(str, "#%i.", nData);
				}
				else
				{
				    sprintf(str, "#%i", nData);
				}
				*/
				uint16_t nData = GET_WORD(wAddr);
				PC += 2;
				sprintf(str, "#%06o", nData);
				nOppAddr = wAddr;
			}
		}
		break;

		case 03:
		{
			if (nReg != 7)
			{
				sprintf(str, "@(%s)+", acReg);

				if (nR_Operand[nReg] < 0)
				{
					nOppAddr = GET_WORD(r[nReg] & (~1));
				}
				else
				{
					nOppAddr = GET_WORD(nR_Operand[nReg] & (~1));
				}
			}
			else
			{
				wAddr = GET_WORD(PC & (~1));
				PC += 2;
				sprintf(str, "@#%06o", wAddr);
				nOppAddr = wAddr;
			}
		}
		break;

		case 04:
		{
			sprintf(str, "-(%s)", acReg);

			if (nR_Operand[nReg] < 0)
			{
				nOppAddr = r[nReg] - 2;
			}
			else
			{
				nOppAddr = nR_Operand[nReg] - 2;
			}
		}
		break;

		case 05:
		{
			sprintf(str, "@-(%s)", acReg);

			if (nR_Operand[nReg] < 0)
			{
				nOppAddr = GET_WORD((r[nReg] - 2) & (~1));
			}
			else
			{
				nOppAddr = GET_WORD((nR_Operand[nReg] - 2) & (~1));
			}
		}
		break;

		case 06:
		{
			nOffset = (signed short)(GET_WORD(PC & (~1)));
			PC += 2;

			if (nReg != 7)
			{
				/*
				if (nOffset > 7 || nOffset < -7)
				{
				    sprintf(str, "%i.(%s)", nOffset, acReg);
				}
				else
				{
				    sprintf(str, "%i(%s)", nOffset, acReg);
				}
				*/
				sprintf(str, "%06o(%s)", nOffset, acReg);
			}
			else
			{
				wAddr = PC + nOffset;

				if (!bByteMode)
				{
					wAddr &= (~1);
				}

				sprintf(str, "%06o", wAddr);
			}

			if (nR_Operand[nReg] < 0)
			{
				uint16_t wOppAddr = (uint16_t)nOffset + r[nReg];
				nOppAddr = wOppAddr;
			}
			else
			{
				uint16_t wOppAddr = (uint16_t)nOffset + nR_Operand[nReg];
				nOppAddr = wOppAddr;
			}
		}
		break;

		case 07:
		{
			nOffset = (signed short)(GET_WORD(PC & (~1)));
			PC += 2;

			if (nOffset)
			{
				/*
				if (nOffset > 7 || nOffset < -7)
				{
				    sprintf(str, "%i.(%s)", nOffset, acReg);
				}
				else
				{
				    sprintf(str, "%i(%s)", nOffset, acReg);
				}
				*/
				sprintf(str, "%06o(%s)", nOffset, acReg);
			}
			else
			{
				sprintf(str, "@(%s)", acReg);
			}

			if (nR_Operand[nReg] < 0)
			{
				nOppAddr = GET_WORD((uint16_t)((r[nReg] + (uint16_t)nOffset) & (~1)));
			}
			else
			{
				nOppAddr = GET_WORD((uint16_t)((nR_Operand[nReg] + (uint16_t)nOffset) & (~1)));
			}
		}
		break;
	}

	DisAsmPrint(str);

	if (!bByteMode && nOppAddr >= 0)
	{
		nOppAddr &= (~1);
	}

	return nOppAddr;
}


void CCPU::DisAsm(uint16_t LastPC)
{
	memcpy(&r[0], &m_RON[0], sizeof(uint16_t) * 8); // скопируем текущие значения регистров в буфер
	static uint16_t LastPC_1;
	static uint16_t LastPC_2;
	static uint16_t LastPC_3;
	static uint16_t LastPC_4;
	static uint16_t LastPC_5;
	static uint16_t LastPC_6;
	static long LastPC_2count;
	static long LastPC_3count;
	static long LastPC_4count;
	static long LastPC_5count;
	static long LastPC_6count;
	char str[256];
	uint16_t nWord = 0;
	uint16_t PC_res = PC;
	PC = LastPC;
	bool bRepeat = false;

	//*
	if (LastPC_2 == LastPC)
	{
		if (++LastPC_2count > 2)
		{
			bRepeat = true;
		}
	}
	else
	{
		if (LastPC_2count > 3)
		{
			sprintf(str, LNG("\n^^^ Last [2] lines [%i] repeat ^^^\n\n"), LastPC_2count / 2 - 1);
			DisAsmPrint(str);
		}

		LastPC_2count = 0;
	}

	if (LastPC_3 == LastPC)
	{
		if (++LastPC_3count > 6)
		{
			bRepeat = true;
		}
	}
	else
	{
		if (LastPC_3count > 6)
		{
			sprintf(str, LNG("\n^^^ Last [3] lines [%i] repeat ^^^\n\n"), LastPC_3count / 3 - 1);
			DisAsmPrint(str);
		}

		LastPC_3count = 0;
	}

	if (!LastPC_2count)
	{
		if (LastPC_4 == LastPC)
		{
			if (++LastPC_4count > 8)
			{
				bRepeat = true;
			}
		}
		else
		{
			if (LastPC_4count > 8)
			{
				sprintf(str, LNG("\n^^^ Last [4] lines [%i] repeat ^^^\n\n"), LastPC_4count / 4 - 1);
				DisAsmPrint(str);
			}

			LastPC_4count = 0;
		}
	}

	if (LastPC_5 == LastPC)
	{
		if (++LastPC_5count > 10)
		{
			bRepeat = true;
		}
	}
	else
	{
		if (LastPC_5count > 10)
		{
			sprintf(str, LNG("\n^^^ Last [5] lines [%i] repeat ^^^\n\n"), LastPC_5count / 5 - 1);
			DisAsmPrint(str);
		}

		LastPC_5count = 0;
	}

	if (!LastPC_2count && !LastPC_3count)
	{
		if (LastPC_6 == LastPC)
		{
			if (++LastPC_6count > 12)
			{
				bRepeat = true;
			}
		}
		else
		{
			if (LastPC_6count > 12)
			{
				sprintf(str, LNG("\n^^^ Last [6] lines [%i] repeat ^^^\n\n"), LastPC_6count / 6 - 1);
				DisAsmPrint(str);
			}

			LastPC_6count = 0;
		}
	}

	//*/
	LastPC_6 = LastPC_5;
	LastPC_5 = LastPC_4;
	LastPC_4 = LastPC_3;
	LastPC_3 = LastPC_2;
	LastPC_2 = LastPC_1;
	LastPC_1 = LastPC;

	if (bRepeat)
	{
		PC = PC_res;
		return;
	}

	if (m_hDisAsmLog)
	{
		sprintf(str, "%06o [%06o]:      ", PC, m_PSW);
		//sprintf(str,"PC[%06o] m_PSW[%03o]:  ", PC, m_PSW );
		//sprintf(str,"%012llu:      ", Get_qwRunTimeNS() );
		//sprintf(str,"PC[%06o] m_PSW[%03o] SP[%06o] 772[%06o] 774[%06o] : ", PC, m_PSW, SP, GET_WORD(0772), GET_WORD(0774) );
		//sprintf(str,"PC[%06o] m_PSW[%03o] R0[%06o] R1[%06o] R2[%06o] R3[%06o] R4[%06o] R5[%06o] R6[%06o]  :  ", PC, m_PSW, R0, R1, R2, R3, R4, R5, R6 );
	}
	else
	{
		sprintf(str, "%06o: ", PC);
	}

	DisAsmPrint(str);
	nPrintPosition = 0;
	nWord = GET_WORD(PC & (~1));
	PC += 2;

	if (nWord <= 6)
	{
		static const char *acInstr[] = { "HALT", "WAIT", "RTI", "BPT", "IOT", "RESET", "RTT" };
		sprintf(str, "%s\n", acInstr[nWord]);
		DisAsmPrint(str);

		if (nWord >= 2 && nWord != 5)
		{
			DisAsmPrint("\n");
		}

		goto DONE;
	}

	if (nWord == 012)
	{
		DisAsmPrint("START\n\n");
		goto DONE;
	}

	if (nWord == 016)
	{
		DisAsmPrint("STEP\n\n");
		goto DONE;
	}

	if (nWord <= 0177)
	{
		if (nWord & 0100)
		{
			DisAsmPrint("JMP ");
			SkipPrintToOperandPosition();
			PrintOperand(nWord & 077);
			DisAsmPrint("\n\n");
			goto DONE;
		}

		sprintf(str, LNG("%06o - Strange Opcode\n"), nWord);
		DisAsmPrint(str);
		goto DONE;
	}

	if (nWord <= 0207)
	{
		int nReg = nWord & 07;

		if (nReg != 7)
		{
			DisAsmPrint("RTS ");
			SkipPrintToOperandPosition();
			sprintf(str, "R%u", nReg);
			DisAsmPrint(str);
		}
		else
		{
			DisAsmPrint("RETURN");
		}

		SkipPrintToCommentsPosition();
		sprintf(str, LNG("; %06o:%06o ->   R%i  "), SP, GET_WORD(SP & (~1)), nReg);
		DisAsmPrint(str);
		DisAsmPrint("\n\n");
		goto DONE;
	}

	if (nWord < 0230)
	{
		sprintf(str, LNG("%06o - Strange Opcode\n"), nWord);
		DisAsmPrint(str);
		goto DONE;
	}

	if (nWord <= 0237)
	{
		//    int nPriority = nWord & 07;
		//    sprintf(str,"SPL %u\n", nPriority );
		sprintf(str, LNG("%06o - SPL - Opcode not supported\n"), nWord);
		DisAsmPrint(str);
		goto DONE;
	}

	if (nWord <= 0277)
	{
		uint16_t nMask{}, mask{};

		switch (nWord)
		{
			case 0240:
				DisAsmPrint("NOP\n");
				break;

			case 0241:
				DisAsmPrint("CLC\n");
				break;

			case 0242:
				DisAsmPrint("CLV\n");
				break;

			case 0244:
				DisAsmPrint("CLZ\n");
				break;

			case 0250:
				DisAsmPrint("CLN\n");
				break;

			case 0257:
				DisAsmPrint("CCC\n");
				break;

			case 0261:
				DisAsmPrint("SEC\n");
				break;

			case 0262:
				DisAsmPrint("SEV\n");
				break;

			case 0264:
				DisAsmPrint("SEZ\n");
				break;

			case 0270:
				DisAsmPrint("SEN\n");
				break;

			case 0277:
				DisAsmPrint("SCC\n");
				break;

			default:
				if (nWord <= 0257)
				{
					// NOP .. CCC
					nMask = nWord & 017;
					DisAsmPrint("BIC_PSW ^b");

					for (mask = 010; mask; mask >>= 1)
					{
						sprintf(str, "%u", ((nMask & mask) != 0));
						DisAsmPrint(str);
					}

					DisAsmPrint("\n");
					break;
				}

				if (nWord <= 0277)
				{
					// NOP2 .. SCC
					nMask = nWord & 017;
					DisAsmPrint("BIS_PSW ^b");

					for (mask = 010; mask; mask >>= 1)
					{
						sprintf(str, "%u", ((nMask & mask) != 0));
						DisAsmPrint(str);
					}

					DisAsmPrint("\n");
					break;
				}

				sprintf(str, LNG("%06o - Strange Opcode\n"), nWord);
				DisAsmPrint(str);
				break;
		}

		goto DONE;
	}

	if (nWord <= 0377)
	{
		DisAsmPrint("SWAB ");
		SkipPrintToOperandPosition();
		int nOppAddr = PrintOperand(nWord & 077);
		SkipPrintToCommentsPosition();

		if (nOppAddr >= 0)
		{
			uint16_t wOppAddr = nOppAddr;
			uint16_t wOperand = GET_WORD(wOppAddr);

			if (g_Platform.ReadAccess(wOppAddr))
			{
				sprintf(str, LNG("; %06o:%06o"), wOppAddr, wOperand);
			}
			else
			{
				sprintf(str, LNG("; %06o:      "), wOppAddr);
			}

			DisAsmPrint(str);
		}
		else
		{
			int nR = (-1 * nOppAddr) - 1;
			sprintf(str, LNG(";   R%i  :%06o"), nR, r[nR]);
			DisAsmPrint(str);
		}

		DisAsmPrint("\n");
		goto DONE;
	}

	if (nWord <= 03777)
	{
		switch (nWord & 03400)
		{
			case 0400:
				DisAsmPrint("BR ");
				break;

			case 01000:
				DisAsmPrint("BNE ");
				break;

			case 01400:
				DisAsmPrint("BEQ ");
				break;

			case 02000:
				DisAsmPrint("BGE ");
				break;

			case 02400:
				DisAsmPrint("BLT ");
				break;

			case 03000:
				DisAsmPrint("BGT ");
				break;

			case 03400:
				DisAsmPrint("BLE ");
				break;

			default:
				sprintf(str, LNG("%06o - Strange Opcode\n"), nWord);
				DisAsmPrint(str);
				goto DONE;
		}

		int nOffset = (signed char)(nWord & 0377);
		nOffset *= 2;
		SkipPrintToOperandPosition();
		sprintf(str, "%06o", PC + nOffset);
		DisAsmPrint(str);
		//      SkipPrintToCommentsPosition();
		//      if( ( nWord & 03400 ) != 0400 )
		//      {
		//        sprintf(str,";   m_PSW :%06o", m_PSW );
		//        DisAsmPrint(str);
		//      }
		DisAsmPrint("\n");
		goto DONE;
	}

	if (nWord <= 04777)
	{
		int nReg = (nWord & 0700) >> 6;

		if (nReg != 7)
		{
			DisAsmPrint("JSR ");
			SkipPrintToOperandPosition();
			sprintf(str, "R%u, ", nReg);
			DisAsmPrint(str);
		}
		else
		{
			DisAsmPrint("CALL ");
			SkipPrintToOperandPosition();
		}

		PrintOperand(nWord & 077);
		SkipPrintToCommentsPosition();
		sprintf(str, LNG(";   R%i  :%06o -> %06o"), nReg, r[nReg], SP - 2);
		DisAsmPrint(str);
		DisAsmPrint("\n\n");
		goto DONE;
	}

	if (nWord <= 06377)
	{
		switch (nWord & 07700)
		{
			case 05000:
				DisAsmPrint("CLR ");
				break;

			case 05100:
				DisAsmPrint("COM ");
				break;

			case 05200:
				DisAsmPrint("INC ");
				break;

			case 05300:
				DisAsmPrint("DEC ");
				break;

			case 05400:
				DisAsmPrint("NEG ");
				break;

			case 05500:
				DisAsmPrint("ADC ");
				break;

			case 05600:
				DisAsmPrint("SBC ");
				break;

			case 05700:
				DisAsmPrint("TST ");
				break;

			case 06000:
				DisAsmPrint("ROR ");
				break;

			case 06100:
				DisAsmPrint("ROL ");
				break;

			case 06200:
				DisAsmPrint("ASR ");
				break;

			case 06300:
				DisAsmPrint("ASL ");
				break;
		}

		SkipPrintToOperandPosition();
		int nOppAddr = PrintOperand(nWord & 077);
		SkipPrintToCommentsPosition();

		if (nOppAddr >= 0)
		{
			uint16_t wOppAddr = nOppAddr;
			uint16_t wOperand = GET_WORD(wOppAddr);

			if (g_Platform.ReadAccess(wOppAddr))
			{
				sprintf(str, LNG("; %06o:%06o"), wOppAddr, wOperand);
			}
			else
			{
				sprintf(str, LNG("; %06o:      "), wOppAddr);
			}

			DisAsmPrint(str);
		}
		else
		{
			int nR = (-1 * nOppAddr) - 1;
			sprintf(str, LNG(";   R%i  :%06o"), nR, r[nR]);
			DisAsmPrint(str);
		}

		DisAsmPrint("\n");
		goto DONE;
	}

	if (nWord <= 06477)
	{
		DisAsmPrint("MARK ");
		SkipPrintToOperandPosition();
		sprintf(str, "%i\n", (nWord & 077));
		DisAsmPrint(str);
		goto DONE;
	}

	if (nWord < 06700)
	{
		sprintf(str, LNG("%06o - Strange Opcode\n"), nWord);
		DisAsmPrint(str);
		goto DONE;
	}

	if (nWord <= 06777)
	{
		DisAsmPrint("SXT ");
		SkipPrintToOperandPosition();
		PrintOperand(nWord & 077);
		DisAsmPrint("\n");
		goto DONE;
	}

	if (nWord <= 07777)
	{
		sprintf(str, LNG("%06o - Strange Opcode\n"), nWord);
		DisAsmPrint(str);
		goto DONE;
	}

	if (nWord <= 017777)
	{
		DisAsmPrint("MOV ");
		SkipPrintToOperandPosition();
		int nOpp1Addr = PrintOperand((nWord & 07700) >> 6);
		DisAsmPrint(", ");
		int nOpp2Addr = PrintOperand2(nWord & 077);
		SkipPrintToCommentsPosition();

		if (nOpp1Addr >= 0 && nOpp2Addr >= 0)
		{
			uint16_t wOpp1Addr = nOpp1Addr;
			uint16_t wOperand = GET_WORD(wOpp1Addr & (~1));
			uint16_t wOpp2Addr = nOpp2Addr;

			if (g_Platform.ReadAccess(wOpp1Addr))
			{
				sprintf(str, LNG("; %06o:%06o -> %06o"), wOpp1Addr, wOperand, wOpp2Addr);
			}
			else
			{
				sprintf(str, LNG("; %06o:       -> %06o"), wOpp1Addr, wOpp2Addr);
			}

			DisAsmPrint(str);
		}
		else if (nOpp1Addr < 0 && nOpp2Addr >= 0)
		{
			int nR = (-1 * nOpp1Addr) - 1;
			sprintf(str, LNG(";   R%i  :%06o -> %06o"), nR, r[nR], nOpp2Addr);
			DisAsmPrint(str);
		}
		else if (nOpp1Addr >= 0 && nOpp2Addr < 0)
		{
			uint16_t wOpp1Addr = nOpp1Addr;
			uint16_t wOperand = GET_WORD(wOpp1Addr & (~1));
			int nR = (-1 * nOpp2Addr) - 1;

			if (g_Platform.ReadAccess(wOpp1Addr))
			{
				sprintf(str, LNG("; %06o:%06o ->   R%i"), wOpp1Addr, wOperand, nR);
			}
			else
			{
				sprintf(str, LNG("; %06o:       ->   R%i"), wOpp1Addr, nR);
			}

			DisAsmPrint(str);
		}
		else
			// if( nOpp1Addr < 0 && nOpp2Addr < 0 )
		{
			int nRa = (-1 * nOpp1Addr) - 1;
			int nRb = (-1 * nOpp2Addr) - 1;
			sprintf(str, LNG(";   R%i  :%06o ->   R%i"), nRa, r[nRa], nRb);
			DisAsmPrint(str);
		}

		DisAsmPrint("\n");
		goto DONE;
	}

	if (nWord <= 067777)
	{
		switch (nWord & 070000)
		{
			case 020000:
				DisAsmPrint("CMP ");
				break;

			case 030000:
				DisAsmPrint("BIT ");
				break;

			case 040000:
				DisAsmPrint("BIC ");
				break;

			case 050000:
				DisAsmPrint("BIS ");
				break;

			case 060000:
				DisAsmPrint("ADD ");
				break;
		}

		SkipPrintToOperandPosition();
		int nOpp1Addr = PrintOperand((nWord & 07700) >> 6);
		DisAsmPrint(", ");
		int nOpp2Addr = PrintOperand2(nWord & 077);
		SkipPrintToCommentsPosition();

		if (nOpp1Addr >= 0 && nOpp2Addr >= 0)
		{
			uint16_t wOpp1Addr = nOpp1Addr;
			uint16_t wOperand1 = GET_WORD(wOpp1Addr & (~1));
			uint16_t wOpp2Addr = nOpp2Addr;
			uint16_t wOperand2 = GET_WORD(wOpp2Addr & (~1));

			if (g_Platform.ReadAccess(wOpp1Addr) && g_Platform.ReadAccess(wOpp2Addr))
			{
				sprintf(str, LNG("; %06o:%06o -> %06o:%06o"), wOpp1Addr, wOperand1, wOpp2Addr, wOperand2);
			}
			else if (!g_Platform.ReadAccess(wOpp1Addr))
			{
				sprintf(str, LNG("; %06o:       -> %06o:%06o"), wOpp1Addr, wOpp2Addr, wOperand2);
			}
			else if (!g_Platform.ReadAccess(wOpp2Addr))
			{
				sprintf(str, LNG("; %06o:%06o -> %06o:"), wOpp1Addr, wOperand1, wOpp2Addr);
			}
			else
			{
				sprintf(str, LNG("; %06o:       -> %06o:"), wOpp1Addr, wOpp2Addr);
			}

			DisAsmPrint(str);
		}
		else if (nOpp1Addr < 0 && nOpp2Addr >= 0)
		{
			int nR = (-1 * nOpp1Addr) - 1;
			uint16_t wOpp2Addr = nOpp2Addr;
			uint16_t wOperand2 = GET_WORD(wOpp2Addr & (~1));

			if (g_Platform.ReadAccess(wOpp2Addr))
			{
				sprintf(str, LNG(";   R%i  :%06o -> %06o:%06o"), nR, r[nR], wOpp2Addr, wOperand2);
			}
			else
			{
				sprintf(str, LNG(";   R%i  :%06o -> %06o:"), nR, r[nR], wOpp2Addr);
			}

			DisAsmPrint(str);
		}
		else if (nOpp1Addr >= 0 && nOpp2Addr < 0)
		{
			uint16_t wOpp1Addr = nOpp1Addr;
			uint16_t wOperand = GET_WORD(wOpp1Addr & (~1));
			int nR = (-1 * nOpp2Addr) - 1;

			if (g_Platform.ReadAccess(wOpp1Addr))
			{
				sprintf(str, LNG("; %06o:%06o ->   R%i  :%06o"), wOpp1Addr, wOperand, nR, r[nR]);
			}
			else
			{
				sprintf(str, LNG("; %06o:       ->   R%i  :%06o"), wOpp1Addr, nR, r[nR]);
			}

			DisAsmPrint(str);
		}
		else
			// if( nOpp1Addr < 0 && nOpp2Addr < 0 )
		{
			int nRa = (-1 * nOpp1Addr) - 1;
			int nRb = (-1 * nOpp2Addr) - 1;
			sprintf(str, LNG(";   R%i  :%06o ->   R%i  :%06o"), nRa, r[nRa], nRb, r[nRb]);
			DisAsmPrint(str);
		}

		DisAsmPrint("\n");
		goto DONE;
	}

	if (nWord < 074000)
	{
		sprintf(str, LNG("%06o - Strange Opcode\n"), nWord);
		DisAsmPrint(str);
		goto DONE;
	}

	if (nWord <= 074777)
	{
		DisAsmPrint("XOR ");
		SkipPrintToOperandPosition();
		int nR = (nWord & 0700) >> 6;
		sprintf(str, "R%i, ", nR);
		DisAsmPrint(str);
		int nOppAddr = PrintOperand(nWord & 077);
		SkipPrintToCommentsPosition();

		if (nOppAddr >= 0)
		{
			uint16_t wOppAddr = (uint16_t)nOppAddr;
			uint16_t wOperand = GET_WORD(wOppAddr & (~1));

			if (g_Platform.ReadAccess(wOppAddr))
			{
				sprintf(str, LNG(";   R%i  :%06o -> %06o:%06o\n"), nR, r[nR], wOppAddr, wOperand);
			}
			else
			{
				sprintf(str, LNG(";   R%i  :%06o -> %06o:\n"), nR, r[nR], wOppAddr);
			}
		}
		else
		{
			int nRb = (-1 * nOppAddr) - 1;
			sprintf(str, LNG(";   R%i  :%06o ->   R%i  :%06o\n"), nR, r[nR], nRb, r[nRb]);
		}

		DisAsmPrint(str);
		goto DONE;
	}

	if (nWord < 077000)
	{
		sprintf(str, LNG("%06o - Strange Opcode\n"), nWord);
		DisAsmPrint(str);
		goto DONE;
	}

	if (nWord <= 077777)
	{
		DisAsmPrint("SOB ");
		SkipPrintToOperandPosition();
		int nR = (nWord & 0700) >> 6;
		sprintf(str, "R%i, %06o", nR, (PC - (nWord & 077) * 2));
		DisAsmPrint(str);
		SkipPrintToCommentsPosition();
		sprintf(str, LNG(";   R%i  :%06o\n"), nR, r[nR]);
		DisAsmPrint(str);
		goto DONE;
	}

	if (nWord <= 0103777)
	{
		switch (nWord & 03400)
		{
			case 00:
				DisAsmPrint("BPL ");
				break;

			case 0400:
				DisAsmPrint("BMI ");
				break;

			case 01000:
				DisAsmPrint("BHI ");
				break;

			case 01400:
				DisAsmPrint("BLOS ");
				break;

			case 02000:
				DisAsmPrint("BVC ");
				break;

			case 02400:
				DisAsmPrint("BVS ");
				break;

			case 03000:
				DisAsmPrint("BCC ");
				break;

			case 03400:
				DisAsmPrint("BCS ");
				break;

			default:
				sprintf(str, LNG("%06o - Strange Opcode\n"), nWord);
				DisAsmPrint(str);
				goto DONE;
		}

		int nOffset = (signed char)(nWord & 0377);
		nOffset *= 2;
		SkipPrintToOperandPosition();
		sprintf(str, "%06o", PC + nOffset);
		DisAsmPrint(str);
		//      SkipPrintToCommentsPosition();
		//      sprintf(str,";   m_PSW :%06o", m_PSW );
		//      DisAsmPrint(str);
		DisAsmPrint("\n");
		goto DONE;
	}

	if (nWord <= 0104377)
	{
		DisAsmPrint("EMT ");
		SkipPrintToOperandPosition();
		sprintf(str, "%o\n\n", nWord & 0377);
		DisAsmPrint(str);
		goto DONE;
	}

	if (nWord <= 0104777)
	{
		DisAsmPrint("TRAP ");
		SkipPrintToOperandPosition();
		sprintf(str, "%u.\n\n", nWord & 0377);
		DisAsmPrint(str);
		goto DONE;
	}

	if (nWord <= 0106377)
	{
		switch (nWord & 07700)
		{
			case 05000:
				DisAsmPrint("CLRB ");
				break;

			case 05100:
				DisAsmPrint("COMB ");
				break;

			case 05200:
				DisAsmPrint("INCB ");
				break;

			case 05300:
				DisAsmPrint("DECB ");
				break;

			case 05400:
				DisAsmPrint("NEGB ");
				break;

			case 05500:
				DisAsmPrint("ADCB ");
				break;

			case 05600:
				DisAsmPrint("SBCB ");
				break;

			case 05700:
				DisAsmPrint("TSTB ");
				break;

			case 06000:
				DisAsmPrint("RORB ");
				break;

			case 06100:
				DisAsmPrint("ROLB ");
				break;

			case 06200:
				DisAsmPrint("ASRB ");
				break;

			case 06300:
				DisAsmPrint("ASLB ");
				break;
		}

		SkipPrintToOperandPosition();
		int nOppAddr = PrintOperand(nWord & 077, 1);
		SkipPrintToCommentsPosition();

		if (nOppAddr >= 0)
		{
			uint16_t wOppAddr = nOppAddr;
			uint8_t cOperand = GET_BYTE(wOppAddr);

			if (g_Platform.ReadAccess(wOppAddr))
			{
				sprintf(str, LNG("; %06o:   %03o"), wOppAddr, cOperand);
			}
			else
			{
				sprintf(str, LNG("; %06o:      "), wOppAddr);
			}

			DisAsmPrint(str);
		}
		else
		{
			int nR = (-1 * nOppAddr) - 1;
			uint8_t cOperand = (uint8_t)r[nR];
			sprintf(str, LNG(";   R%i  :   %03o"), nR, cOperand);
			DisAsmPrint(str);
		}

		DisAsmPrint("\n");
		goto DONE;
	}

	if (nWord <= 0106477)
	{
		DisAsmPrint("MTPS ");
		SkipPrintToOperandPosition();
		int nOppAddr = PrintOperand(nWord & 077, 1);
		SkipPrintToCommentsPosition();

		if (nOppAddr >= 0)
		{
			uint16_t wOppAddr = nOppAddr;
			uint8_t cOperand = GET_BYTE(wOppAddr);

			if (g_Platform.ReadAccess(wOppAddr))
			{
				sprintf(str, LNG("; %06o:   %03o ->   m_PSW :%06o"), wOppAddr, cOperand, m_PSW);
			}
			else
			{
				sprintf(str, LNG("; %06o:       ->   m_PSW :%06o"), wOppAddr, m_PSW);
			}

			DisAsmPrint(str);
		}
		else
		{
			int nR = (-1 * nOppAddr) - 1;
			uint8_t cOperand = (uint8_t)r[nR];
			sprintf(str, LNG(";   R%i  :   %03o ->   m_PSW :%06o"), nR, cOperand, m_PSW);
			DisAsmPrint(str);
		}

		DisAsmPrint("\n");
		goto DONE;
	}

	if (nWord < 0106700)
	{
		sprintf(str, LNG("%06o - Strange Opcode\n"), nWord);
		DisAsmPrint(str);
		goto DONE;
	}

	if (nWord <= 0106777)
	{
		DisAsmPrint("MFPS ");
		SkipPrintToOperandPosition();
		int nOppAddr = PrintOperand(nWord & 077, 1);
		SkipPrintToCommentsPosition();

		if (nOppAddr >= 0)
		{
			uint16_t wOppAddr = nOppAddr;
			sprintf(str, LNG(";   m_PSW :   %03o -> %06o"), (uint8_t)m_PSW, wOppAddr);
			DisAsmPrint(str);
		}
		else
		{
			int nR = (-1 * nOppAddr) - 1;
			sprintf(str, LNG(";   m_PSW :   %03o ->   R%i"), (uint8_t)m_PSW, nR);
			DisAsmPrint(str);
		}

		DisAsmPrint("\n");
		goto DONE;
	}

	if (nWord < 0110000)
	{
		sprintf(str, LNG("%06o - Strange Opcode\n"), nWord);
		DisAsmPrint(str);
		goto DONE;
	}

	if (nWord <= 0117777)
	{
		DisAsmPrint("MOVB ");
		SkipPrintToOperandPosition();
		int nOpp1Addr = PrintOperand((nWord & 07700) >> 6, 1);
		DisAsmPrint(", ");
		int nOpp2Addr = PrintOperand2(nWord & 077, 1);
		SkipPrintToCommentsPosition();

		if (nOpp1Addr >= 0 && nOpp2Addr >= 0)
		{
			uint16_t wOpp1Addr = nOpp1Addr;
			uint8_t cOperand = GET_BYTE(wOpp1Addr);
			uint16_t wOpp2Addr = nOpp2Addr;

			if (g_Platform.ReadAccess(wOpp1Addr))
			{
				sprintf(str, LNG("; %06o:   %03o -> %06o"), wOpp1Addr, cOperand, wOpp2Addr);

				if ((wOpp2Addr == 0177566 || wOpp1Addr == 0177562) && cOperand > ' ')
				{
					char str1[64];
					sprintf(str1, "   '%c'", cOperand);
					strcat(str, str1);
				}
			}
			else
			{
				sprintf(str, LNG("; %06o:       -> %06o"), wOpp1Addr, wOpp2Addr);
			}

			DisAsmPrint(str);
		}
		else if (nOpp1Addr < 0 && nOpp2Addr > 0)
		{
			int nR = (-1 * nOpp1Addr) - 1;
			uint8_t cOperand = (uint8_t)r[nR];
			sprintf(str, LNG(";   R%i  :   %03o -> %06o"), nR, cOperand, nOpp2Addr);

			if (nOpp2Addr == 0177566 && cOperand > ' ')
			{
				char str1[64];
				sprintf(str1, "   '%c'", cOperand);
				strcat(str, str1);
			}

			DisAsmPrint(str);
		}
		else if (nOpp1Addr > 0 && nOpp2Addr < 0)
		{
			uint16_t wOpp1Addr = nOpp1Addr;
			uint8_t cOperand = GET_BYTE(wOpp1Addr);
			int nR = (-1 * nOpp2Addr) - 1;

			if (g_Platform.ReadAccess(wOpp1Addr))
			{
				sprintf(str, LNG("; %06o:   %03o ->   R%i  "), wOpp1Addr, cOperand, nR);

				if (wOpp1Addr == 0177562 && cOperand > ' ')
				{
					char str1[64];
					sprintf(str1, "   '%c'", cOperand);
					strcat(str, str1);
				}
			}
			else
			{
				sprintf(str, LNG("; %06o:       ->   R%i"), wOpp1Addr, nR);
			}

			DisAsmPrint(str);
		}
		else
			// if( nOpp1Addr < 0 && nOpp2Addr < 0 )
		{
			int nRa = (-1 * nOpp1Addr) - 1;
			uint8_t cOperand = (uint8_t)r[nRa];
			int nRb = (-1 * nOpp2Addr) - 1;
			sprintf(str, LNG(";   R%i  :   %03o ->   R%i"), nRa, cOperand, nRb);
			DisAsmPrint(str);
		}

		DisAsmPrint("\n");
		goto DONE;
	}

	if (nWord <= 0157777)
	{
		switch (nWord & 070000)
		{
			case 020000:
				DisAsmPrint("CMPB ");
				break;

			case 030000:
				DisAsmPrint("BITB ");
				break;

			case 040000:
				DisAsmPrint("BICB ");
				break;

			case 050000:
				DisAsmPrint("BISB ");
				break;
		}

		SkipPrintToOperandPosition();
		int nOpp1Addr = PrintOperand((nWord & 07700) >> 6, 1);
		DisAsmPrint(", ");
		int nOpp2Addr = PrintOperand2(nWord & 077, 1);
		SkipPrintToCommentsPosition();

		if (nOpp1Addr >= 0 && nOpp2Addr >= 0)
		{
			uint16_t wOpp1Addr = nOpp1Addr;
			uint8_t cOperand1 = GET_BYTE(wOpp1Addr);
			uint16_t wOpp2Addr = nOpp2Addr;
			uint8_t cOperand2 = GET_BYTE(wOpp2Addr);

			if (g_Platform.ReadAccess(wOpp1Addr) && g_Platform.ReadAccess(wOpp2Addr))
			{
				sprintf(str, LNG("; %06o:   %03o -> %06o:   %03o"), wOpp1Addr, cOperand1, wOpp2Addr, cOperand2);
			}
			else if (!g_Platform.ReadAccess(wOpp1Addr))
			{
				sprintf(str, LNG("; %06o:       -> %06o:   %03o"), wOpp1Addr, wOpp2Addr, cOperand2);
			}
			else if (!g_Platform.ReadAccess(wOpp2Addr))
			{
				sprintf(str, LNG("; %06o:   %03o -> %06o:"), wOpp1Addr, cOperand1, wOpp2Addr);
			}
			else
			{
				sprintf(str, LNG("; %06o:       -> %06o:"), wOpp1Addr, wOpp2Addr);
			}

			DisAsmPrint(str);
		}
		else if (nOpp1Addr < 0 && nOpp2Addr > 0)
		{
			int nR = (-1 * nOpp1Addr) - 1;
			uint8_t cOperand = (uint8_t)r[nR];
			uint16_t wOpp2Addr = nOpp2Addr;
			uint8_t cOperand2 = GET_BYTE(wOpp2Addr);

			if (g_Platform.ReadAccess(wOpp2Addr))
			{
				sprintf(str, LNG(";   R%i  :   %03o -> %06o:   %03o"), nR, cOperand, wOpp2Addr, cOperand2);
			}
			else
			{
				sprintf(str, LNG(";   R%i  :   %03o -> %06o:"), nR, cOperand, wOpp2Addr);
			}

			DisAsmPrint(str);
		}
		else if (nOpp1Addr > 0 && nOpp2Addr < 0)
		{
			uint16_t wOpp1Addr = nOpp1Addr;
			uint8_t cOperand = GET_BYTE(wOpp1Addr);
			int nR = (-1 * nOpp2Addr) - 1;

			if (g_Platform.ReadAccess(wOpp1Addr))
			{
				sprintf(str, LNG("; %06o:   %03o ->   R%i  :   %03o"), wOpp1Addr, cOperand, nR, (uint8_t)r[nR]);
			}
			else
			{
				sprintf(str, LNG("; %06o:       ->   R%i  :   %03o"), wOpp1Addr, nR, (uint8_t)r[nR]);
			}

			DisAsmPrint(str);
		}
		else
			// if( nOpp1Addr < 0 && nOpp2Addr < 0 )
		{
			int nRa = (-1 * nOpp1Addr) - 1;
			auto cOperand = static_cast<uint8_t>(r[nRa]);
			int nRb = (-1 * nOpp2Addr) - 1;
			sprintf(str, LNG(";   R%i  :   %03o ->   R%i  :   %03o"), nRa, cOperand, nRb, (uint8_t)r[nRb]);
			DisAsmPrint(str);
		}

		DisAsmPrint("\n");
		goto DONE;
	}

	if (nWord <= 0167777)
	{
		DisAsmPrint("SUB ");
		SkipPrintToOperandPosition();
		int nOpp1Addr = PrintOperand((nWord & 07700) >> 6);
		DisAsmPrint(", ");
		int nOpp2Addr = PrintOperand2(nWord & 077);
		SkipPrintToCommentsPosition();

		if (nOpp1Addr >= 0 && nOpp2Addr >= 0)
		{
			uint16_t wOpp1Addr = nOpp1Addr;
			uint16_t wOperand1 = GET_WORD(wOpp1Addr & (~1));
			uint16_t wOpp2Addr = nOpp2Addr;
			uint16_t wOperand2 = GET_WORD(wOpp2Addr & (~1));

			if (g_Platform.ReadAccess(wOpp1Addr) && g_Platform.ReadAccess(wOpp2Addr))
			{
				sprintf(str, LNG("; %06o:%06o -> %06o:%06o"), wOpp1Addr, wOperand1, wOpp2Addr, wOperand2);
			}
			else if (!g_Platform.ReadAccess(wOpp1Addr))
			{
				sprintf(str, LNG("; %06o:       -> %06o:%06o"), wOpp1Addr, wOpp2Addr, wOperand2);
			}
			else if (!g_Platform.ReadAccess(wOpp2Addr))
			{
				sprintf(str, LNG("; %06o:%06o -> %06o:"), wOpp1Addr, wOperand1, wOpp2Addr);
			}
			else
			{
				sprintf(str, LNG("; %06o:       -> %06o:"), wOpp1Addr, wOpp2Addr);
			}

			DisAsmPrint(str);
		}
		else if (nOpp1Addr < 0 && nOpp2Addr >= 0)
		{
			int nR = (-1 * nOpp1Addr) - 1;
			uint16_t wOpp2Addr = nOpp2Addr;
			uint16_t wOperand2 = GET_WORD(wOpp2Addr & (~1));

			if (g_Platform.ReadAccess(wOpp2Addr))
			{
				sprintf(str, LNG(";   R%i  :%06o -> %06o:%06o"), nR, r[nR], wOpp2Addr, wOperand2);
			}
			else
			{
				sprintf(str, LNG(";   R%i  :%06o -> %06o:"), nR, r[nR], wOpp2Addr);
			}

			DisAsmPrint(str);
		}
		else if (nOpp1Addr >= 0 && nOpp2Addr < 0)
		{
			uint16_t wOpp1Addr = nOpp1Addr;
			uint16_t wOperand = GET_WORD(wOpp1Addr & (~1));
			int nR = (-1 * nOpp2Addr) - 1;

			if (g_Platform.ReadAccess(wOpp1Addr))
			{
				sprintf(str, LNG("; %06o:%06o ->   R%i  :%06o"), wOpp1Addr, wOperand, nR, r[nR]);
			}
			else
			{
				sprintf(str, LNG("; %06o:       ->   R%i  :%06o"), wOpp1Addr, nR, r[nR]);
			}

			DisAsmPrint(str);
		}
		else
			// if( nOpp1Addr < 0 && nOpp2Addr < 0 )
		{
			int nRa = (-1 * nOpp1Addr) - 1;
			int nRb = (-1 * nOpp2Addr) - 1;
			sprintf(str, LNG(";   R%i  :%06o ->   R%i  :%06o"), nRa, r[nRa], nRb, r[nRb]);
			DisAsmPrint(str);
		}

		DisAsmPrint("\n");
		goto DONE;
	}

	sprintf(str, LNG("%06o - Strange Opcode\n"), nWord);
	DisAsmPrint(str);
DONE:
	PC = PC_res;
}


