Exemplo n.º 1
0
	//=================================================================================================
	void Assignment()
	{
		axStringA strA("test");
		axStringW strW(L"test");

		axStringA strCopyA = strA;
		axStringW strCopyW = strW;

		axUTest(strCopyA == strA);
		axUTest(strCopyW == strW);

		axUTest(strCopyA.Sz() != strA.Sz());
		axUTest(strCopyW.Sz() != strW.Sz());

		strA = "assignment";
		strW = L"assignment";

		strCopyA = strA;
		strCopyW = strW;

		axUTest(strCopyA == strA);
		axUTest(strCopyW == strW);

		axUTest(strCopyA.Sz() != strA.Sz());
		axUTest(strCopyW.Sz() != strW.Sz());
	}
Exemplo n.º 2
0
LRESULT CLogOptionsDlg::OnInitDialog(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
{
#ifdef OS_WINCE
	SHINITDLGINFO shidi;
	shidi.dwMask = SHIDIM_FLAGS; 
	shidi.dwFlags = SHIDIF_SIZEDLGFULLSCREEN;//SHIDIF_DONEBUTTON | SHIDIF_SIZEDLGFULLSCREEN |SHIDIF_EMPTYMENU; 
	shidi.hDlg = m_hWnd; 
	SHInitDialog(&shidi);

    SHMENUBARINFO mbi = { sizeof(mbi), 0 };
    mbi.hwndParent = m_hWnd;
    mbi.nToolBarId = IDR_LOGOPTIONSMENUBAR; // ID of toolbar resource
    mbi.hInstRes = _AtlBaseModule.GetResourceInstance();
    mbi.dwFlags    = SHCMBF_HMENU;
    RHO_ASSERT(SHCreateMenuBar(&mbi));
#endif //OS_WINCE

    SendDlgItemMessage(IDC_CBXLEVELS,CB_ADDSTRING,0,  (LPARAM)_T("Trace"));
    SendDlgItemMessage(IDC_CBXLEVELS,CB_ADDSTRING,0,  (LPARAM)_T("Info"));
    SendDlgItemMessage(IDC_CBXLEVELS,CB_ADDSTRING,0,  (LPARAM)_T("Warning"));
    SendDlgItemMessage(IDC_CBXLEVELS,CB_ADDSTRING,0,  (LPARAM)_T("Error"));

    SendDlgItemMessage(IDC_CBXLEVELS,CB_SETCURSEL,LOGCONF().getMinSeverity(),0);

    CStringW strW(LOGCONF().getEnabledCategories().c_str());
    SetDlgItemText(IDC_MSGCLASSES, strW );
    strW = LOGCONF().getDisabledCategories().c_str();
    SetDlgItemText(IDC_MSGEXCLUDE, strW );

	bHandled = TRUE;
	return 1;  // Let the system set the focus
}
Exemplo n.º 3
0
	//=================================================================================================
	void Length()
	{
		axStringA strA("test");
		axStringW strW(L"test");

		axUTest(strA.GetLength() == 4);
		axUTest(strW.GetLength() == 4);

		strA = "assignment";
		strW = L"assignment";

		axUTest(strA.GetLength() == 10);
		axUTest(strW.GetLength() == 10);
	}
Exemplo n.º 4
0
void PrintUnicode(const String& str, bool error)
{
    #if !defined(ANDROID) && !defined(IOS)
    #ifdef _WIN32
    HANDLE stream = GetStdHandle(error ? STD_ERROR_HANDLE : STD_OUTPUT_HANDLE);
    if (stream == INVALID_HANDLE_VALUE)
        return;
    WString strW(str);
    DWORD charsWritten;
    WriteConsoleW(stream, strW.CString(), (DWORD)strW.Length(), &charsWritten, 0);
    #else
    fprintf(error ? stderr : stdout, "%s", str.CString());
    #endif
    #endif
}
Exemplo n.º 5
0
LRESULT CLogOptionsDlg::OnInitDialog(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
{
#if defined( OS_WINCE )
if(winversion == 1)
{
//#if defined( OS_WINCE ) && !defined (OS_PLATFORM_MOTCE)
	SHINITDLGINFO shidi;
	shidi.dwMask = SHIDIM_FLAGS; 
	shidi.dwFlags = SHIDIF_SIZEDLGFULLSCREEN;//SHIDIF_DONEBUTTON | SHIDIF_SIZEDLGFULLSCREEN |SHIDIF_EMPTYMENU; 
	shidi.hDlg = m_hWnd; 
	SHInitDialog(&shidi);

    SHMENUBARINFO mbi = { sizeof(mbi), 0 };
    mbi.hwndParent = m_hWnd;
    mbi.nToolBarId = IDR_LOGOPTIONSMENUBAR; // ID of toolbar resource
    mbi.hInstRes = _AtlBaseModule.GetResourceInstance();
    mbi.dwFlags    = SHCMBF_HMENU;
    SHCreateMenuBar(&mbi);
}
else if(winversion == 2)
{
//#elif defined (OS_PLATFORM_MOTCE) 
	SetWindowLong(GWL_STYLE,(long)WS_BORDER);

	m_hWndCommandBar = CommandBar_Create(_AtlBaseModule.GetResourceInstance(), m_hWnd, 1);
	CommandBar_AddAdornments(m_hWndCommandBar, CMDBAR_OK, 0 );
    CommandBar_Show(m_hWndCommandBar, TRUE);
//#endif //OS_WINCE
}
#endif

    SendDlgItemMessage(IDC_CBXLEVELS,CB_ADDSTRING,0,  (LPARAM)_T("Trace"));
    SendDlgItemMessage(IDC_CBXLEVELS,CB_ADDSTRING,0,  (LPARAM)_T("Info"));
    SendDlgItemMessage(IDC_CBXLEVELS,CB_ADDSTRING,0,  (LPARAM)_T("Warning"));
    SendDlgItemMessage(IDC_CBXLEVELS,CB_ADDSTRING,0,  (LPARAM)_T("Error"));

    SendDlgItemMessage(IDC_CBXLEVELS,CB_SETCURSEL,LOGCONF().getMinSeverity(),0);

    CStringW strW(LOGCONF().getEnabledCategories().c_str());
    SetDlgItemText(IDC_MSGCLASSES, strW );
    strW = LOGCONF().getDisabledCategories().c_str();
    SetDlgItemText(IDC_MSGEXCLUDE, strW );

	bHandled = TRUE;
	return 1;  // Let the system set the focus
}
Exemplo n.º 6
0
	//=================================================================================================
	void Getter()
	{
		axStringA strA("test");
		axStringW strW(L"test");

		axUTest(strA[0] == 't');
		axUTest(strW[0] == L't');

		axUTest(strA[1] == 'e');
		axUTest(strW[1] == L'e');

		axUTest(strA[2] == 's');
		axUTest(strW[2] == L's');

		axUTest(strA[3] == 't');
		axUTest(strW[3] == L't');

		axUTest(strA[4] == '\0');
		axUTest(strW[4] == L'\0');
	}
Exemplo n.º 7
0
void disassembleInstruction(void) {
    std::string tmpstr;
    std::string old;
    std::string w;

    disasm.new_address = disasm.base_address;

    disasmHighlight.hit_read_breakpoint = false;
    disasmHighlight.hit_write_breakpoint = false;
    disasmHighlight.hit_exec_breakpoint = false;
    disasmHighlight.hit_pc = false;

    disasm.instruction.data = "";
    disasm.instruction.opcode = "";
    disasm.instruction.mode_suffix = " ";
    disasm.instruction.arguments = "";
    disasm.instruction.size = 0;

    disasm.il = disasm.adl;
    disasm.l = disasm.adl;
    disasm.prefix = false;
    disasm.suffix = false;

    union {
        uint8_t opcode;
        struct {
            uint8_t z : 3;
            uint8_t y : 3;
            uint8_t x : 2;
        };
        struct {
            uint8_t r : 1;
            uint8_t dummy : 2;
            uint8_t q : 1;
            uint8_t p : 2;
        };
    } context;

    do {
        // fetch opcode
        context.opcode = disasm_fetch_byte();

        switch (context.x) {
            case 0:
                switch (context.z) {
                    case 0:
                        switch (context.y) {
                            case 0:  // NOP
                                disasm.instruction.opcode = "nop";
                                break;
                            case 1:  // EX af,af'
                                disasm.instruction.opcode = "ex";
                                disasm.instruction.arguments = "af,af'";
                                break;
                            case 2: // DJNZ d
                                disasm.instruction.opcode = "djnz";
                                disasm.instruction.arguments = strW(disasm.new_address+1+disasm_fetch_offset());
                                break;
                            case 3: // JR d
                                disasm.instruction.opcode = "jr";
                                disasm.instruction.arguments = strW(disasm.new_address+1+disasm_fetch_offset());
                                break;
                            case 4:
                            case 5:
                            case 6:
                            case 7: // JR cc[y-4], d
                                disasm.instruction.opcode = "jr";
                                disasm.instruction.arguments = cc_table[context.y-4]+","+ strW(disasm.new_address+1+disasm_fetch_offset());
                                break;
                        }
                        break;
                    case 1:
                        switch (context.q) {
                            case 0: // LD rr, Mmn
                                if (context.p == 3 && disasm.prefix) { // LD IY/IX, (IX/IY + d)
                                    disasm.instruction.opcode = "ld";
                                    disasm.instruction.arguments = index_table[disasm.prefix] + ",(" + index_table[disasm.prefix ^ 1] + strOffset(disasm_fetch_offset()) + ")" ;
                                    break;
                                }
                                disasm.instruction.opcode = "ld";
                                disasm.instruction.arguments = disasm_read_rp(context.p)+","+strW(disasm_fetch_word());
                                break;
                            case 1: // ADD HL,rr
                                disasm.instruction.opcode = "add";
                                disasm.instruction.arguments = index_table[disasm.prefix]+","+disasm_read_rp(context.p);
                                break;
                        }
                        break;
                    case 2:
                        switch (context.q) {
                            case 0:
                                switch (context.p) {
                                    case 0: // LD (BC), A
                                        disasm.instruction.opcode = "ld";
                                        disasm.instruction.arguments = "(bc),a";
                                        break;
                                    case 1: // LD (DE), A
                                        disasm.instruction.opcode = "ld";
                                        disasm.instruction.arguments = "(de),a";
                                        break;
                                    case 2: // LD (Mmn), HL
                                        disasm.instruction.opcode = "ld";
                                        disasm.instruction.arguments = strWind(disasm_fetch_word())+","+index_table[disasm.prefix];
                                        break;
                                    case 3: // LD (Mmn), A
                                        disasm.instruction.opcode = "ld";
                                        disasm.instruction.arguments = strWind(disasm_fetch_word())+",a";
                                        break;
                                }
                                break;
                            case 1:
                                switch (context.p) {
                                    case 0: // LD A, (BC)
                                        disasm.instruction.opcode = "ld";
                                        disasm.instruction.arguments = "a,(bc)";
                                        break;
                                    case 1: // LD A, (DE)
                                        disasm.instruction.opcode = "ld";
                                        disasm.instruction.arguments = "a,(de)";
                                        break;
                                    case 2: // LD HL, (Mmn)
                                        disasm.instruction.opcode = "ld";
                                        disasm.instruction.arguments = index_table[disasm.prefix]+","+strWind(disasm_fetch_word());
                                        break;
                                    case 3: // LD A, (Mmn)
                                        disasm.instruction.opcode = "ld";
                                        disasm.instruction.arguments = "a,"+strWind(disasm_fetch_word());
                                        break;
                                }
                                break;
                        }
                        break;
                    case 3:
                        switch (context.q) {
                            case 0: // INC rp[p]
                                disasm.instruction.opcode = "inc";
                                disasm.instruction.arguments = disasm_read_rp(context.p);
                                break;
                            case 1: // DEC rp[p]
                                disasm.instruction.opcode = "dec";
                                disasm.instruction.arguments = disasm_read_rp(context.p);
                                break;
                        }
                        break;
                    case 4: // INC r[y]
                        disasm.instruction.opcode = "inc";
                        w = (context.y == 6) ? disasm_index_address() : "0";
                        disasm.instruction.arguments = disasm_read_reg_prefetched(context.y, w);
                        break;
                    case 5: // DEC r[y]
                        disasm.instruction.opcode = "dec";
                        w = (context.y == 6) ? disasm_index_address() : "0";
                        disasm.instruction.arguments = disasm_read_reg_prefetched(context.y, w);
                        break;
                    case 6: // LD r[y], n
                        if (context.y == 7 && disasm.prefix) { // LD (IX/IY + d), IY/IX
                            disasm.instruction.opcode = "ld";
                            disasm.instruction.arguments = "("+index_table[disasm.prefix]+strOffset(disasm_fetch_offset())+"),"+index_table[disasm.prefix ^ 1];
                            break;
                        }
                        disasm.instruction.opcode = "ld";
                        w = (context.y == 6) ? disasm_index_address() : "0";
                        if(!disasm.prefix) {
                            w = "("+w+"),";
                        }
                        disasm_write_reg_prefetched(context.y, w, strS(disasm_fetch_byte()));
                        break;
                    case 7:
                        if (disasm.prefix) {
                            if (context.q) { // LD (IX/IY + d), rp3[p]
                                disasm.instruction.opcode = "ld";
                                disasm.instruction.arguments = "("+index_table[disasm.prefix]+strOffset(disasm_fetch_offset())+"),"+disasm_read_rp3(context.p);
                            } else { // LD rp3[p], (IX/IY + d)
                                disasm.instruction.opcode = "ld";
                                disasm.instruction.arguments = disasm_read_rp3(context.p)+",("+index_table[disasm.prefix]+strOffset(disasm_fetch_offset())+")";
                            }
                        } else {
                            disasm.instruction.opcode = rot_acc_table[context.y];
                        }
                        break;
                }
                break;
            case 1: // ignore prefixed prefixes
                if (context.z == context.y) {
                    switch (context.z) {
                        case 0: // .SIS
                            disasm.suffix = 1;
                            disasm.instruction.mode_suffix = ".sis ";
                            disasm.l = false;
                            disasm.il = false;
                            goto exit_loop;
                        case 1: // .LIS
                            disasm.suffix = 1;
                            disasm.instruction.mode_suffix = ".lis ";
                            disasm.l = true;
                            disasm.il = false;
                            goto exit_loop;
                        case 2: // .SIL
                            disasm.suffix = 1;
                            disasm.instruction.mode_suffix = ".sil ";
                            disasm.l = false;
                            disasm.il = true;
                            goto exit_loop;
                        case 3: // .LIL
                            disasm.suffix = 1;
                            disasm.instruction.mode_suffix = ".lil ";
                            disasm.l = true;
                            disasm.il = true;
                            goto exit_loop;
                        case 6: // HALT
                            disasm.instruction.opcode = "halt";
                            break;
                        case 4: // LD H, H
                            disasm.instruction.opcode = "ld";
                            disasm.instruction.arguments = index_h[disasm.prefix]+","+index_h[disasm.prefix];
                            break;
                        case 5: // LD L, L
                            disasm.instruction.opcode = "ld";
                            disasm.instruction.arguments = index_l[disasm.prefix]+","+index_l[disasm.prefix];
                            break;
                        case 7: // LD A, A
                            disasm.instruction.opcode = "ld";
                            disasm.instruction.opcode = "a,a";
                            break;
                        default:
                            abort();
                    }
                } else {
                    disasm_read_write_reg(context.z, context.y);
                }
                break;
            case 2: // ALU[y] r[z]
                disasm.instruction.opcode = alu_table[context.y];
                disasm.instruction.arguments = "a,"+disasm_read_reg(context.z);
                break;
            case 3:
                switch (context.z) {
                    case 0: // RET cc[y]
                        disasm.instruction.opcode = "ret";
                        disasm.instruction.arguments = cc_table[context.y];
                        break;
                    case 1:
                        switch (context.q) {
                            case 0: // POP rp2[p]
                                disasm.instruction.opcode = "pop";
                                disasm.instruction.arguments = disasm_read_rp2(context.p);
                                break;
                            case 1:
                                switch (context.p) {
                                    case 0: // RET
                                        disasm.instruction.opcode = "ret";
                                        break;
                                    case 1: // EXX
                                        disasm.instruction.opcode = "exx";
                                        break;
                                    case 2: // JP (rr)
                                        disasm.instruction.opcode = "jp";
                                        disasm.instruction.arguments = "("+index_table[disasm.prefix]+")";
                                        break;
                                    case 3: // LD SP, INDEX
                                        disasm.instruction.opcode = "ld";
                                        disasm.instruction.arguments = "sp,"+index_table[disasm.prefix];
                                        break;
                                }
                                break;
                        }
                        break;
                    case 2: // JP cc[y], nn
                        disasm.instruction.opcode = "jp";
                        disasm.instruction.arguments = cc_table[context.y]+","+strW(disasm_fetch_word());
                        break;
                    case 3:
                        switch (context.y) {
                            case 0: // JP nn
                                disasm.instruction.opcode = "jp";
                                disasm.instruction.arguments = strW(disasm_fetch_word());
                                break;
                            case 1: // 0xCB prefixed opcodes
                                w = disasm_index_address();
                                context.opcode = disasm_fetch_byte();
                                old = disasm_read_reg_prefetched(context.z, w);
                                switch (context.x) {
                                    case 0: // rot[y] r[z]
                                        disasm.instruction.opcode = rot_table[context.y];
                                        disasm.instruction.arguments = old;
                                        break;
                                    case 1: // BIT y, r[z]
                                        disasm.instruction.opcode = "bit";
                                        disasm.instruction.arguments = std::to_string(context.y)+","+old;
                                        break;
                                    case 2: // RES y, r[z]
                                        disasm.instruction.opcode = "res";
                                        disasm.instruction.arguments = std::to_string(context.y)+","+old;
                                        break;
                                    case 3: // SET y, r[z]
                                        disasm.instruction.opcode = "set";
                                        disasm.instruction.arguments = std::to_string(context.y)+","+old;
                                        break;
                                }
                                break;
                            case 2: // OUT (n), A
                                disasm.instruction.opcode = "out";
                                disasm.instruction.arguments = strSind(disasm_fetch_byte())+",a";
                                break;
                            case 3: // IN A, (n)
                                disasm.instruction.opcode = "in";
                                disasm.instruction.arguments = "a,"+strSind(disasm_fetch_byte());
                                break;
                            case 4: // EX (SP), HL/I
                                disasm.instruction.opcode = "ex";
                                disasm.instruction.arguments = "(sp),"+index_table[disasm.prefix];
                                break;
                            case 5: // EX DE, HL
                                disasm.instruction.opcode = "ex";
                                disasm.instruction.arguments = "de,hl";
                                break;
                            case 6: // DI
                                disasm.instruction.opcode = "di";
                                break;
                            case 7: // EI
                                disasm.instruction.opcode = "ei";
                                continue;
                        }
                        break;
                    case 4: // CALL cc[y], nn
                        disasm.instruction.opcode = "call";
                        disasm.instruction.arguments = cc_table[context.y]+","+strW(disasm_fetch_word());
                        break;
                    case 5:
                        switch (context.q) {
                            case 0: // PUSH r2p[p]
                                disasm.instruction.opcode = "push";
                                disasm.instruction.arguments = disasm_read_rp2(context.p);
                                break;
                            case 1:
                                switch (context.p) {
                                    case 0: // CALL nn
                                        disasm.instruction.opcode = "call";
                                        disasm.instruction.arguments = strW(disasm_fetch_word());
                                        break;
                                    case 1: // 0xDD prefixed opcodes
                                        disasm.prefix = 2;
                                        goto exit_loop;
                                    case 2: // 0xED prefixed opcodes
                                        disasm.prefix = 0; // ED cancels effect of DD/FD prefix
                                        context.opcode = disasm_fetch_byte();
                                        switch (context.x) {
                                            case 0:
                                                switch (context.z) {
                                                    case 0:
                                                        if (context.y == 6) { // OPCODETRAP
                                                            disasm.instruction.opcode = "OPCODETRAP";
                                                        } else { // IN0 r[y], (n)
                                                            disasm.instruction.opcode = "in0";
                                                            disasm.instruction.arguments = disasm_read_reg(context.y)+","+strSind(disasm_fetch_byte());
                                                        }
                                                        break;
                                                     case 1:
                                                        if (context.y == 6) { // LD IY, (HL)
                                                            disasm.instruction.opcode = "ld";
                                                            disasm.instruction.arguments = "iy,(hl)";
                                                        } else { // OUT0 (n), r[y]
                                                            disasm.instruction.opcode = "out0";
                                                            disasm.instruction.arguments = strSind(disasm_fetch_byte())+","+disasm_read_reg(context.y);
                                                        }
                                                        break;
                                                    case 2: // LEA rp3[p], IX + d
                                                    case 3: // LEA rp3[p], IY + d
                                                        if (context.q) { // OPCODETRAP
                                                            disasm.instruction.opcode = "OPCODETRAP";
                                                        } else {
                                                            disasm.prefix = context.z;
                                                            disasm.instruction.opcode = "lea";
                                                            disasm.instruction.arguments = disasm_read_rp3(context.p)+","+index_table[context.z]+strOffset(disasm_fetch_offset());
                                                        }
                                                        break;
                                                    case 4: // TST A, r[y]
                                                        disasm.instruction.opcode = "tst";
                                                        disasm.instruction.arguments = "a,"+disasm_read_reg(context.y);
                                                        break;
                                                    case 6:
                                                        if (context.y == 7) { // LD (HL), IY
                                                            disasm.instruction.opcode = "ld";
                                                            disasm.instruction.arguments = "(hl),iy";
                                                            break;
                                                        }
                                                    case 5: // OPCODETRAP
                                                        disasm.instruction.opcode = "OPCODETRAP";
                                                        break;
                                                    case 7:
                                                        disasm.prefix = 2;
                                                        if (context.q) { // LD (HL), rp3[p]
                                                            disasm.instruction.opcode = "ld";
                                                            disasm.instruction.arguments = "(hl),"+disasm_read_rp3(context.p);
                                                        } else { // LD rp3[p], (HL)
                                                            disasm.instruction.opcode = "ld";
                                                            disasm.instruction.arguments = disasm_read_rp3(context.p)+",(hl)";
                                                        }
                                                        break;
                                                }
                                                break;
                                            case 1:
                                                switch (context.z) {
                                                    case 0:
                                                        if (context.y == 6) { // OPCODETRAP (ADL)
                                                            disasm.instruction.opcode = "OPCODETRAP";
                                                        } else { // IN r[y], (BC)
                                                            disasm.instruction.opcode = "in";
                                                            disasm.instruction.arguments = disasm_read_reg(context.y)+",(bc)";
                                                        }
                                                        break;
                                                    case 1:
                                                        if (context.y == 6) { // OPCODETRAP (ADL)
                                                            disasm.instruction.opcode = "OPCODETRAP";
                                                        } else { // OUT (BC), r[y]
                                                            disasm.instruction.opcode = "out";
                                                            disasm.instruction.arguments = "(bc),"+disasm_read_reg(context.y);
                                                        }
                                                        break;
                                                    case 2:
                                                        if (context.q == 0) { // SBC HL, rp[p]
                                                            disasm.instruction.opcode = "sbc";
                                                            disasm.instruction.arguments = "hl,"+disasm_read_rp(context.p);
                                                        } else { // ADC HL, rp[p]
                                                            disasm.instruction.opcode = "adc";
                                                            disasm.instruction.arguments = "hl,"+disasm_read_rp(context.p);
                                                        }
                                                        break;
                                                    case 3:
                                                        if (context.q == 0) { // LD (nn), rp[p]
                                                            disasm.instruction.opcode = "ld";
                                                            disasm.instruction.arguments = strWind(disasm_fetch_word())+","+disasm_read_rp(context.p);
                                                        } else { // LD rp[p], (nn)
                                                            disasm.instruction.opcode = "ld";
                                                            disasm.instruction.arguments = disasm_read_rp(context.p)+","+strWind(disasm_fetch_word());
                                                        }
                                                        break;
                                                    case 4:
                                                        if (context.q == 0) {
                                                            switch (context.p) {
                                                                case 0:  // NEG
                                                                    disasm.instruction.opcode = "neg";
                                                                    break;
                                                                case 1:  // LEA IX, IY + d
                                                                    disasm.instruction.opcode = "lea";
                                                                    disasm.instruction.arguments = "ix,iy"+strOffset(disasm_fetch_byte());
                                                                    break;
                                                                case 2:  // TST A, n
                                                                    disasm.instruction.opcode = "tst";
                                                                    disasm.instruction.arguments = "a,"+strS(disasm_fetch_byte());
                                                                    break;
                                                                case 3:  // TSTIO n
                                                                    disasm.instruction.opcode = "tstio";
                                                                    disasm.instruction.arguments = strS(disasm_fetch_byte());
                                                                    break;
                                                            }
                                                        }
                                                        else { // MLT rp[p]
                                                            disasm.instruction.opcode = "mlt";
                                                            disasm.instruction.arguments = disasm_read_rp(context.p);
                                                            break;
                                                        }
                                                        break;
                                                    case 5:
                                                        switch (context.y) {
                                                            case 0: // RETN
                                                                disasm.instruction.opcode = "retn";
                                                                break;
                                                            case 1: // RETI
                                                                disasm.instruction.opcode = "reti";
                                                                break;
                                                            case 2: // LEA IY, IX + d
                                                                disasm.instruction.opcode = "lea";
                                                                disasm.instruction.arguments = "iy,ix"+strOffset(disasm_fetch_offset());
                                                                break;
                                                            case 3:
                                                            case 6: // OPCODETRAP
                                                                disasm.instruction.opcode = "OPCODETRAP";
                                                                break;
                                                            case 4: // PEA IX + d
                                                                disasm.instruction.opcode = "pea";
                                                                disasm.instruction.arguments = "ix"+strOffset(disasm_fetch_offset());
                                                                break;
                                                            case 5: // LD MB, A
                                                                if (disasm.il) {
                                                                    disasm.instruction.opcode = "ld";
                                                                    disasm.instruction.arguments = "mb,a";
                                                                } else { // OPCODETRAP
                                                                    disasm.instruction.opcode = "OPCODETRAP";
                                                                }
                                                                break;
                                                            case 7: // STMIX
                                                                disasm.instruction.opcode = "stmix";
                                                                break;
                                                        }
                                                        break;
                                                    case 6: // IM im[y]
                                                        switch (context.y) {
                                                            case 0:
                                                            case 2:
                                                            case 3: // IM im[y]
                                                                disasm.instruction.opcode = "im";
                                                                disasm.instruction.arguments = im_table[context.y];
                                                                break;
                                                            case 1: // OPCODETRAP
                                                                disasm.instruction.opcode = "OPCODETRAP";
                                                                break;
                                                            case 4: // PEA IY + d
                                                                disasm.instruction.opcode = "pea";
                                                                disasm.instruction.arguments = "iy"+strOffset(disasm_fetch_offset());
                                                                break;
                                                            case 5: // LD A, MB
                                                                if (disasm.il) {
                                                                    disasm.instruction.opcode = "ld";
                                                                    disasm.instruction.arguments = "a,mb";
                                                                } else { // OPCODETRAP
                                                                    disasm.instruction.opcode = "OPCODETRAP";
                                                                }
                                                                break;
                                                            case 6: // SLP
                                                                disasm.instruction.arguments = "slp";
                                                                break;
                                                            case 7: // RSMIX
                                                                disasm.instruction.opcode = "rsmix";
                                                                break;
                                                        }
                                                        break;
                                                    case 7:
                                                        switch (context.y) {
                                                            case 0: // LD I, A
                                                                disasm.instruction.opcode = "ld";
                                                                disasm.instruction.arguments = "i,a";
                                                                break;
                                                            case 1: // LD R, A
                                                                disasm.instruction.opcode = "ld";
                                                                disasm.instruction.arguments = "r,a";
                                                                break;
                                                            case 2: // LD A, I
                                                                disasm.instruction.opcode = "ld";
                                                                disasm.instruction.arguments = "a,i";
                                                                break;
                                                            case 3: // LD A, R
                                                                disasm.instruction.opcode = "ld";
                                                                disasm.instruction.arguments = "a,r";
                                                                break;
                                                            case 4: // RRD
                                                                disasm.instruction.opcode = "rrd";
                                                                break;
                                                            case 5: // RLD
                                                                disasm.instruction.opcode = "rld";
                                                                break;
                                                            default: // OPCODETRAP
                                                                disasm.instruction.opcode = "OPCODETRAP";
                                                                break;
                                                        }
                                                        break;
                                                }
                                                break;
                                            case 2:
                                                if (context.y >= 0 && context.z <= 4) { // bli[y,z]
                                                    disasm_bli(context.y, context.z);
                                                } else { // OPCODETRAP
                                                    disasm.instruction.opcode = "OPCODETRAP";
                                                }
                                                break;
                                            case 3:  // There are only a few of these, so a simple switch for these shouldn't matter too much
                                                switch(context.opcode) {
                                                    case 0xC2: // INIRX
                                                        disasm.instruction.opcode = "inirx";
                                                        break;
                                                    case 0xC3: // OTIRX
                                                        disasm.instruction.opcode = "otirx";
                                                        break;
                                                    case 0xC7: // LD I, HL
                                                        disasm.instruction.opcode = "ld";
                                                        disasm.instruction.arguments = "i,hl";
                                                        break;
                                                    case 0xD7: // LD HL, I
                                                        disasm.instruction.opcode = "ld";
                                                        disasm.instruction.arguments = "hl,i";
                                                        break;
                                                    case 0xCA: // INDRX
                                                        disasm.instruction.opcode = "indrx";
                                                        break;
                                                    case 0xCB: // OTDRX
                                                        disasm.instruction.opcode = "otdrx";
                                                        break;
                                                    case 0xEE: // flash erase
                                                        disasm.instruction.opcode = "FLASH_ERASE";
                                                        break;
                                                    default:   // OPCODETRAP
                                                        disasm.instruction.opcode = "OPCODETRAP";
                                                        break;
                                                }
                                                break;
                                            default: // OPCODETRAP
                                                disasm.instruction.opcode = "OPCODETRAP";
                                                break;
                                        }
                                        break;
                                    case 3: // 0xFD prefixed opcodes
                                        disasm.prefix = 3;
                                        goto exit_loop;
                                }
                                break;
                        }
                        break;
                    case 6: // alu[y] n
                        disasm.instruction.opcode = alu_table[context.y];
                        disasm.instruction.arguments = "a,"+strS(disasm_fetch_byte());
                        break;
                    case 7: // RST y*8
                        disasm.instruction.opcode = "rst";
                        disasm.instruction.arguments = strS(context.y << 3);
                        break;
                }
                break;
        }
        disasm.suffix = disasm.prefix = 0;
exit_loop:
      continue;
    } while (disasm.prefix || disasm.suffix);
}
Exemplo n.º 8
0
static std::string strWind(uint32_t data) {
    return "("+strW(data)+")";
}