diff --git a/Dasm6301.cpp b/Dasm6301.cpp index f2dcb77..a4ca764 100644 --- a/Dasm6301.cpp +++ b/Dasm6301.cpp @@ -57,72 +57,72 @@ static bool bRegistered[] = /* m6301_codes : table of all 6301 instruction bytes and types */ /*****************************************************************************/ -uint8_t Dasm6301::h6301_codes[512] = +CMatrixEntry Dasm6301::h6301_codes[256] = { - _ill ,_nom, _nop ,_imp, _ill ,_nom, _ill ,_nom, /* 00..03 */ - _lsrd ,_imp, _asld ,_imp, _tap ,_imp, _tpa ,_imp, /* 04..07 */ - _inx ,_imp, _dex ,_imp, _clv ,_imp, _sev ,_imp, /* 08..0B */ - _clc ,_imp, _sec ,_imp, _cli ,_imp, _sei ,_imp, /* 0C..0F */ - _sba ,_imp, _cba ,_imp, _ill ,_nom, _ill ,_nom, /* 10..13 */ - _ill ,_nom, _ill ,_nom, _tab ,_imp, _tba ,_imp, /* 14..17 */ - _xgdx ,_imp, _daa ,_imp, _slp ,_imp, _aba ,_imp, /* 18..1B: extra 0x18/xgdx, 0x1a/slp */ - _ill ,_nom, _ill ,_nom, _ill ,_nom, _ill ,_nom, /* 1C..1F */ - _bra ,_reb, _brn ,_reb, _bhi ,_reb, _bls ,_reb, /* 20..23 */ - _bcc ,_reb, _bcs ,_reb, _bne ,_reb, _beq ,_reb, /* 24..27 */ - _bvc ,_reb, _bvs ,_reb, _bpl ,_reb, _bmi ,_reb, /* 28..2B */ - _bge ,_reb, _blt ,_reb, _bgt ,_reb, _ble ,_reb, /* 2C..2F */ - _tsx ,_imp, _ins ,_imp, _pula ,_imp, _pulb ,_imp, /* 30..33 */ - _des ,_imp, _txs ,_imp, _psha ,_imp, _pshb ,_imp, /* 34..37 */ - _pulx ,_imp, _rts ,_imp, _abx ,_imp, _rti ,_imp, /* 38..3B */ - _pshx ,_imp, _mul ,_imp, _wai ,_imp, _swi ,_imp, /* 3C..3F */ - _nega ,_imp, _ill ,_nom, _ill ,_nom, _coma ,_imp, /* 40..43 */ - _lsra ,_imp, _ill ,_nom, _rora ,_imp, _asra ,_imp, /* 44..47 */ - _asla ,_imp, _rola ,_imp, _deca ,_imp, _ill ,_nom, /* 48..4B */ - _inca ,_imp, _tsta ,_imp, _ill ,_nom, _clra ,_imp, /* 4C..4F */ - _negb ,_imp, _ill ,_nom, _ill ,_nom, _comb ,_imp, /* 50..53 */ - _lsrb ,_imp, _ill ,_nom, _rorb ,_imp, _asrb ,_imp, /* 54..57 */ - _aslb ,_imp, _rolb ,_imp, _decb ,_imp, _ill ,_nom, /* 58..5B */ - _incb ,_imp, _tstb ,_imp, _ill ,_nom, _clrb ,_imp, /* 5C..5F */ - _neg ,_ix8, _aim ,_bi, _oim ,_bi, _com ,_ix8, /* 60..63: extra 0x62/aim, 0x63/oim */ - _lsr ,_ix8, _eim ,_bi, _ror ,_ix8, _asr ,_ix8, /* 64..67: extra 0x65/eim */ - _asl ,_ix8, _rol ,_ix8, _dec ,_ix8, _tim ,_bi, /* 68..6B: extra 0x6b/tim */ - _inc ,_ix8, _tst ,_ix8, _jmp ,_ix8, _clr ,_ix8, /* 6C..6F */ - _neg ,_ext, _aim ,_bd, _oim ,_bd, _com ,_ext, /* 70..73: extra 0x72/aim, 0x73/oim */ - _lsr ,_ext, _eim ,_bd, _ror ,_ext, _asr ,_ext, /* 74..77: extra 0x75/eim */ - _asl ,_ext, _rol ,_ext, _dec ,_ext, _tim ,_bd, /* 78..7B: extra 0x7b/tim */ - _inc ,_ext, _tst ,_ext, _jmp ,_ext, _clr ,_ext, /* 7C..7F */ - _suba ,_imb, _cmpa ,_imb, _sbca ,_imb, _subd ,_imw, /* 80..83 */ - _anda ,_imb, _bita ,_imb, _lda ,_imb, _ill ,_nom, /* 84..87 */ - _eora ,_imb, _adca ,_imb, _ora ,_imb, _adda ,_imb, /* 88..8B */ - _cpx ,_imw, _bsr ,_reb, _lds ,_imw, _ill ,_nom, /* 8C..8F */ - _suba ,_dir, _cmpa ,_dir, _sbca ,_dir, _subd ,_dir, /* 90..93 */ - _anda ,_dir, _bita ,_dir, _lda ,_dir, _sta ,_dir, /* 94..97 */ - _eora ,_dir, _adca ,_dir, _ora ,_dir, _adda ,_dir, /* 98..9B */ - _cpx ,_dir, _jsr ,_dir, _lds ,_dir, _sts ,_dir, /* 9C..9F */ - _suba ,_ix8, _cmpa ,_ix8, _sbca ,_ix8, _subd ,_ix8, /* A0..A3 */ - _anda ,_ix8, _bita ,_ix8, _lda ,_ix8, _sta ,_ix8, /* A4..A7 */ - _eora ,_ix8, _adca ,_ix8, _ora ,_ix8, _adda ,_ix8, /* A8..AB */ - _cpx ,_ix8, _jsr ,_ix8, _lds ,_ix8, _sts ,_ix8, /* AC..AF */ - _suba ,_ext, _cmpa ,_ext, _sbca ,_ext, _subd ,_ext, /* B0..B3 */ - _anda ,_ext, _bita ,_ext, _lda ,_ext, _sta ,_ext, /* B4..B7 */ - _eora ,_ext, _adca ,_ext, _ora ,_ext, _adda ,_ext, /* B8..BB */ - _cpx ,_ext, _jsr ,_ext, _lds ,_ext, _sts ,_ext, /* BC..BF */ - _subb ,_imb, _cmpb ,_imb, _sbcb ,_imb, _addd ,_imw, /* C0..C3 */ - _andb ,_imb, _bitb ,_imb, _ldb ,_imb, _ill ,_nom, /* C4..C7 */ - _eorb ,_imb, _adcb ,_imb, _orb ,_imb, _addb ,_imb, /* C8..CB */ - _ldd ,_imw, _ill ,_nom, _ldx ,_imw, _ill ,_nom, /* CC..CF */ - _subb ,_dir, _cmpb ,_dir, _sbcb ,_dir, _addd ,_dir, /* D0..D3 */ - _andb ,_dir, _bitb ,_dir, _ldb ,_dir, _stb ,_dir, /* D4..D7 */ - _eorb ,_dir, _adcb ,_dir, _orb ,_dir, _addb ,_dir, /* D8..DB */ - _ldd ,_dir, _std ,_dir, _ldx ,_dir, _stx ,_dir, /* DC..DF */ - _subb ,_ix8, _cmpb ,_ix8, _sbcb ,_ix8, _addd ,_ix8, /* E0..E3 */ - _andb ,_ix8, _bitb ,_ix8, _ldb ,_ix8, _stb ,_ix8, /* E4..E7 */ - _eorb ,_ix8, _adcb ,_ix8, _orb ,_ix8, _addb ,_ix8, /* E8..EB */ - _ldd ,_ix8, _std ,_ix8, _ldx ,_ix8, _stx ,_ix8, /* EC..EF */ - _subb ,_ext, _cmpb ,_ext, _sbcb ,_ext, _addd ,_ext, /* F0..F3 */ - _andb ,_ext, _bitb ,_ext, _ldb ,_ext, _stb ,_ext, /* F4..F7 */ - _eorb ,_ext, _adcb ,_ext, _orb ,_ext, _addb ,_ext, /* F8..FB */ - _ldd ,_ext, _std ,_ext, _ldx ,_ext, _stx ,_ext, /* FC..FF */ + {_ill ,_nom}, {_nop ,_imp}, {_ill ,_nom}, {_ill ,_nom}, /* 00..03 */ + {_lsrd ,_imp}, {_asld ,_imp}, {_tap ,_imp}, {_tpa ,_imp}, /* 04..07 */ + {_inx ,_imp}, {_dex ,_imp}, {_clv ,_imp}, {_sev ,_imp}, /* 08..0B */ + {_clc ,_imp}, {_sec ,_imp}, {_cli ,_imp}, {_sei ,_imp}, /* 0C..0F */ + {_sba ,_imp}, {_cba ,_imp}, {_ill ,_nom}, {_ill ,_nom}, /* 10..13 */ + {_ill ,_nom}, {_ill ,_nom}, {_tab ,_imp}, {_tba ,_imp}, /* 14..17 */ + {_xgdx ,_imp}, {_daa ,_imp}, {_slp ,_imp}, {_aba ,_imp}, /* 18..1B: extra 0x18/xgdx, 0x1a/slp */ + {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, /* 1C..1F */ + {_bra ,_reb}, {_brn ,_reb}, {_bhi ,_reb}, {_bls ,_reb}, /* 20..23 */ + {_bcc ,_reb}, {_bcs ,_reb}, {_bne ,_reb}, {_beq ,_reb}, /* 24..27 */ + {_bvc ,_reb}, {_bvs ,_reb}, {_bpl ,_reb}, {_bmi ,_reb}, /* 28..2B */ + {_bge ,_reb}, {_blt ,_reb}, {_bgt ,_reb}, {_ble ,_reb}, /* 2C..2F */ + {_tsx ,_imp}, {_ins ,_imp}, {_pula ,_imp}, {_pulb ,_imp}, /* 30..33 */ + {_des ,_imp}, {_txs ,_imp}, {_psha ,_imp}, {_pshb ,_imp}, /* 34..37 */ + {_pulx ,_imp}, {_rts ,_imp}, {_abx ,_imp}, {_rti ,_imp}, /* 38..3B */ + {_pshx ,_imp}, {_mul ,_imp}, {_wai ,_imp}, {_swi ,_imp}, /* 3C..3F */ + {_nega ,_imp}, {_ill ,_nom}, {_ill ,_nom}, {_coma ,_imp}, /* 40..43 */ + {_lsra ,_imp}, {_ill ,_nom}, {_rora ,_imp}, {_asra ,_imp}, /* 44..47 */ + {_asla ,_imp}, {_rola ,_imp}, {_deca ,_imp}, {_ill ,_nom}, /* 48..4B */ + {_inca ,_imp}, {_tsta ,_imp}, {_ill ,_nom}, {_clra ,_imp}, /* 4C..4F */ + {_negb ,_imp}, {_ill ,_nom}, {_ill ,_nom}, {_comb ,_imp}, /* 50..53 */ + {_lsrb ,_imp}, {_ill ,_nom}, {_rorb ,_imp}, {_asrb ,_imp}, /* 54..57 */ + {_aslb ,_imp}, {_rolb ,_imp}, {_decb ,_imp}, {_ill ,_nom}, /* 58..5B */ + {_incb ,_imp}, {_tstb ,_imp}, {_ill ,_nom}, {_clrb ,_imp}, /* 5C..5F */ + {_neg ,_ix8}, {_aim ,_bi }, {_oim ,_bi }, {_com ,_ix8}, /* 60..63: extra 0x62/aim, 0x63/oim */ + {_lsr ,_ix8}, {_eim ,_bi }, {_ror ,_ix8}, {_asr ,_ix8}, /* 64..67: extra 0x65/eim */ + {_asl ,_ix8}, {_rol ,_ix8}, {_dec ,_ix8}, {_tim ,_bi }, /* 68..6B: extra 0x6b/tim */ + {_inc ,_ix8}, {_tst ,_ix8}, {_jmp ,_ix8}, {_clr ,_ix8}, /* 6C..6F */ + {_neg ,_ext}, {_aim ,_bd }, {_oim ,_bd }, {_com ,_ext}, /* 70..73: extra 0x72/aim, 0x73/oim */ + {_lsr ,_ext}, {_eim ,_bd }, {_ror ,_ext}, {_asr ,_ext}, /* 74..77: extra 0x75/eim */ + {_asl ,_ext}, {_rol ,_ext}, {_dec ,_ext}, {_tim ,_bd }, /* 78..7B: extra 0x7b/tim */ + {_inc ,_ext}, {_tst ,_ext}, {_jmp ,_ext}, {_clr ,_ext}, /* 7C..7F */ + {_suba ,_imb}, {_cmpa ,_imb}, {_sbca ,_imb}, {_subd ,_imw}, /* 80..83 */ + {_anda ,_imb}, {_bita ,_imb}, {_lda ,_imb}, {_ill ,_nom}, /* 84..87 */ + {_eora ,_imb}, {_adca ,_imb}, {_ora ,_imb}, {_adda ,_imb}, /* 88..8B */ + {_cpx ,_imw}, {_bsr ,_reb}, {_lds ,_imw}, {_ill ,_nom}, /* 8C..8F */ + {_suba ,_dir}, {_cmpa ,_dir}, {_sbca ,_dir}, {_subd ,_dir}, /* 90..93 */ + {_anda ,_dir}, {_bita ,_dir}, {_lda ,_dir}, {_sta ,_dir}, /* 94..97 */ + {_eora ,_dir}, {_adca ,_dir}, {_ora ,_dir}, {_adda ,_dir}, /* 98..9B */ + {_cpx ,_dir}, {_jsr ,_dir}, {_lds ,_dir}, {_sts ,_dir}, /* 9C..9F */ + {_suba ,_ix8}, {_cmpa ,_ix8}, {_sbca ,_ix8}, {_subd ,_ix8}, /* A0..A3 */ + {_anda ,_ix8}, {_bita ,_ix8}, {_lda ,_ix8}, {_sta ,_ix8}, /* A4..A7 */ + {_eora ,_ix8}, {_adca ,_ix8}, {_ora ,_ix8}, {_adda ,_ix8}, /* A8..AB */ + {_cpx ,_ix8}, {_jsr ,_ix8}, {_lds ,_ix8}, {_sts ,_ix8}, /* AC..AF */ + {_suba ,_ext}, {_cmpa ,_ext}, {_sbca ,_ext}, {_subd ,_ext}, /* B0..B3 */ + {_anda ,_ext}, {_bita ,_ext}, {_lda ,_ext}, {_sta ,_ext}, /* B4..B7 */ + {_eora ,_ext}, {_adca ,_ext}, {_ora ,_ext}, {_adda ,_ext}, /* B8..BB */ + {_cpx ,_ext}, {_jsr ,_ext}, {_lds ,_ext}, {_sts ,_ext}, /* BC..BF */ + {_subb ,_imb}, {_cmpb ,_imb}, {_sbcb ,_imb}, {_addd ,_imw}, /* C0..C3 */ + {_andb ,_imb}, {_bitb ,_imb}, {_ldb ,_imb}, {_ill ,_nom}, /* C4..C7 */ + {_eorb ,_imb}, {_adcb ,_imb}, {_orb ,_imb}, {_addb ,_imb}, /* C8..CB */ + {_ldd ,_imw}, {_ill ,_nom}, {_ldx ,_imw}, {_ill ,_nom}, /* CC..CF */ + {_subb ,_dir}, {_cmpb ,_dir}, {_sbcb ,_dir}, {_addd ,_dir}, /* D0..D3 */ + {_andb ,_dir}, {_bitb ,_dir}, {_ldb ,_dir}, {_stb ,_dir}, /* D4..D7 */ + {_eorb ,_dir}, {_adcb ,_dir}, {_orb ,_dir}, {_addb ,_dir}, /* D8..DB */ + {_ldd ,_dir}, {_std ,_dir}, {_ldx ,_dir}, {_stx ,_dir}, /* DC..DF */ + {_subb ,_ix8}, {_cmpb ,_ix8}, {_sbcb ,_ix8}, {_addd ,_ix8}, /* E0..E3 */ + {_andb ,_ix8}, {_bitb ,_ix8}, {_ldb ,_ix8}, {_stb ,_ix8}, /* E4..E7 */ + {_eorb ,_ix8}, {_adcb ,_ix8}, {_orb ,_ix8}, {_addb ,_ix8}, /* E8..EB */ + {_ldd ,_ix8}, {_std ,_ix8}, {_ldx ,_ix8}, {_stx ,_ix8}, /* EC..EF */ + {_subb ,_ext}, {_cmpb ,_ext}, {_sbcb ,_ext}, {_addd ,_ext}, /* F0..F3 */ + {_andb ,_ext}, {_bitb ,_ext}, {_ldb ,_ext}, {_stb ,_ext}, /* F4..F7 */ + {_eorb ,_ext}, {_adcb ,_ext}, {_orb ,_ext}, {_addb ,_ext}, /* F8..FB */ + {_ldd ,_ext}, {_std ,_ext}, {_ldx ,_ext}, {_stx ,_ext}, /* FC..FF */ }; /*****************************************************************************/ @@ -172,10 +172,9 @@ adr_t Dasm6301::ParseCode { uint8_t instpg, instb, /* T, */ mode; uint16_t W; -int MI; -const char *I; +int mnemoIndex; bool bSetLabel; -adr_t PC = FetchInstructionDetails(addr, instpg, instb, mode, MI, I); +adr_t PC = FetchInstructionDetails(addr, instpg, instb, mode, mnemoIndex); switch (mode) /* which mode is this ? */ { @@ -198,7 +197,7 @@ switch (mode) /* which mode is this ? */ { W = GetUByte(PC); W = (uint16_t)PhaseInner(W, PC); - AddRelativeLabel(W, PC, mnemo[MI].memType, true, BusCode, addr); + AddRelativeLabel(W, PC, mnemo[mnemoIndex].memType, true, BusCode, addr); } PC++; break; @@ -223,12 +222,12 @@ adr_t Dasm6301::DisassembleCode uint8_t instpg, instb, T, mode; uint16_t W; adr_t Wrel; -int MI; -const char *I; +int mnemoIndex; bool bGetLabel; Label *lbl; -adr_t PC = FetchInstructionDetails(addr, instpg, instb, mode, MI, I, &smnemo); +adr_t PC = FetchInstructionDetails(addr, instpg, instb, mode, mnemoIndex); +smnemo = mnemo[mnemoIndex].mne; switch (mode) /* which mode is this? */ { case _bi : /* Bit Manipulation indexed */ diff --git a/Dasm6301.h b/Dasm6301.h index 186ec25..28a56a0 100644 --- a/Dasm6301.h +++ b/Dasm6301.h @@ -67,7 +67,7 @@ class Dasm6301 : public Dasm6801 }; - static uint8_t h6301_codes[512]; + static CMatrixEntry h6301_codes[256]; static OpCode opcodes[mnemo6301_count - mnemo6801_count]; }; diff --git a/Dasm6309.cpp b/Dasm6309.cpp index 556b0c8..0bb7b0c 100644 --- a/Dasm6309.cpp +++ b/Dasm6309.cpp @@ -53,216 +53,216 @@ static bool bRegistered = RegisterDisassembler("6309", Create6309); /* m6309_codes : table of all 6309 instruction bytes and types */ /*****************************************************************************/ -uint8_t Dasm6309::h6309_codes[512] = +CMatrixEntry Dasm6309::h6309_codes[256] = { - _neg ,_dir, _oim ,_bd , _aim ,_bd , _com ,_dir, /* 00..03 */ - _lsr ,_dir, _eim ,_bd , _ror ,_dir, _asr ,_dir, /* 04..07 */ - _asl ,_dir, _rol ,_dir, _dec ,_dir, _tim ,_bd , /* 08..0B */ - _inc ,_dir, _tst ,_dir, _jmp ,_dir, _clr ,_dir, /* 0C..0F */ - _ill ,_nom, _ill ,_nom, _nop ,_imp, _sync ,_imp, /* 10..13 */ - _sexw ,_imp, _ill ,_nom, _lbra ,_rew, _lbsr ,_rew, /* 14..17 */ - _ill ,_nom, _daa ,_imp, _orcc ,_imb, _ill ,_nom, /* 18..1B */ - _andcc,_imb, _sex ,_imp, _exg ,_r1 , _tfr ,_r1 , /* 1C..1F */ - _bra ,_reb, _brn ,_reb, _bhi ,_reb, _bls ,_reb, /* 20..23 */ - _bcc ,_reb, _bcs ,_reb, _bne ,_reb, _beq ,_reb, /* 24..27 */ - _bvc ,_reb, _bvs ,_reb, _bpl ,_reb, _bmi ,_reb, /* 28..2B */ - _bge ,_reb, _blt ,_reb, _bgt ,_reb, _ble ,_reb, /* 2C..2F */ - _leax ,_ind, _leay ,_ind, _leas ,_ind, _leau ,_ind, /* 30..33 */ - _pshs ,_r2 , _puls ,_r2 , _pshu ,_r3 , _pulu ,_r3 , /* 34..37 */ - _ill ,_nom, _rts ,_imp, _abx ,_imp, _rti ,_imp, /* 38..3B */ - _cwai ,_imb, _mul ,_imp, _reset,_imp, _swi ,_imp, /* 3C..3F */ - _nega ,_imp, _ill ,_nom, _ill ,_nom, _coma ,_imp, /* 40..43 */ - _lsra ,_imp, _ill ,_nom, _rora ,_imp, _asra ,_imp, /* 44..47 */ - _asla ,_imp, _rola ,_imp, _deca ,_imp, _ill ,_nom, /* 48..4B */ - _inca ,_imp, _tsta ,_imp, _ill ,_nom, _clra ,_imp, /* 4C..4F */ - _negb ,_imp, _ill ,_nom, _ill ,_nom, _comb ,_imp, /* 50..53 */ - _lsrb ,_imp, _ill ,_nom, _rorb ,_imp, _asrb ,_imp, /* 54..57 */ - _aslb ,_imp, _rolb ,_imp, _decb ,_imp, _ill ,_nom, /* 58..5B */ - _incb ,_imp, _tstb ,_imp, _ill ,_nom, _clrb ,_imp, /* 5C..5F */ - _neg ,_ind, _oim ,_bi , _aim ,_bi , _com ,_ind, /* 60..63 */ - _lsr ,_ind, _eim ,_bi , _ror ,_ind, _asr ,_ind, /* 64..67 */ - _asl ,_ind, _rol ,_ind, _dec ,_ind, _tim ,_bi , /* 68..6B */ - _inc ,_ind, _tst ,_ind, _jmp ,_ind, _clr ,_ind, /* 6C..6F */ - _neg ,_ext, _oim ,_be , _aim ,_be , _com ,_ext, /* 70..73 */ - _lsr ,_ext, _eim ,_be , _ror ,_ext, _asr ,_ext, /* 74..77 */ - _asl ,_ext, _rol ,_ext, _dec ,_ext, _tim ,_be , /* 78..7B */ - _inc ,_ext, _tst ,_ext, _jmp ,_ext, _clr ,_ext, /* 7C..7F */ - _suba ,_imb, _cmpa ,_imb, _sbca ,_imb, _subd ,_imw, /* 80..83 */ - _anda ,_imb, _bita ,_imb, _lda ,_imb, _ill ,_nom, /* 84..87 */ - _eora ,_imb, _adca ,_imb, _ora ,_imb, _adda ,_imb, /* 88..8B */ - _cmpx ,_imw, _bsr ,_reb, _ldx ,_imw, _ill ,_nom, /* 8C..8F */ - _suba ,_dir, _cmpa ,_dir, _sbca ,_dir, _subd ,_dir, /* 90..93 */ - _anda ,_dir, _bita ,_dir, _lda ,_dir, _sta ,_dir, /* 94..97 */ - _eora ,_dir, _adca ,_dir, _ora ,_dir, _adda ,_dir, /* 98..9B */ - _cmpx ,_dir, _jsr ,_dir, _ldx ,_dir, _stx ,_dir, /* 9C..9F */ - _suba ,_ind, _cmpa ,_ind, _sbca ,_ind, _subd ,_ind, /* A0..A3 */ - _anda ,_ind, _bita ,_ind, _lda ,_ind, _sta ,_ind, /* A4..A7 */ - _eora ,_ind, _adca ,_ind, _ora ,_ind, _adda ,_ind, /* A8..AB */ - _cmpx ,_ind, _jsr ,_ind, _ldx ,_ind, _stx ,_ind, /* AC..AF */ - _suba ,_ext, _cmpa ,_ext, _sbca ,_ext, _subd ,_ext, /* B0..B3 */ - _anda ,_ext, _bita ,_ext, _lda ,_ext, _sta ,_ext, /* B4..B7 */ - _eora ,_ext, _adca ,_ext, _ora ,_ext, _adda ,_ext, /* B8..BB */ - _cmpx ,_ext, _jsr ,_ext, _ldx ,_ext, _stx ,_ext, /* BC..BF */ - _subb ,_imb, _cmpb ,_imb, _sbcb ,_imb, _addd ,_imw, /* C0..C3 */ - _andb ,_imb, _bitb ,_imb, _ldb ,_imb, _ill ,_nom, /* C4..C7 */ - _eorb ,_imb, _adcb ,_imb, _orb ,_imb, _addb ,_imb, /* C8..CB */ - _ldd ,_imw, _ldq ,_iml, _ldu ,_imw, _ill ,_nom, /* CC..CF */ - _subb ,_dir, _cmpb ,_dir, _sbcb ,_dir, _addd ,_dir, /* D0..D3 */ - _andb ,_dir, _bitb ,_dir, _ldb ,_dir, _stb ,_dir, /* D4..D7 */ - _eorb ,_dir, _adcb ,_dir, _orb ,_dir, _addb ,_dir, /* D8..DB */ - _ldd ,_dir, _std ,_dir, _ldu ,_dir, _stu ,_dir, /* DC..DF */ - _subb ,_ind, _cmpb ,_ind, _sbcb ,_ind, _addd ,_ind, /* E0..E3 */ - _andb ,_ind, _bitb ,_ind, _ldb ,_ind, _stb ,_ind, /* E4..E7 */ - _eorb ,_ind, _adcb ,_ind, _orb ,_ind, _addb ,_ind, /* E8..EB */ - _ldd ,_ind, _std ,_ind, _ldu ,_ind, _stu ,_ind, /* EC..EF */ - _subb ,_ext, _cmpb ,_ext, _sbcb ,_ext, _addd ,_ext, /* F0..F3 */ - _andb ,_ext, _bitb ,_ext, _ldb ,_ext, _stb ,_ext, /* F4..F7 */ - _eorb ,_ext, _adcb ,_ext, _orb ,_ext, _addb ,_ext, /* F8..FB */ - _ldd ,_ext, _std ,_ext, _ldu ,_ext, _stu ,_ext, /* FC..FF */ + {_neg ,_dir}, {_oim ,_bd }, {_aim ,_bd }, {_com ,_dir}, /* 00..03 */ + {_lsr ,_dir}, {_eim ,_bd }, {_ror ,_dir}, {_asr ,_dir}, /* 04..07 */ + {_asl ,_dir}, {_rol ,_dir}, {_dec ,_dir}, {_tim ,_bd }, /* 08..0B */ + {_inc ,_dir}, {_tst ,_dir}, {_jmp ,_dir}, {_clr ,_dir}, /* 0C..0F */ + {_ill ,_nom}, {_ill ,_nom}, {_nop ,_imp}, {_sync ,_imp}, /* 10..13 */ + {_sexw ,_imp}, {_ill ,_nom}, {_lbra ,_rew}, {_lbsr ,_rew}, /* 14..17 */ + {_ill ,_nom}, {_daa ,_imp}, {_orcc ,_imb}, {_ill ,_nom}, /* 18..1B */ + {_andcc,_imb}, {_sex ,_imp}, {_exg ,_r1 }, {_tfr ,_r1 }, /* 1C..1F */ + {_bra ,_reb}, {_brn ,_reb}, {_bhi ,_reb}, {_bls ,_reb}, /* 20..23 */ + {_bcc ,_reb}, {_bcs ,_reb}, {_bne ,_reb}, {_beq ,_reb}, /* 24..27 */ + {_bvc ,_reb}, {_bvs ,_reb}, {_bpl ,_reb}, {_bmi ,_reb}, /* 28..2B */ + {_bge ,_reb}, {_blt ,_reb}, {_bgt ,_reb}, {_ble ,_reb}, /* 2C..2F */ + {_leax ,_ind}, {_leay ,_ind}, {_leas ,_ind}, {_leau ,_ind}, /* 30..33 */ + {_pshs ,_r2 }, {_puls ,_r2 }, {_pshu ,_r3 }, {_pulu ,_r3 }, /* 34..37 */ + {_ill ,_nom}, {_rts ,_imp}, {_abx ,_imp}, {_rti ,_imp}, /* 38..3B */ + {_cwai ,_imb}, {_mul ,_imp}, {_reset,_imp}, {_swi ,_imp}, /* 3C..3F */ + {_nega ,_imp}, {_ill ,_nom}, {_ill ,_nom}, {_coma ,_imp}, /* 40..43 */ + {_lsra ,_imp}, {_ill ,_nom}, {_rora ,_imp}, {_asra ,_imp}, /* 44..47 */ + {_asla ,_imp}, {_rola ,_imp}, {_deca ,_imp}, {_ill ,_nom}, /* 48..4B */ + {_inca ,_imp}, {_tsta ,_imp}, {_ill ,_nom}, {_clra ,_imp}, /* 4C..4F */ + {_negb ,_imp}, {_ill ,_nom}, {_ill ,_nom}, {_comb ,_imp}, /* 50..53 */ + {_lsrb ,_imp}, {_ill ,_nom}, {_rorb ,_imp}, {_asrb ,_imp}, /* 54..57 */ + {_aslb ,_imp}, {_rolb ,_imp}, {_decb ,_imp}, {_ill ,_nom}, /* 58..5B */ + {_incb ,_imp}, {_tstb ,_imp}, {_ill ,_nom}, {_clrb ,_imp}, /* 5C..5F */ + {_neg ,_ind}, {_oim ,_bi }, {_aim ,_bi }, {_com ,_ind}, /* 60..63 */ + {_lsr ,_ind}, {_eim ,_bi }, {_ror ,_ind}, {_asr ,_ind}, /* 64..67 */ + {_asl ,_ind}, {_rol ,_ind}, {_dec ,_ind}, {_tim ,_bi }, /* 68..6B */ + {_inc ,_ind}, {_tst ,_ind}, {_jmp ,_ind}, {_clr ,_ind}, /* 6C..6F */ + {_neg ,_ext}, {_oim ,_be }, {_aim ,_be }, {_com ,_ext}, /* 70..73 */ + {_lsr ,_ext}, {_eim ,_be }, {_ror ,_ext}, {_asr ,_ext}, /* 74..77 */ + {_asl ,_ext}, {_rol ,_ext}, {_dec ,_ext}, {_tim ,_be }, /* 78..7B */ + {_inc ,_ext}, {_tst ,_ext}, {_jmp ,_ext}, {_clr ,_ext}, /* 7C..7F */ + {_suba ,_imb}, {_cmpa ,_imb}, {_sbca ,_imb}, {_subd ,_imw}, /* 80..83 */ + {_anda ,_imb}, {_bita ,_imb}, {_lda ,_imb}, {_ill ,_nom}, /* 84..87 */ + {_eora ,_imb}, {_adca ,_imb}, {_ora ,_imb}, {_adda ,_imb}, /* 88..8B */ + {_cmpx ,_imw}, {_bsr ,_reb}, {_ldx ,_imw}, {_ill ,_nom}, /* 8C..8F */ + {_suba ,_dir}, {_cmpa ,_dir}, {_sbca ,_dir}, {_subd ,_dir}, /* 90..93 */ + {_anda ,_dir}, {_bita ,_dir}, {_lda ,_dir}, {_sta ,_dir}, /* 94..97 */ + {_eora ,_dir}, {_adca ,_dir}, {_ora ,_dir}, {_adda ,_dir}, /* 98..9B */ + {_cmpx ,_dir}, {_jsr ,_dir}, {_ldx ,_dir}, {_stx ,_dir}, /* 9C..9F */ + {_suba ,_ind}, {_cmpa ,_ind}, {_sbca ,_ind}, {_subd ,_ind}, /* A0..A3 */ + {_anda ,_ind}, {_bita ,_ind}, {_lda ,_ind}, {_sta ,_ind}, /* A4..A7 */ + {_eora ,_ind}, {_adca ,_ind}, {_ora ,_ind}, {_adda ,_ind}, /* A8..AB */ + {_cmpx ,_ind}, {_jsr ,_ind}, {_ldx ,_ind}, {_stx ,_ind}, /* AC..AF */ + {_suba ,_ext}, {_cmpa ,_ext}, {_sbca ,_ext}, {_subd ,_ext}, /* B0..B3 */ + {_anda ,_ext}, {_bita ,_ext}, {_lda ,_ext}, {_sta ,_ext}, /* B4..B7 */ + {_eora ,_ext}, {_adca ,_ext}, {_ora ,_ext}, {_adda ,_ext}, /* B8..BB */ + {_cmpx ,_ext}, {_jsr ,_ext}, {_ldx ,_ext}, {_stx ,_ext}, /* BC..BF */ + {_subb ,_imb}, {_cmpb ,_imb}, {_sbcb ,_imb}, {_addd ,_imw}, /* C0..C3 */ + {_andb ,_imb}, {_bitb ,_imb}, {_ldb ,_imb}, {_ill ,_nom}, /* C4..C7 */ + {_eorb ,_imb}, {_adcb ,_imb}, {_orb ,_imb}, {_addb ,_imb}, /* C8..CB */ + {_ldd ,_imw}, {_ldq ,_iml}, {_ldu ,_imw}, {_ill ,_nom}, /* CC..CF */ + {_subb ,_dir}, {_cmpb ,_dir}, {_sbcb ,_dir}, {_addd ,_dir}, /* D0..D3 */ + {_andb ,_dir}, {_bitb ,_dir}, {_ldb ,_dir}, {_stb ,_dir}, /* D4..D7 */ + {_eorb ,_dir}, {_adcb ,_dir}, {_orb ,_dir}, {_addb ,_dir}, /* D8..DB */ + {_ldd ,_dir}, {_std ,_dir}, {_ldu ,_dir}, {_stu ,_dir}, /* DC..DF */ + {_subb ,_ind}, {_cmpb ,_ind}, {_sbcb ,_ind}, {_addd ,_ind}, /* E0..E3 */ + {_andb ,_ind}, {_bitb ,_ind}, {_ldb ,_ind}, {_stb ,_ind}, /* E4..E7 */ + {_eorb ,_ind}, {_adcb ,_ind}, {_orb ,_ind}, {_addb ,_ind}, /* E8..EB */ + {_ldd ,_ind}, {_std ,_ind}, {_ldu ,_ind}, {_stu ,_ind}, /* EC..EF */ + {_subb ,_ext}, {_cmpb ,_ext}, {_sbcb ,_ext}, {_addd ,_ext}, /* F0..F3 */ + {_andb ,_ext}, {_bitb ,_ext}, {_ldb ,_ext}, {_stb ,_ext}, /* F4..F7 */ + {_eorb ,_ext}, {_adcb ,_ext}, {_orb ,_ext}, {_addb ,_ext}, /* F8..FB */ + {_ldd ,_ext}, {_std ,_ext}, {_ldu ,_ext}, {_stu ,_ext}, /* FC..FF */ }; /*****************************************************************************/ -/*hm6309_codes10 : $10 extended instruction 2nd byte */ +/* h6309_codes10 : $10 extended instruction 2nd byte */ /*****************************************************************************/ -uint8_t Dasm6309::h6309_codes10[512] = +CMatrixEntry Dasm6309::h6309_codes10[256] = { - _ill ,_nom, _ill ,_nom, _ill ,_nom, _ill ,_nom, /* 00..03 */ - _ill ,_nom, _ill ,_nom, _ill ,_nom, _ill ,_nom, /* 04..07 */ - _ill ,_nom, _ill ,_nom, _ill ,_nom, _ill ,_nom, /* 08..0B */ - _ill ,_nom, _ill ,_nom, _ill ,_nom, _ill ,_nom, /* 0C..0F */ - _ill ,_nom, _ill ,_nom, _ill ,_nom, _ill ,_nom, /* 10..13 */ - _ill ,_nom, _ill ,_nom, _ill ,_nom, _ill ,_nom, /* 14..17 */ - _ill ,_nom, _ill ,_nom, _ill ,_nom, _ill ,_nom, /* 18..1B */ - _ill ,_nom, _ill ,_nom, _ill ,_nom, _ill ,_nom, /* 1C..1F */ - _ill ,_nom, _lbrn ,_rew, _lbhi ,_rew, _lbls ,_rew, /* 20..23 */ - _lbcc ,_rew, _lbcs ,_rew, _lbne ,_rew, _lbeq ,_rew, /* 24..27 */ - _lbvc ,_rew, _lbvs ,_rew, _lbpl ,_rew, _lbmi ,_rew, /* 28..2B */ - _lbge ,_rew, _lblt ,_rew, _lbgt ,_rew, _lble ,_rew, /* 2C..2F */ - _addr ,_r1 , _adcr ,_r1 , _subr ,_r1 , _sbcr ,_r1 , /* 30..33 */ - _andr ,_r1 , _orr ,_r1 , _eorr ,_r1 , _cmpr ,_r1 , /* 34..37 */ - _pshsw,_imp, _pulsw,_imp, _pshuw,_imp, _puluw,_imp, /* 38..3B */ - _ill ,_nom, _ill ,_nom, _ill ,_nom, _swi2 ,_imp, /* 3C..3F */ - _negd ,_imp, _ill ,_nom, _ill ,_nom, _comd ,_imp, /* 40..43 */ - _lsrd ,_imp, _ill ,_nom, _rord ,_imp, _asrd ,_imp, /* 44..47 */ - _asld ,_imp, _rold ,_imp, _decd ,_imp, _ill ,_nom, /* 48..4B */ - _incd ,_imp, _tstd ,_imp, _ill ,_nom, _clrd ,_imp, /* 4C..4F */ - _ill ,_nom, _ill ,_nom, _ill ,_nom, _comw ,_imp, /* 50..53 */ - _lsrw ,_imp, _ill ,_nom, _rorw ,_imp, _ill ,_nom, /* 54..57 */ - _ill ,_nom, _rolw ,_imp, _decw ,_imp, _ill ,_nom, /* 58..5B */ - _incw ,_imp, _tstw ,_imp, _ill ,_nom, _clrw ,_imp, /* 5C..5F */ - _ill ,_nom, _ill ,_nom, _ill ,_nom, _ill ,_nom, /* 60..63 */ - _ill ,_nom, _ill ,_nom, _ill ,_nom, _ill ,_nom, /* 64..67 */ - _ill ,_nom, _ill ,_nom, _ill ,_nom, _ill ,_nom, /* 68..6B */ - _ill ,_nom, _ill ,_nom, _ill ,_nom, _ill ,_nom, /* 6C..6F */ - _ill ,_nom, _ill ,_nom, _ill ,_nom, _ill ,_nom, /* 70..73 */ - _ill ,_nom, _ill ,_nom, _ill ,_nom, _ill ,_nom, /* 74..77 */ - _ill ,_nom, _ill ,_nom, _ill ,_nom, _ill ,_nom, /* 78..7B */ - _ill ,_nom, _ill ,_nom, _ill ,_nom, _ill ,_nom, /* 7C..7F */ - _subw ,_imw, _cmpw ,_imw, _sbcd ,_imw, _cmpd ,_imw, /* 80..83 */ - _andd ,_imw, _bitd ,_imw, _ldw ,_imw, _ill ,_nom, /* 84..87 */ - _eord ,_imw, _adcd ,_imw, _ord ,_imw, _addw ,_imw, /* 88..8B */ - _cmpy ,_imw, _ill ,_nom, _ldy ,_imw, _ill ,_nom, /* 8C..8F */ - _subw ,_dir, _cmpw ,_dir, _sbcd ,_dir, _cmpd ,_dir, /* 90..93 */ - _andd ,_dir, _bitd ,_dir, _ldw ,_dir, _stw ,_dir, /* 94..97 */ - _eord ,_dir, _adcd ,_dir, _ord ,_dir, _addw ,_dir, /* 98..9B */ - _cmpy ,_dir, _ill ,_nom, _ldy ,_dir, _sty ,_dir, /* 9C..9F */ - _subw ,_ind, _cmpw ,_ind, _sbcd ,_ind, _cmpd ,_ind, /* A0..A3 */ - _andd ,_ind, _bitd ,_ind, _ldw ,_ind, _stw ,_ind, /* A4..A7 */ - _eord ,_ind, _adcd ,_ind, _ord ,_ind, _addw ,_ind, /* A8..AB */ - _cmpy ,_ind, _ill ,_nom, _ldy ,_ind, _sty ,_ind, /* AC..AF */ - _subw ,_ext, _cmpw ,_ext, _sbcd ,_ext, _cmpd ,_ext, /* B0..B3 */ - _andd ,_ext, _bitd ,_ext, _ldw ,_ext, _stw ,_ext, /* B4..B7 */ - _eord ,_ext, _adcd ,_ext, _ord ,_ext, _addw ,_ext, /* B8..BB */ - _cmpy ,_ext, _ill ,_nom, _ldy ,_ext, _sty ,_ext, /* BC..BF */ - _ill ,_nom, _ill ,_nom, _ill ,_nom, _ill ,_nom, /* C0..C3 */ - _ill ,_nom, _ill ,_nom, _ill ,_nom, _ill ,_nom, /* C4..C7 */ - _ill ,_nom, _ill ,_nom, _ill ,_nom, _ill ,_nom, /* C8..CB */ - _ill ,_nom, _ill ,_nom, _lds ,_imw, _ill ,_nom, /* CC..CF */ - _ill ,_nom, _ill ,_nom, _ill ,_nom, _ill ,_nom, /* D0..D3 */ - _ill ,_nom, _ill ,_nom, _ill ,_nom, _ill ,_nom, /* D4..D7 */ - _ill ,_nom, _ill ,_nom, _ill ,_nom, _ill ,_nom, /* D8..DB */ - _ldq ,_dir, _stq ,_dir, _lds ,_dir, _sts ,_dir, /* DC..DF */ - _ill ,_nom, _ill ,_nom, _ill ,_nom, _ill ,_nom, /* E0..E3 */ - _ill ,_nom, _ill ,_nom, _ill ,_nom, _ill ,_nom, /* E4..E7 */ - _ill ,_nom, _ill ,_nom, _ill ,_nom, _ill ,_nom, /* E8..EB */ - _ldq ,_ind, _stq ,_ind, _lds ,_ind, _sts ,_ind, /* EC..EF */ - _ill ,_nom, _ill ,_nom, _ill ,_nom, _ill ,_nom, /* F0..F3 */ - _ill ,_nom, _ill ,_nom, _ill ,_nom, _ill ,_nom, /* F4..F7 */ - _ill ,_nom, _ill ,_nom, _ill ,_nom, _ill ,_nom, /* F8..FB */ - _ldq ,_ext, _stq ,_ext, _lds ,_ext, _sts ,_ext, /* FC..FF */ + {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, /* 00..03 */ + {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, /* 04..07 */ + {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, /* 08..0B */ + {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, /* 0C..0F */ + {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, /* 10..13 */ + {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, /* 14..17 */ + {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, /* 18..1B */ + {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, /* 1C..1F */ + {_ill ,_nom}, {_lbrn ,_rew}, {_lbhi ,_rew}, {_lbls ,_rew}, /* 20..23 */ + {_lbcc ,_rew}, {_lbcs ,_rew}, {_lbne ,_rew}, {_lbeq ,_rew}, /* 24..27 */ + {_lbvc ,_rew}, {_lbvs ,_rew}, {_lbpl ,_rew}, {_lbmi ,_rew}, /* 28..2B */ + {_lbge ,_rew}, {_lblt ,_rew}, {_lbgt ,_rew}, {_lble ,_rew}, /* 2C..2F */ + {_addr ,_r1 }, {_adcr ,_r1 }, {_subr ,_r1 }, {_sbcr ,_r1 }, /* 30..33 */ + {_andr ,_r1 }, {_orr ,_r1 }, {_eorr ,_r1 }, {_cmpr ,_r1 }, /* 34..37 */ + {_pshsw,_imp}, {_pulsw,_imp}, {_pshuw,_imp}, {_puluw,_imp}, /* 38..3B */ + {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, {_swi2 ,_imp}, /* 3C..3F */ + {_negd ,_imp}, {_ill ,_nom}, {_ill ,_nom}, {_comd ,_imp}, /* 40..43 */ + {_lsrd ,_imp}, {_ill ,_nom}, {_rord ,_imp}, {_asrd ,_imp}, /* 44..47 */ + {_asld ,_imp}, {_rold ,_imp}, {_decd ,_imp}, {_ill ,_nom}, /* 48..4B */ + {_incd ,_imp}, {_tstd ,_imp}, {_ill ,_nom}, {_clrd ,_imp}, /* 4C..4F */ + {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, {_comw ,_imp}, /* 50..53 */ + {_lsrw ,_imp}, {_ill ,_nom}, {_rorw ,_imp}, {_ill ,_nom}, /* 54..57 */ + {_ill ,_nom}, {_rolw ,_imp}, {_decw ,_imp}, {_ill ,_nom}, /* 58..5B */ + {_incw ,_imp}, {_tstw ,_imp}, {_ill ,_nom}, {_clrw ,_imp}, /* 5C..5F */ + {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, /* 60..63 */ + {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, /* 64..67 */ + {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, /* 68..6B */ + {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, /* 6C..6F */ + {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, /* 70..73 */ + {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, /* 74..77 */ + {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, /* 78..7B */ + {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, /* 7C..7F */ + {_subw ,_imw}, {_cmpw ,_imw}, {_sbcd ,_imw}, {_cmpd ,_imw}, /* 80..83 */ + {_andd ,_imw}, {_bitd ,_imw}, {_ldw ,_imw}, {_ill ,_nom}, /* 84..87 */ + {_eord ,_imw}, {_adcd ,_imw}, {_ord ,_imw}, {_addw ,_imw}, /* 88..8B */ + {_cmpy ,_imw}, {_ill ,_nom}, {_ldy ,_imw}, {_ill ,_nom}, /* 8C..8F */ + {_subw ,_dir}, {_cmpw ,_dir}, {_sbcd ,_dir}, {_cmpd ,_dir}, /* 90..93 */ + {_andd ,_dir}, {_bitd ,_dir}, {_ldw ,_dir}, {_stw ,_dir}, /* 94..97 */ + {_eord ,_dir}, {_adcd ,_dir}, {_ord ,_dir}, {_addw ,_dir}, /* 98..9B */ + {_cmpy ,_dir}, {_ill ,_nom}, {_ldy ,_dir}, {_sty ,_dir}, /* 9C..9F */ + {_subw ,_ind}, {_cmpw ,_ind}, {_sbcd ,_ind}, {_cmpd ,_ind}, /* A0..A3 */ + {_andd ,_ind}, {_bitd ,_ind}, {_ldw ,_ind}, {_stw ,_ind}, /* A4..A7 */ + {_eord ,_ind}, {_adcd ,_ind}, {_ord ,_ind}, {_addw ,_ind}, /* A8..AB */ + {_cmpy ,_ind}, {_ill ,_nom}, {_ldy ,_ind}, {_sty ,_ind}, /* AC..AF */ + {_subw ,_ext}, {_cmpw ,_ext}, {_sbcd ,_ext}, {_cmpd ,_ext}, /* B0..B3 */ + {_andd ,_ext}, {_bitd ,_ext}, {_ldw ,_ext}, {_stw ,_ext}, /* B4..B7 */ + {_eord ,_ext}, {_adcd ,_ext}, {_ord ,_ext}, {_addw ,_ext}, /* B8..BB */ + {_cmpy ,_ext}, {_ill ,_nom}, {_ldy ,_ext}, {_sty ,_ext}, /* BC..BF */ + {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, /* C0..C3 */ + {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, /* C4..C7 */ + {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, /* C8..CB */ + {_ill ,_nom}, {_ill ,_nom}, {_lds ,_imw}, {_ill ,_nom}, /* CC..CF */ + {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, /* D0..D3 */ + {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, /* D4..D7 */ + {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, /* D8..DB */ + {_ldq ,_dir}, {_stq ,_dir}, {_lds ,_dir}, {_sts ,_dir}, /* DC..DF */ + {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, /* E0..E3 */ + {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, /* E4..E7 */ + {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, /* E8..EB */ + {_ldq ,_ind}, {_stq ,_ind}, {_lds ,_ind}, {_sts ,_ind}, /* EC..EF */ + {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, /* F0..F3 */ + {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, /* F4..F7 */ + {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, /* F8..FB */ + {_ldq ,_ext}, {_stq ,_ext}, {_lds ,_ext}, {_sts ,_ext}, /* FC..FF */ }; /*****************************************************************************/ /* h6309_codes11 : $11 extended instruction 2nd byte */ /*****************************************************************************/ -uint8_t Dasm6309::h6309_codes11[512] = +CMatrixEntry Dasm6309::h6309_codes11[256] = { - _ill ,_nom, _ill ,_nom, _ill ,_nom, _ill ,_nom, /* 00..03 */ - _ill ,_nom, _ill ,_nom, _ill ,_nom, _ill ,_nom, /* 04..07 */ - _ill ,_nom, _ill ,_nom, _ill ,_nom, _ill ,_nom, /* 08..0B */ - _ill ,_nom, _ill ,_nom, _ill ,_nom, _ill ,_nom, /* 0C..0F */ - _ill ,_nom, _ill ,_nom, _ill ,_nom, _ill ,_nom, /* 10..13 */ - _ill ,_nom, _ill ,_nom, _ill ,_nom, _ill ,_nom, /* 14..17 */ - _ill ,_nom, _ill ,_nom, _ill ,_nom, _ill ,_nom, /* 18..1B */ - _ill ,_nom, _ill ,_nom, _ill ,_nom, _ill ,_nom, /* 1C..1F */ - _ill ,_nom, _ill ,_nom, _ill ,_nom, _ill ,_nom, /* 20..23 */ - _ill ,_nom, _ill ,_nom, _ill ,_nom, _ill ,_nom, /* 24..27 */ - _ill ,_nom, _ill ,_nom, _ill ,_nom, _ill ,_nom, /* 28..2B */ - _ill ,_nom, _ill ,_nom, _ill ,_nom, _ill ,_nom, /* 2C..2F */ - _band ,_bt , _biand,_bt , _bor ,_bt , _bior ,_bt , /* 30..33 */ - _beor ,_bt , _bieor,_bt , _ldbt ,_bt , _stbt ,_bt , /* 34..37 */ - _tfm ,_t1 , _tfm ,_t2 , _tfm ,_t3 , _tfm ,_t4 , /* 38..3B */ - _bitmd,_imb, _ldmd ,_imb, _ill ,_nom, _swi3 ,_imp, /* 3C..3F */ - _ill ,_nom, _ill ,_nom, _ill ,_nom, _come ,_imp, /* 40..43 */ - _ill ,_nom, _ill ,_nom, _ill ,_nom, _ill ,_nom, /* 44..47 */ - _ill ,_nom, _ill ,_nom, _dece ,_imp, _ill ,_nom, /* 48..4B */ - _ince ,_imp, _tste ,_imp, _ill ,_nom, _clre ,_imp, /* 4C..4F */ - _ill ,_nom, _ill ,_nom, _ill ,_nom, _comf ,_imp, /* 50..53 */ - _ill ,_nom, _ill ,_nom, _ill ,_nom, _ill ,_nom, /* 54..57 */ - _ill ,_nom, _ill ,_nom, _decf ,_imp, _ill ,_nom, /* 58..5B */ - _incf ,_imp, _tstf ,_imp, _ill ,_nom, _clrf ,_imp, /* 5C..5F */ - _ill ,_nom, _ill ,_nom, _ill ,_nom, _ill ,_nom, /* 60..63 */ - _ill ,_nom, _ill ,_nom, _ill ,_nom, _ill ,_nom, /* 64..67 */ - _ill ,_nom, _ill ,_nom, _ill ,_nom, _ill ,_nom, /* 68..6B */ - _ill ,_nom, _ill ,_nom, _ill ,_nom, _ill ,_nom, /* 6C..6F */ - _ill ,_nom, _ill ,_nom, _ill ,_nom, _ill ,_nom, /* 70..73 */ - _ill ,_nom, _ill ,_nom, _ill ,_nom, _ill ,_nom, /* 74..77 */ - _ill ,_nom, _ill ,_nom, _ill ,_nom, _ill ,_nom, /* 78..7B */ - _ill ,_nom, _ill ,_nom, _ill ,_nom, _ill ,_nom, /* 7C..7F */ - _sube ,_imb, _cmpe ,_imb, _ill ,_nom, _cmpu ,_imw, /* 80..83 */ - _ill ,_nom, _ill ,_nom, _lde ,_imb, _ill ,_nom, /* 84..87 */ - _ill ,_nom, _ill ,_nom, _ill ,_nom, _adde ,_imb, /* 88..8B */ - _cmps ,_imw, _divd ,_imb, _divq ,_imw, _muld ,_imw, /* 8C..8F */ - _sube ,_dir, _cmpe ,_dir, _ill ,_nom, _cmpu ,_dir, /* 90..93 */ - _ill ,_nom, _ill ,_nom, _lde ,_dir, _ste ,_dir, /* 94..97 */ - _ill ,_nom, _ill ,_nom, _ill ,_nom, _adde ,_dir, /* 98..9B */ - _cmps ,_dir, _divd ,_dir, _divq ,_dir, _muld ,_dir, /* 9C..9F */ - _sube ,_ind, _cmpe ,_ind, _ill ,_nom, _cmpu ,_ind, /* A0..A3 */ - _ill ,_nom, _ill ,_nom, _lde ,_ind, _ste ,_ind, /* A4..A7 */ - _ill ,_nom, _ill ,_nom, _ill ,_nom, _adde ,_ind, /* A8..AB */ - _cmps ,_ind, _divd ,_ind, _divq ,_ind, _muld ,_ind, /* AC..AF */ - _sube ,_ext, _cmpe ,_ext, _ill ,_nom, _cmpu ,_ext, /* B0..B3 */ - _ill ,_nom, _ill ,_nom, _lde ,_ext, _ste ,_ext, /* B4..B7 */ - _ill ,_nom, _ill ,_nom, _ill ,_nom, _adde ,_ext, /* B8..BB */ - _cmps ,_ext, _divd ,_ext, _divq ,_ext, _muld ,_ext, /* BC..BF */ - _subf ,_imb, _cmpf ,_imb, _ill ,_nom, _ill ,_nom, /* C0..C3 */ - _ill ,_nom, _ill ,_nom, _ldf ,_imb, _ill ,_nom, /* C4..C7 */ - _ill ,_nom, _ill ,_nom, _ill ,_nom, _addf ,_imb, /* C8..CB */ - _ill ,_nom, _ill ,_nom, _ill ,_nom, _ill ,_nom, /* CC..CF */ - _subf ,_dir, _cmpf ,_dir, _ill ,_nom, _ill ,_nom, /* D0..D3 */ - _ill ,_nom, _ill ,_nom, _ldf ,_dir, _stf ,_dir, /* D4..D7 */ - _ill ,_nom, _ill ,_nom, _ill ,_nom, _addf ,_dir, /* D8..DB */ - _ill ,_nom, _ill ,_nom, _ill ,_nom, _ill ,_nom, /* DC..DF */ - _subf ,_ind, _cmpf ,_ind, _ill ,_nom, _ill ,_nom, /* E0..E3 */ - _ill ,_nom, _ill ,_nom, _ldf ,_ind, _stf ,_ind, /* E4..E7 */ - _ill ,_nom, _ill ,_nom, _ill ,_nom, _addf ,_ind, /* E8..EB */ - _ill ,_nom, _ill ,_nom, _ill ,_nom, _ill ,_nom, /* EC..EF */ - _subf ,_ext, _cmpf ,_ext, _ill ,_nom, _ill ,_nom, /* F0..F3 */ - _ill ,_nom, _ill ,_nom, _ldf ,_ext, _stf ,_ext, /* F4..F7 */ - _ill ,_nom, _ill ,_nom, _ill ,_nom, _addf ,_ext, /* F8..FB */ - _ill ,_nom, _ill ,_nom, _ill ,_nom, _ill ,_nom, /* FC..FF */ + {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, /* 00..03 */ + {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, /* 04..07 */ + {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, /* 08..0B */ + {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, /* 0C..0F */ + {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, /* 10..13 */ + {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, /* 14..17 */ + {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, /* 18..1B */ + {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, /* 1C..1F */ + {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, /* 20..23 */ + {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, /* 24..27 */ + {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, /* 28..2B */ + {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, /* 2C..2F */ + {_band ,_bt }, {_biand,_bt }, {_bor ,_bt }, {_bior ,_bt }, /* 30..33 */ + {_beor ,_bt }, {_bieor,_bt }, {_ldbt ,_bt }, {_stbt ,_bt }, /* 34..37 */ + {_tfm ,_t1 }, {_tfm ,_t2 }, {_tfm ,_t3 }, {_tfm ,_t4 }, /* 38..3B */ + {_bitmd,_imb}, {_ldmd ,_imb}, {_ill ,_nom}, {_swi3 ,_imp}, /* 3C..3F */ + {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, {_come ,_imp}, /* 40..43 */ + {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, /* 44..47 */ + {_ill ,_nom}, {_ill ,_nom}, {_dece ,_imp}, {_ill ,_nom}, /* 48..4B */ + {_ince ,_imp}, {_tste ,_imp}, {_ill ,_nom}, {_clre ,_imp}, /* 4C..4F */ + {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, {_comf ,_imp}, /* 50..53 */ + {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, /* 54..57 */ + {_ill ,_nom}, {_ill ,_nom}, {_decf ,_imp}, {_ill ,_nom}, /* 58..5B */ + {_incf ,_imp}, {_tstf ,_imp}, {_ill ,_nom}, {_clrf ,_imp}, /* 5C..5F */ + {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, /* 60..63 */ + {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, /* 64..67 */ + {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, /* 68..6B */ + {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, /* 6C..6F */ + {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, /* 70..73 */ + {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, /* 74..77 */ + {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, /* 78..7B */ + {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, /* 7C..7F */ + {_sube ,_imb}, {_cmpe ,_imb}, {_ill ,_nom}, {_cmpu ,_imw}, /* 80..83 */ + {_ill ,_nom}, {_ill ,_nom}, {_lde ,_imb}, {_ill ,_nom}, /* 84..87 */ + {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, {_adde ,_imb}, /* 88..8B */ + {_cmps ,_imw}, {_divd ,_imb}, {_divq ,_imw}, {_muld ,_imw}, /* 8C..8F */ + {_sube ,_dir}, {_cmpe ,_dir}, {_ill ,_nom}, {_cmpu ,_dir}, /* 90..93 */ + {_ill ,_nom}, {_ill ,_nom}, {_lde ,_dir}, {_ste ,_dir}, /* 94..97 */ + {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, {_adde ,_dir}, /* 98..9B */ + {_cmps ,_dir}, {_divd ,_dir}, {_divq ,_dir}, {_muld ,_dir}, /* 9C..9F */ + {_sube ,_ind}, {_cmpe ,_ind}, {_ill ,_nom}, {_cmpu ,_ind}, /* A0..A3 */ + {_ill ,_nom}, {_ill ,_nom}, {_lde ,_ind}, {_ste ,_ind}, /* A4..A7 */ + {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, {_adde ,_ind}, /* A8..AB */ + {_cmps ,_ind}, {_divd ,_ind}, {_divq ,_ind}, {_muld ,_ind}, /* AC..AF */ + {_sube ,_ext}, {_cmpe ,_ext}, {_ill ,_nom}, {_cmpu ,_ext}, /* B0..B3 */ + {_ill ,_nom}, {_ill ,_nom}, {_lde ,_ext}, {_ste ,_ext}, /* B4..B7 */ + {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, {_adde ,_ext}, /* B8..BB */ + {_cmps ,_ext}, {_divd ,_ext}, {_divq ,_ext}, {_muld ,_ext}, /* BC..BF */ + {_subf ,_imb}, {_cmpf ,_imb}, {_ill ,_nom}, {_ill ,_nom}, /* C0..C3 */ + {_ill ,_nom}, {_ill ,_nom}, {_ldf ,_imb}, {_ill ,_nom}, /* C4..C7 */ + {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, {_addf ,_imb}, /* C8..CB */ + {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, /* CC..CF */ + {_subf ,_dir}, {_cmpf ,_dir}, {_ill ,_nom}, {_ill ,_nom}, /* D0..D3 */ + {_ill ,_nom}, {_ill ,_nom}, {_ldf ,_dir}, {_stf ,_dir}, /* D4..D7 */ + {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, {_addf ,_dir}, /* D8..DB */ + {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, /* DC..DF */ + {_subf ,_ind}, {_cmpf ,_ind}, {_ill ,_nom}, {_ill ,_nom}, /* E0..E3 */ + {_ill ,_nom}, {_ill ,_nom}, {_ldf ,_ind}, {_stf ,_ind}, /* E4..E7 */ + {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, {_addf ,_ind}, /* E8..EB */ + {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, /* EC..EF */ + {_subf ,_ext}, {_cmpf ,_ext}, {_ill ,_nom}, {_ill ,_nom}, /* F0..F3 */ + {_ill ,_nom}, {_ill ,_nom}, {_ldf ,_ext}, {_stf ,_ext}, /* F4..F7 */ + {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, {_addf ,_ext}, /* F8..FB */ + {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, /* FC..FF */ }; static const char *h6309_exg_tfr[] = @@ -313,7 +313,6 @@ OpCode Dasm6309::opcodes[mnemo6309_count - mnemo6809_count] = { "COME", Data }, /* _come */ { "COMF", Data }, /* _comf */ { "COMW", Data }, /* _comw */ - { "DECD", Data }, /* _dedc */ { "DECE", Data }, /* _dece */ { "DECF", Data }, /* _decf */ { "DECW", Data }, /* _decw */ @@ -321,7 +320,6 @@ OpCode Dasm6309::opcodes[mnemo6309_count - mnemo6809_count] = { "DIVQ", Data }, /* _divq */ { "EORD", Data }, /* _eord */ { "EORR", Data }, /* _eorr */ - { "INCD", Data }, /* _incd */ { "INCE", Data }, /* _ince */ { "INCF", Data }, /* _incf */ { "INCW", Data }, /* _incw */ @@ -358,6 +356,7 @@ OpCode Dasm6309::opcodes[mnemo6309_count - mnemo6809_count] = { "TSTE", Data }, /* _tste */ { "TSTF", Data }, /* _tstf */ { "TSTW", Data }, /* _tstw */ + { "FQB", Data }, /* _fqb */ }; /*****************************************************************************/ @@ -425,7 +424,7 @@ return Dasm6809::InitParse(bus); /* IndexParse : parses index for labels */ /*****************************************************************************/ -adr_t Dasm6309::IndexParse(int MI, adr_t pc, adr_t instaddr) +adr_t Dasm6309::IndexParse(int mnemoIndex, adr_t pc, adr_t instaddr) { uint8_t T; uint16_t W; @@ -440,18 +439,18 @@ if (T & 0x80) { switch(T & 0x1F) { - case 0x07: - case 0x17: - case 0x0A: - case 0x1A: - case 0x0E: - case 0x1E: + case 0x07: /* E,reg */ + case 0x17: /* [E,reg] */ + case 0x0A: /* F,reg */ + case 0x1A: /* [F,reg] */ + case 0x0E: /* W,reg */ + case 0x1E: /* [W,reg] */ return PC; default: switch (T) { - case 0xAF: - case 0xB0: + case 0xAF: /* lbl,W */ + case 0xB0: /* [lbl,W] */ bSetLabel = !IsConst(PC); if (!bSetLabel) SetDefLabelUsed(PC); @@ -459,8 +458,8 @@ if (T & 0x80) W = GetUWord(PC); PC += 2; if (bSetLabel) { - AddLabel(W, mnemo[MI].memType, "", true); - SetLabelUsed(W, mnemo[MI].memType, BusCode, pc); + AddLabel(W, mnemo[mnemoIndex].memType, "", true); + SetLabelUsed(W, mnemo[mnemoIndex].memType, BusCode, pc); } return PC; } @@ -470,7 +469,7 @@ if (T & 0x80) (void)R; // unused ATM -return Dasm6809::IndexParse(MI, pc, instaddr); +return Dasm6809::IndexParse(mnemoIndex, pc, instaddr); } /*****************************************************************************/ @@ -577,15 +576,14 @@ adr_t Dasm6309::ParseCode { uint8_t instpg, instb, T, mode; uint16_t W; -int MI; -const char *I; +int mnemoIndex; bool bSetLabel; adr_t dp = GetDirectPage(addr); -adr_t PC = FetchInstructionDetails(addr, instpg, instb, mode, MI, I); +adr_t PC = FetchInstructionDetails(addr, instpg, instb, mode, mnemoIndex); #if 1 // speed up things a bit by checking here (would be done in 6809 anyway) -if ((MI == _swi2) && os9Patch) +if ((mnemoIndex == _swi2) && os9Patch) return (PC + 1 - addr); #endif @@ -604,7 +602,7 @@ switch (mode) /* which mode is this ? */ if (bSetLabel) { W = (uint16_t)PhaseInner(W, PC); - AddRelativeLabel(W, PC, mnemo[MI].memType, true, BusCode, addr); + AddRelativeLabel(W, PC, mnemo[mnemoIndex].memType, true, BusCode, addr); } } PC++; @@ -614,7 +612,7 @@ switch (mode) /* which mode is this ? */ T = GetUByte(PC); SetDefLabelUsed(PC); PC++; - PC = IndexParse(MI, PC, addr); + PC = IndexParse(mnemoIndex, PC, addr); break; case _be: /* Bit Manipulation extended */ @@ -627,7 +625,7 @@ switch (mode) /* which mode is this ? */ if (bSetLabel) { W = (uint16_t)PhaseInner(GetUWord(PC), PC); - AddRelativeLabel(W, PC, mnemo[MI].memType, true, BusCode, addr); + AddRelativeLabel(W, PC, mnemo[mnemoIndex].memType, true, BusCode, addr); } else SetDefLabelUsed(PC, bus); @@ -680,7 +678,7 @@ if (!(flags & SHMF_RMB) && /* if display necessary */ { adr_t done; - smnemo = "FQB"; + smnemo = mnemo[_fqb].mne; /* assemble as many as possible */ for (done = addr; done < end; done += 4) { @@ -714,19 +712,19 @@ adr_t Dasm6309::DisassembleCode { uint8_t instpg, instb, T, mode; uint16_t W; -int MI; -const char *I; +int mnemoIndex; bool bGetLabel; adr_t dp = GetDirectPage(addr); Label *lbl; -adr_t PC = FetchInstructionDetails(addr, instpg, instb, mode, MI, I, &smnemo); +adr_t PC = FetchInstructionDetails(addr, instpg, instb, mode, mnemoIndex); +smnemo = mnemo[mnemoIndex].mne; #if 1 // speed up things a bit by checking here (would be done in 6809 anyway) -if ((MI == _swi2) && os9Patch) +if ((mnemoIndex == _swi2) && os9Patch) { T = GetUByte(PC++); - smnemo = "OS9"; + smnemo = mnemo[_os9].mne; sparm = os9_codes[T]; return PC - addr; } @@ -771,7 +769,7 @@ switch (mode) /* which mode is this? */ lbl = FindLabel(PC, Const); string scn = lbl ? lbl->GetText() : Number2String(T, 2, PC); PC++; - sparm = sformat("#%s,", I, scn.c_str()); + sparm = sformat("#%s,", scn.c_str()); sparm += IndexString(smnemo, PC); } break; @@ -827,28 +825,28 @@ switch (mode) /* which mode is this? */ case _t1: /* Block Transfer r0+,r1+ */ T = GetUByte(PC++); - sparm = sformat("%s+,%s+", I, + sparm = sformat("%s+,%s+", MnemoCase(block_r[T >> 4]).c_str(), MnemoCase(block_r[T & 0xF]).c_str()); break; case _t2: /* Block Transfer r0-,r1- */ T = GetUByte(PC++); - sparm = sformat("%s-,%s-", I, + sparm = sformat("%s-,%s-", MnemoCase(block_r[T >> 4]).c_str(), MnemoCase(block_r[T & 0xF]).c_str()); break; case _t3: /* Block Transfer r0+,r1 */ T = GetUByte(PC++); - sparm = sformat("%s+,%s", I, + sparm = sformat("%s+,%s", MnemoCase(block_r[T >> 4]).c_str(), MnemoCase(block_r[T & 0xF]).c_str()); break; case _t4: /* Block Transfer r0,r1+ */ T = GetUByte(PC++); - sparm = sformat("%-7s %s,%s+", I, + sparm = sformat("%s,%s+", MnemoCase(block_r[T >> 4]).c_str(), MnemoCase(block_r[T & 0xF]).c_str()); break; diff --git a/Dasm6309.h b/Dasm6309.h index 3aff18c..410aec8 100644 --- a/Dasm6309.h +++ b/Dasm6309.h @@ -108,7 +108,6 @@ class Dasm6309 : public Dasm6809 _come, _comf, _comw, - _decd, _dece, _decf, _decw, @@ -116,7 +115,6 @@ class Dasm6309 : public Dasm6809 _divq, _eord, _eorr, - _incd, _ince, _incf, _incw, @@ -154,12 +152,14 @@ class Dasm6309 : public Dasm6809 _tstf, _tstw, + _fqb, + mnemo6309_count }; - static uint8_t h6309_codes[512]; - static uint8_t h6309_codes10[512]; - static uint8_t h6309_codes11[512]; + static CMatrixEntry h6309_codes[256]; + static CMatrixEntry h6309_codes10[256]; + static CMatrixEntry h6309_codes11[256]; static OpCode opcodes[mnemo6309_count - mnemo6809_count]; protected: diff --git a/Dasm6500.cpp b/Dasm6500.cpp index fbb668a..be24534 100644 --- a/Dasm6500.cpp +++ b/Dasm6500.cpp @@ -94,72 +94,72 @@ static bool bRegistered[] = /* m6500_codes : table of all 6500 instruction bytes and types */ /*****************************************************************************/ -uint8_t Dasm650X::m6500_codes[512] = +CMatrixEntry Dasm650X::m6500_codes[256] = { - _brk ,_imp, _ora ,_idx, _ill ,_nom, _ill ,_nom, /* 00..03 */ - _ill ,_nom, _ora ,_zpg, _asl ,_zpg, _ill ,_nom, /* 04..07 */ - _php ,_imp, _ora ,_imm, _asl ,_acc, _ill ,_nom, /* 08..0B */ - _ill ,_nom, _ora ,_abs, _asl ,_abs, _ill ,_nom, /* 0C..0F */ - _bpl ,_rel, _ora ,_idy, _ill ,_nom, _ill ,_nom, /* 10..13 */ - _ill ,_nom, _ora ,_zpx, _asl ,_zpx, _ill ,_nom, /* 14..17 */ - _clc ,_imp, _ora ,_aby, _ill ,_nom, _ill ,_nom, /* 18..1B */ - _ill ,_nom, _ora ,_abx, _asl ,_abx, _ill ,_nom, /* 1C..1F */ - _jsr,_abs|_nof,_and ,_idx, _ill ,_nom, _ill ,_nom, /* 20..23 */ - _bit ,_zpg, _and ,_zpg, _rol ,_zpg, _ill ,_nom, /* 24..27 */ - _plp ,_imp, _and ,_imm, _rol ,_acc, _ill ,_nom, /* 28..2B */ - _bit ,_abs, _and ,_abs, _rol ,_abs, _ill ,_nom, /* 2C..2F */ - _bmi ,_rel, _and ,_idy, _ill ,_nom, _ill ,_nom, /* 30..33 */ - _ill ,_nom, _and ,_zpx, _rol ,_zpx, _ill ,_nom, /* 34..37 */ - _sec ,_imp, _and ,_aby, _ill ,_nom, _ill ,_nom, /* 38..3B */ - _ill ,_nom, _and ,_abx, _rol ,_abx, _ill ,_nom, /* 3C..3F */ - _rti ,_imp, _eor ,_idx, _ill ,_nom, _ill ,_nom, /* 40..43 */ - _ill ,_nom, _eor ,_zpg, _lsr ,_zpg, _ill ,_nom, /* 44..47 */ - _pha ,_imp, _eor ,_imm, _lsr ,_acc, _ill ,_nom, /* 48..4B */ - _jmp ,_abs, _eor ,_abs, _lsr ,_abs, _ill ,_nom, /* 4C..4F */ - _bvc ,_rel, _eor ,_idy, _ill ,_nom, _ill ,_nom, /* 50..53 */ - _ill ,_nom, _eor ,_zpx, _lsr ,_zpx, _ill ,_nom, /* 54..57 */ - _cli ,_imp, _eor ,_aby, _ill ,_nom, _ill ,_nom, /* 58..5B */ - _ill ,_nom, _eor ,_abx, _lsr ,_abx, _ill ,_nom, /* 5C..5F */ - _rts ,_imp, _adc ,_idx, _ill ,_nom, _ill ,_nom, /* 60..63 */ - _ill ,_nom, _adc ,_zpg, _ror ,_zpg, _ill ,_nom, /* 64..67 */ - _pla ,_imp, _adc ,_imm, _ror ,_acc, _ill ,_nom, /* 68..6B */ - _jmp ,_ind, _adc ,_abs, _ror ,_abs, _ill ,_nom, /* 6C..6F */ - _bvs ,_rel, _adc ,_idy, _ill ,_nom, _ill ,_nom, /* 70..73 */ - _ill ,_nom, _adc ,_zpx, _ror ,_zpx, _ill ,_nom, /* 74..77 */ - _sei ,_imp, _adc ,_aby, _ill ,_nom, _ill ,_nom, /* 78..7B */ - _ill ,_nom, _adc ,_abx, _ror ,_abx, _ill ,_nom, /* 7C..7F */ - _ill ,_nom, _sta ,_idx, _ill ,_nom, _ill ,_nom, /* 80..83 */ - _sty ,_zpg, _sta ,_zpg, _stx ,_zpg, _ill ,_nom, /* 84..87 */ - _dey ,_imp, _ill ,_nom, _txa ,_imp, _ill ,_nom, /* 88..8B */ - _sty ,_abs, _sta ,_abs, _stx ,_abs, _ill ,_nom, /* 8C..8F */ - _bcc ,_rel, _sta ,_idy, _ill ,_nom, _ill ,_nom, /* 90..93 */ - _sty ,_zpx, _sta ,_zpx, _stx ,_zpy, _ill ,_nom, /* 94..97 */ - _tya ,_imp, _sta ,_aby, _txs ,_imp, _ill ,_nom, /* 98..9B */ - _ill ,_nom, _sta ,_abx, _ill ,_nom, _ill ,_nom, /* 9C..9F */ - _ldy ,_imm, _lda ,_idx, _ldx ,_imm, _ill ,_nom, /* A0..A3 */ - _ldy ,_zpg, _lda ,_zpg, _ldx ,_zpg, _ill ,_nom, /* A4..A7 */ - _tay ,_imp, _lda ,_imm, _tax ,_imp, _ill ,_nom, /* A8..AB */ - _ldy ,_abs, _lda ,_abs, _ldx ,_abs, _ill ,_nom, /* AC..AF */ - _bcs ,_rel, _lda ,_idy, _ill ,_nom, _ill ,_nom, /* B0..B3 */ - _ldy ,_zpx, _lda ,_zpx, _ldx ,_zpy, _ill ,_nom, /* B4..B7 */ - _clv ,_imp, _lda ,_aby, _tsx ,_imp, _ill ,_nom, /* B8..BB */ - _ldy ,_abx, _lda ,_abx, _ldx ,_aby, _ill ,_nom, /* BC..BF */ - _cpy ,_imm, _cmp ,_idx, _ill ,_nom, _ill ,_nom, /* C0..C3 */ - _cpy ,_zpg, _cmp ,_zpg, _dec ,_zpg, _ill ,_nom, /* C4..C7 */ - _iny ,_imp, _cmp ,_imm, _dex ,_imp, _ill ,_nom, /* C8..CB */ - _cpy ,_abs, _cmp ,_abs, _dec ,_abs, _ill ,_nom, /* CC..CF */ - _bne ,_rel, _cmp ,_idy, _ill ,_nom, _ill ,_nom, /* D0..D3 */ - _ill ,_nom, _cmp ,_zpx, _dec ,_zpx, _ill ,_nom, /* D4..D7 */ - _cld ,_imp, _cmp ,_aby, _ill ,_nom, _ill ,_nom, /* D8..DB */ - _ill ,_nom, _cmp ,_abx, _dec ,_abx, _ill ,_nom, /* DC..DF */ - _cpx ,_imm, _sbc ,_idx, _ill ,_nom, _ill ,_nom, /* E0..E3 */ - _cpx ,_zpg, _sbc ,_zpg, _inc ,_zpg, _ill ,_nom, /* E4..E7 */ - _inx ,_imp, _sbc ,_imm, _nop ,_imp, _ill ,_nom, /* E8..EB */ - _cpx ,_abs, _sbc ,_abs, _inc ,_abs, _ill ,_nom, /* EC..EF */ - _beq ,_rel, _sbc ,_idy, _ill ,_nom, _ill ,_nom, /* F0..F3 */ - _ill ,_nom, _sbc ,_zpx, _inc ,_zpx, _ill ,_nom, /* F4..F7 */ - _sed ,_imp, _sbc ,_aby, _ill ,_nom, _ill ,_nom, /* F8..FB */ - _ill ,_nom, _sbc ,_abx, _inc ,_abx, _ill ,_nom, /* FC..FF */ + {_brk ,_imp}, {_ora ,_idx}, {_ill ,_nom}, {_ill ,_nom}, /* 00..03 */ + {_ill ,_nom}, {_ora ,_zpg}, {_asl ,_zpg}, {_ill ,_nom}, /* 04..07 */ + {_php ,_imp}, {_ora ,_imm}, {_asl ,_acc}, {_ill ,_nom}, /* 08..0B */ + {_ill ,_nom}, {_ora ,_abs}, {_asl ,_abs}, {_ill ,_nom}, /* 0C..0F */ + {_bpl ,_rel}, {_ora ,_idy}, {_ill ,_nom}, {_ill ,_nom}, /* 10..13 */ + {_ill ,_nom}, {_ora ,_zpx}, {_asl ,_zpx}, {_ill ,_nom}, /* 14..17 */ + {_clc ,_imp}, {_ora ,_aby}, {_ill ,_nom}, {_ill ,_nom}, /* 18..1B */ + {_ill ,_nom}, {_ora ,_abx}, {_asl ,_abx}, {_ill ,_nom}, /* 1C..1F */ + {_jsr,_abs|_nof},{_and,_idx}, {_ill ,_nom}, {_ill ,_nom}, /* 20..23 */ + {_bit ,_zpg}, {_and ,_zpg}, {_rol ,_zpg}, {_ill ,_nom}, /* 24..27 */ + {_plp ,_imp}, {_and ,_imm}, {_rol ,_acc}, {_ill ,_nom}, /* 28..2B */ + {_bit ,_abs}, {_and ,_abs}, {_rol ,_abs}, {_ill ,_nom}, /* 2C..2F */ + {_bmi ,_rel}, {_and ,_idy}, {_ill ,_nom}, {_ill ,_nom}, /* 30..33 */ + {_ill ,_nom}, {_and ,_zpx}, {_rol ,_zpx}, {_ill ,_nom}, /* 34..37 */ + {_sec ,_imp}, {_and ,_aby}, {_ill ,_nom}, {_ill ,_nom}, /* 38..3B */ + {_ill ,_nom}, {_and ,_abx}, {_rol ,_abx}, {_ill ,_nom}, /* 3C..3F */ + {_rti ,_imp}, {_eor ,_idx}, {_ill ,_nom}, {_ill ,_nom}, /* 40..43 */ + {_ill ,_nom}, {_eor ,_zpg}, {_lsr ,_zpg}, {_ill ,_nom}, /* 44..47 */ + {_pha ,_imp}, {_eor ,_imm}, {_lsr ,_acc}, {_ill ,_nom}, /* 48..4B */ + {_jmp ,_abs}, {_eor ,_abs}, {_lsr ,_abs}, {_ill ,_nom}, /* 4C..4F */ + {_bvc ,_rel}, {_eor ,_idy}, {_ill ,_nom}, {_ill ,_nom}, /* 50..53 */ + {_ill ,_nom}, {_eor ,_zpx}, {_lsr ,_zpx}, {_ill ,_nom}, /* 54..57 */ + {_cli ,_imp}, {_eor ,_aby}, {_ill ,_nom}, {_ill ,_nom}, /* 58..5B */ + {_ill ,_nom}, {_eor ,_abx}, {_lsr ,_abx}, {_ill ,_nom}, /* 5C..5F */ + {_rts ,_imp}, {_adc ,_idx}, {_ill ,_nom}, {_ill ,_nom}, /* 60..63 */ + {_ill ,_nom}, {_adc ,_zpg}, {_ror ,_zpg}, {_ill ,_nom}, /* 64..67 */ + {_pla ,_imp}, {_adc ,_imm}, {_ror ,_acc}, {_ill ,_nom}, /* 68..6B */ + {_jmp ,_ind}, {_adc ,_abs}, {_ror ,_abs}, {_ill ,_nom}, /* 6C..6F */ + {_bvs ,_rel}, {_adc ,_idy}, {_ill ,_nom}, {_ill ,_nom}, /* 70..73 */ + {_ill ,_nom}, {_adc ,_zpx}, {_ror ,_zpx}, {_ill ,_nom}, /* 74..77 */ + {_sei ,_imp}, {_adc ,_aby}, {_ill ,_nom}, {_ill ,_nom}, /* 78..7B */ + {_ill ,_nom}, {_adc ,_abx}, {_ror ,_abx}, {_ill ,_nom}, /* 7C..7F */ + {_ill ,_nom}, {_sta ,_idx}, {_ill ,_nom}, {_ill ,_nom}, /* 80..83 */ + {_sty ,_zpg}, {_sta ,_zpg}, {_stx ,_zpg}, {_ill ,_nom}, /* 84..87 */ + {_dey ,_imp}, {_ill ,_nom}, {_txa ,_imp}, {_ill ,_nom}, /* 88..8B */ + {_sty ,_abs}, {_sta ,_abs}, {_stx ,_abs}, {_ill ,_nom}, /* 8C..8F */ + {_bcc ,_rel}, {_sta ,_idy}, {_ill ,_nom}, {_ill ,_nom}, /* 90..93 */ + {_sty ,_zpx}, {_sta ,_zpx}, {_stx ,_zpy}, {_ill ,_nom}, /* 94..97 */ + {_tya ,_imp}, {_sta ,_aby}, {_txs ,_imp}, {_ill ,_nom}, /* 98..9B */ + {_ill ,_nom}, {_sta ,_abx}, {_ill ,_nom}, {_ill ,_nom}, /* 9C..9F */ + {_ldy ,_imm}, {_lda ,_idx}, {_ldx ,_imm}, {_ill ,_nom}, /* A0..A3 */ + {_ldy ,_zpg}, {_lda ,_zpg}, {_ldx ,_zpg}, {_ill ,_nom}, /* A4..A7 */ + {_tay ,_imp}, {_lda ,_imm}, {_tax ,_imp}, {_ill ,_nom}, /* A8..AB */ + {_ldy ,_abs}, {_lda ,_abs}, {_ldx ,_abs}, {_ill ,_nom}, /* AC..AF */ + {_bcs ,_rel}, {_lda ,_idy}, {_ill ,_nom}, {_ill ,_nom}, /* B0..B3 */ + {_ldy ,_zpx}, {_lda ,_zpx}, {_ldx ,_zpy}, {_ill ,_nom}, /* B4..B7 */ + {_clv ,_imp}, {_lda ,_aby}, {_tsx ,_imp}, {_ill ,_nom}, /* B8..BB */ + {_ldy ,_abx}, {_lda ,_abx}, {_ldx ,_aby}, {_ill ,_nom}, /* BC..BF */ + {_cpy ,_imm}, {_cmp ,_idx}, {_ill ,_nom}, {_ill ,_nom}, /* C0..C3 */ + {_cpy ,_zpg}, {_cmp ,_zpg}, {_dec ,_zpg}, {_ill ,_nom}, /* C4..C7 */ + {_iny ,_imp}, {_cmp ,_imm}, {_dex ,_imp}, {_ill ,_nom}, /* C8..CB */ + {_cpy ,_abs}, {_cmp ,_abs}, {_dec ,_abs}, {_ill ,_nom}, /* CC..CF */ + {_bne ,_rel}, {_cmp ,_idy}, {_ill ,_nom}, {_ill ,_nom}, /* D0..D3 */ + {_ill ,_nom}, {_cmp ,_zpx}, {_dec ,_zpx}, {_ill ,_nom}, /* D4..D7 */ + {_cld ,_imp}, {_cmp ,_aby}, {_ill ,_nom}, {_ill ,_nom}, /* D8..DB */ + {_ill ,_nom}, {_cmp ,_abx}, {_dec ,_abx}, {_ill ,_nom}, /* DC..DF */ + {_cpx ,_imm}, {_sbc ,_idx}, {_ill ,_nom}, {_ill ,_nom}, /* E0..E3 */ + {_cpx ,_zpg}, {_sbc ,_zpg}, {_inc ,_zpg}, {_ill ,_nom}, /* E4..E7 */ + {_inx ,_imp}, {_sbc ,_imm}, {_nop ,_imp}, {_ill ,_nom}, /* E8..EB */ + {_cpx ,_abs}, {_sbc ,_abs}, {_inc ,_abs}, {_ill ,_nom}, /* EC..EF */ + {_beq ,_rel}, {_sbc ,_idy}, {_ill ,_nom}, {_ill ,_nom}, /* F0..F3 */ + {_ill ,_nom}, {_sbc ,_zpx}, {_inc ,_zpx}, {_ill ,_nom}, /* F4..F7 */ + {_sed ,_imp}, {_sbc ,_aby}, {_ill ,_nom}, {_ill ,_nom}, /* F8..FB */ + {_ill ,_nom}, {_sbc ,_abx}, {_inc ,_abx}, {_ill ,_nom}, /* FC..FF */ }; /*****************************************************************************/ @@ -168,6 +168,16 @@ uint8_t Dasm650X::m6500_codes[512] = OpCode Dasm650X::opcodes[mnemo6500_count] = { + { "EQU", Data }, /* _equ */ + { "RMB", Data }, /* _rmb */ + { "FCB", Data }, /* _fcb */ + { "FDB", Data }, /* _fcb */ + { "FCC", Data }, /* _fcc */ + { "ORG", Data }, /* _org */ + { "PHASE", Data }, /* _phase */ + { "DEPHASE", Data }, /* _dephase */ + { "END", Data }, /* _end */ + { "???", Data }, /* _ill */ { "ADC", Data }, /* _adc */ @@ -599,20 +609,13 @@ adr_t Dasm650X::FetchInstructionDetails uint8_t &instpg, uint8_t &instb, uint8_t &mode, - int &MI, - const char *&I, - string *smnemo + int &mnemoIndex ) { -uint16_t W; instpg = 0; // 650X has no instruction page instb = GetUByte(PC++); -W = (uint16_t)instb * 2; -MI = codes[W++]; -mode = codes[W]; -I = mnemo[MI].mne; -if (smnemo) - *smnemo = I; +mnemoIndex = codes[instb].mne; +mode = codes[instb].adrmode; return PC; } @@ -628,10 +631,9 @@ adr_t Dasm650X::ParseCode { uint8_t instpg, instb, T, mode; uint16_t W; -int MI; -const char *I; +int mnemoIndex; bool bSetLabel; -adr_t PC = FetchInstructionDetails(addr, instpg, instb, mode, MI, I); +adr_t PC = FetchInstructionDetails(addr, instpg, instb, mode, mnemoIndex); switch (mode) /* which mode is this ? */ { @@ -670,7 +672,7 @@ switch (mode) /* which mode is this ? */ T = GetUByte(PC); W = (uint16_t)dp | T; W = (uint16_t)PhaseInner(W, PC); - AddRelativeLabel(W, PC, mnemo[MI].memType, true, BusCode, addr); + AddRelativeLabel(W, PC, mnemo[mnemoIndex].memType, true, BusCode, addr); } } PC++; @@ -689,7 +691,7 @@ switch (mode) /* which mode is this ? */ { W = GetUWord(PC); W = (uint16_t)PhaseInner(W, PC); - AddRelativeLabel(W, PC, mnemo[MI].memType, true, BusCode, addr); + AddRelativeLabel(W, PC, mnemo[mnemoIndex].memType, true, BusCode, addr); } PC += 2; break; @@ -702,7 +704,7 @@ switch (mode) /* which mode is this ? */ if (bSetLabel) { W = (uint16_t)DephaseOuter(W, PC - 1); - AddRelativeLabel(W, PC - 1, mnemo[MI].memType, true, BusCode, addr); + AddRelativeLabel(W, PC - 1, mnemo[mnemoIndex].memType, true, BusCode, addr); } break; @@ -732,7 +734,7 @@ if (lbltxt.find_first_of("+-") == string::npos) slabel = lbltxt; else slabel = Label2String(laddr, 4, true, laddr, bus); - smnemo = "EQU"; + smnemo = mnemo[_equ].mne; sparm = Address2String(laddr, bus); Disassembler::DisassembleLabel(label, slabel, smnemo, sparm, bus); return true; @@ -755,7 +757,7 @@ bool Dasm650X::DisassembleDefLabel { (void)bus; slabel = label->GetText(); -smnemo = "EQU"; +smnemo = mnemo[_equ].mne; sparm = label->GetDefinition(); Disassembler::DisassembleDefLabel(label, slabel, smnemo, sparm, bus); return true; @@ -815,12 +817,12 @@ adr_t done; if (flags & SHMF_RMB) /* if reserved memory block */ { done = end; /* remember it's done completely */ - smnemo = "RMB"; + smnemo = mnemo[_rmb].mne; sparm = Number2String(end - addr, 4, addr); } else if (useFCC && (flags & SHMF_TXT)) /* if FCC (text) allowed */ { - smnemo = "FCC"; + smnemo = mnemo[_fcc].mne; sparm = '"'; /* start the game */ for (done = addr; done < end; done++) /* assemble as many as possible */ { /* if this would become too long */ @@ -834,7 +836,7 @@ else if (useFCC && (flags & SHMF_TXT)) /* if FCC (text) allowed */ else if (flags & 0xff) /* if not byte-sized */ { // 680x can ony do byte and word, so assume word entities - smnemo = "FDB"; + smnemo = mnemo[_fdb].mne; /* assemble as many as possible */ for (done = addr; done < end; done += 2) { @@ -850,7 +852,7 @@ else if (flags & 0xff) /* if not byte-sized */ } else /* if FCB (hex or binary) */ { - smnemo = "FCB"; + smnemo = mnemo[_fcb].mne; /* assemble as many as possible */ for (done = addr; done < end; done++) { @@ -890,16 +892,16 @@ adr_t Dasm650X::DisassembleCode { uint8_t instpg, instb, T, mode; uint16_t W; -int MI; -const char *I; -adr_t PC = FetchInstructionDetails(addr, instpg, instb, mode, MI, I, &smnemo); +int mnemoIndex; +adr_t PC = FetchInstructionDetails(addr, instpg, instb, mode, mnemoIndex); bool bGetLabel; Label *lbl; +smnemo = mnemo[mnemoIndex].mne; switch (mode) /* which mode is this? */ { case _nom: /* no mode */ - smnemo = "FCB"; + smnemo = mnemo[_fcb].mne; lbl = FindLabel(PC, Const, bus); sparm = lbl ? lbl->GetText() : Number2String(instb, 2, PC); PC = addr + 1; @@ -1036,7 +1038,7 @@ if (addr == NO_ADDRESS && prevaddr == NO_ADDRESS) { LineChange chg; changes.push_back(chg); /* append empty line before END */ - chg.oper = MnemoCase("END"); + chg.oper = MnemoCase(mnemo[_end].mne); if (load != NO_ADDRESS && /* if entry point address given */ bLoadLabel) /* and labelling wanted */ chg.opnds = Label2String(load, 4, true, load); @@ -1063,14 +1065,14 @@ else // no bus check necessary, there's only one changes.push_back(chg); if (prevphase != NO_ADDRESS && prevphstart != curphstart) { - chg.oper = MnemoCase("DEPHASE"); + chg.oper = MnemoCase(mnemo[_dephase].mne); changes.push_back(chg); changes.push_back(LineChange()); } if (addr != NO_ADDRESS) { // TODO: check how that interferes with PIC! - chg.oper = MnemoCase("ORG"); + chg.oper = MnemoCase(mnemo[_org].mne); chg.opnds = Number2String(addr, 4, NO_ADDRESS); changes.push_back(chg); if (curphase != NO_ADDRESS && @@ -1079,7 +1081,7 @@ else // no bus check necessary, there's only one // && curphase != addr ) { - chg.oper = MnemoCase("PHASE"); + chg.oper = MnemoCase(mnemo[_phase].mne); chg.opnds = Number2String(curphase, 4, NO_ADDRESS); changes.push_back(chg); } @@ -1101,72 +1103,72 @@ return Disassembler::DisassembleChanges(addr, prevaddr, prevsz, bAfterLine, chan /* m6501_codes : table of all 6501 instruction bytes and types */ /*****************************************************************************/ // taken from https://wiki.nesdev.com/w/index.php/CPU_unofficial_opcodes -uint8_t Dasm6501::m6501_codes[512] = +CMatrixEntry Dasm6501::m6501_codes[256] = { - _brk ,_imp, _ora ,_idx, _ill ,_nom, _slo,_idx|_und, /* 00..03 */ - _ill ,_nom, _ora ,_zpg, _asl ,_zpg, _slo,_zpg|_und, /* 04..07 */ - _php ,_imp, _ora ,_imm, _asl ,_acc, _ill ,_nom, /* 08..0B */ - _ill ,_nom, _ora ,_abs, _asl ,_abs, _slo,_abs|_und, /* 0C..0F */ - _bpl ,_rel, _ora ,_idy, _ill ,_nom, _slo,_idy|_und, /* 10..13 */ - _ill ,_nom, _ora ,_zpx, _asl ,_zpx, _slo,_zpx|_und, /* 14..17 */ - _clc ,_imp, _ora ,_aby, _ill ,_nom, _slo,_aby|_und, /* 18..1B */ - _ill ,_nom, _ora ,_abx, _asl ,_abx, _slo,_abx|_und, /* 1C..1F */ - _jsr,_abs|_nof,_and ,_idx, _ill ,_nom, _rla,_idx|_und, /* 20..23 */ - _bit ,_zpg, _and ,_zpg, _rol ,_zpg, _rla,_zpg|_und, /* 24..27 */ - _plp ,_imp, _and ,_imm, _rol ,_acc, _anc,_imm|_und, /* 28..2B */ - _bit ,_abs, _and ,_abs, _rol ,_abs, _rla,_abs|_und, /* 2C..2F */ - _bmi ,_rel, _and ,_idy, _ill ,_nom, _rla,_idy|_und, /* 30..33 */ - _ill ,_nom, _and ,_zpx, _rol ,_zpx, _rla,_zpx|_und, /* 34..37 */ - _sec ,_imp, _and ,_aby, _ill ,_nom, _rla,_aby|_und, /* 38..3B */ - _ill ,_nom, _and ,_abx, _rol ,_abx, _rla,_abx|_und, /* 3C..3F */ - _rti ,_imp, _eor ,_idx, _ill ,_nom, _sre,_idx|_und, /* 40..43 */ - _ill ,_nom, _eor ,_zpg, _lsr ,_zpg, _sre,_zpg|_und, /* 44..47 */ - _pha ,_imp, _eor ,_imm, _lsr ,_acc, _alr,_imm|_und, /* 48..4B */ - _jmp ,_abs, _eor ,_abs, _lsr ,_abs, _sre,_abs|_und, /* 4C..4F */ - _bvc ,_rel, _eor ,_idy, _ill ,_nom, _sre,_idy|_und, /* 50..53 */ - _ill ,_nom, _eor ,_zpx, _lsr ,_zpx, _sre,_zpx|_und, /* 54..57 */ - _cli ,_imp, _eor ,_aby, _ill ,_nom, _sre,_aby|_und, /* 58..5B */ - _ill ,_nom, _eor ,_abx, _lsr ,_abx, _sre,_abx|_und, /* 5C..5F */ - _rts ,_imp, _adc ,_idx, _ill ,_nom, _rra,_idx|_und, /* 60..63 */ - _ill ,_nom, _adc ,_zpg, _ror ,_zpg, _rra,_zpg|_und, /* 64..67 */ - _pla ,_imp, _adc ,_imm, _ror ,_acc, _arr,_imm|_und, /* 68..6B */ - _jmp ,_ind, _adc ,_abs, _ror ,_abs, _rra,_abs|_und, /* 6C..6F */ - _bvs ,_rel, _adc ,_idy, _ill ,_nom, _rra,_idy|_und, /* 70..73 */ - _ill ,_nom, _adc ,_zpx, _ror ,_zpx, _rra,_zpx|_und, /* 74..77 */ - _sei ,_imp, _adc ,_aby, _ill ,_nom, _rra,_aby|_und, /* 78..7B */ - _ill ,_nom, _adc ,_abx, _ror ,_abx, _rra,_abx|_und, /* 7C..7F */ - _ill ,_nom, _sta ,_idx, _ill ,_nom, _sax,_idx|_und, /* 80..83 */ - _sty ,_zpg, _sta ,_zpg, _stx ,_zpg, _sax,_zpg|_und, /* 84..87 */ - _dey ,_imp, _ill ,_nom, _txa ,_imp, _xaa,_imm|_und, /* 88..8B */ - _sty ,_abs, _sta ,_abs, _stx ,_abs, _sax,_abs|_und, /* 8C..8F */ - _bcc ,_rel, _sta ,_idy, _ill ,_nom, _ahx,_idy|_und, /* 90..93 */ - _sty ,_zpx, _sta ,_zpx, _stx ,_zpy, _sax,_zpy|_und, /* 94..97 */ - _tya ,_imp, _sta ,_aby, _txs ,_imp, _tas,_aby|_und, /* 98..9B */ - _shy,_abx|_und,_sta ,_abx, _shx,_aby|_und,_ahx,_aby|_und, /* 9C..9F */ - _ldy ,_imm, _lda ,_idx, _ldx ,_imm, _lax,_idx|_und, /* A0..A3 */ - _ldy ,_zpg, _lda ,_zpg, _ldx ,_zpg, _lax,_zpg|_und, /* A4..A7 */ - _tay ,_imp, _lda ,_imm, _tax ,_imp, _lax,_imm|_und, /* A8..AB */ - _ldy ,_abs, _lda ,_abs, _ldx ,_abs, _lax,_abs|_und, /* AC..AF */ - _bcs ,_rel, _lda ,_idy, _ill ,_nom, _lax,_idy|_und, /* B0..B3 */ - _ldy ,_zpx, _lda ,_zpx, _ldx ,_zpy, _lax,_zpy|_und, /* B4..B7 */ - _clv ,_imp, _lda ,_aby, _tsx ,_imp, _las,_aby|_und, /* B8..BB */ - _ldy ,_abx, _lda ,_abx, _ldx ,_aby, _lax,_aby|_und, /* BC..BF */ - _cpy ,_imm, _cmp ,_idx, _ill ,_nom, _dcp,_idx|_und, /* C0..C3 */ - _cpy ,_zpg, _cmp ,_zpg, _dec ,_zpg, _dcp,_zpg|_und, /* C4..C7 */ - _iny ,_imp, _cmp ,_imm, _dex ,_imp, _axs,_imm|_und, /* C8..CB */ - _cpy ,_abs, _cmp ,_abs, _dec ,_abs, _dcp,_abs|_und, /* CC..CF */ - _bne ,_rel, _cmp ,_idy, _ill ,_nom, _dcp,_idy|_und, /* D0..D3 */ - _ill ,_nom, _cmp ,_zpx, _dec ,_zpx, _dcp,_zpx|_und, /* D4..D7 */ - _cld ,_imp, _cmp ,_aby, _ill ,_nom, _dcp,_aby|_und, /* D8..DB */ - _ill ,_nom, _cmp ,_abx, _dec ,_abx, _dcp,_abx|_und, /* DC..DF */ - _cpx ,_imm, _sbc ,_idx, _ill ,_nom, _isc,_idx|_und, /* E0..E3 */ - _cpx ,_zpg, _sbc ,_zpg, _inc ,_zpg, _isc,_zpg|_und, /* E4..E7 */ - _inx ,_imp, _sbc ,_imm, _nop ,_imp, _ill ,_nom, /* E8..EB */ - _cpx ,_abs, _sbc ,_abs, _inc ,_abs, _isc,_abs|_und, /* EC..EF */ - _beq ,_rel, _sbc ,_idy, _ill ,_nom, _isc,_idy|_und, /* F0..F3 */ - _ill ,_nom, _sbc ,_zpx, _inc ,_zpx, _isc,_zpx|_und, /* F4..F7 */ - _sed ,_imp, _sbc ,_aby, _ill ,_nom, _isc,_aby|_und, /* F8..FB */ - _ill ,_nom, _sbc ,_abx, _inc ,_abx, _isc,_abx|_und, /* FC..FF */ + {_brk ,_imp}, {_ora ,_idx}, {_ill ,_nom}, {_slo,_idx|_und}, /* 00..03 */ + {_ill ,_nom}, {_ora ,_zpg}, {_asl ,_zpg}, {_slo,_zpg|_und}, /* 04..07 */ + {_php ,_imp}, {_ora ,_imm}, {_asl ,_acc}, {_ill ,_nom}, /* 08..0B */ + {_ill ,_nom}, {_ora ,_abs}, {_asl ,_abs}, {_slo,_abs|_und}, /* 0C..0F */ + {_bpl ,_rel}, {_ora ,_idy}, {_ill ,_nom}, {_slo,_idy|_und}, /* 10..13 */ + {_ill ,_nom}, {_ora ,_zpx}, {_asl ,_zpx}, {_slo,_zpx|_und}, /* 14..17 */ + {_clc ,_imp}, {_ora ,_aby}, {_ill ,_nom}, {_slo,_aby|_und}, /* 18..1B */ + {_ill ,_nom}, {_ora ,_abx}, {_asl ,_abx}, {_slo,_abx|_und}, /* 1C..1F */ + {_jsr,_abs|_nof},{_and,_idx}, {_ill ,_nom}, {_rla,_idx|_und}, /* 20..23 */ + {_bit ,_zpg}, {_and ,_zpg}, {_rol ,_zpg}, {_rla,_zpg|_und}, /* 24..27 */ + {_plp ,_imp}, {_and ,_imm}, {_rol ,_acc}, {_anc,_imm|_und}, /* 28..2B */ + {_bit ,_abs}, {_and ,_abs}, {_rol ,_abs}, {_rla,_abs|_und}, /* 2C..2F */ + {_bmi ,_rel}, {_and ,_idy}, {_ill ,_nom}, {_rla,_idy|_und}, /* 30..33 */ + {_ill ,_nom}, {_and ,_zpx}, {_rol ,_zpx}, {_rla,_zpx|_und}, /* 34..37 */ + {_sec ,_imp}, {_and ,_aby}, {_ill ,_nom}, {_rla,_aby|_und}, /* 38..3B */ + {_ill ,_nom}, {_and ,_abx}, {_rol ,_abx}, {_rla,_abx|_und}, /* 3C..3F */ + {_rti ,_imp}, {_eor ,_idx}, {_ill ,_nom}, {_sre,_idx|_und}, /* 40..43 */ + {_ill ,_nom}, {_eor ,_zpg}, {_lsr ,_zpg}, {_sre,_zpg|_und}, /* 44..47 */ + {_pha ,_imp}, {_eor ,_imm}, {_lsr ,_acc}, {_alr,_imm|_und}, /* 48..4B */ + {_jmp ,_abs}, {_eor ,_abs}, {_lsr ,_abs}, {_sre,_abs|_und}, /* 4C..4F */ + {_bvc ,_rel}, {_eor ,_idy}, {_ill ,_nom}, {_sre,_idy|_und}, /* 50..53 */ + {_ill ,_nom}, {_eor ,_zpx}, {_lsr ,_zpx}, {_sre,_zpx|_und}, /* 54..57 */ + {_cli ,_imp}, {_eor ,_aby}, {_ill ,_nom}, {_sre,_aby|_und}, /* 58..5B */ + {_ill ,_nom}, {_eor ,_abx}, {_lsr ,_abx}, {_sre,_abx|_und}, /* 5C..5F */ + {_rts ,_imp}, {_adc ,_idx}, {_ill ,_nom}, {_rra,_idx|_und}, /* 60..63 */ + {_ill ,_nom}, {_adc ,_zpg}, {_ror ,_zpg}, {_rra,_zpg|_und}, /* 64..67 */ + {_pla ,_imp}, {_adc ,_imm}, {_ror ,_acc}, {_arr,_imm|_und}, /* 68..6B */ + {_jmp ,_ind}, {_adc ,_abs}, {_ror ,_abs}, {_rra,_abs|_und}, /* 6C..6F */ + {_bvs ,_rel}, {_adc ,_idy}, {_ill ,_nom}, {_rra,_idy|_und}, /* 70..73 */ + {_ill ,_nom}, {_adc ,_zpx}, {_ror ,_zpx}, {_rra,_zpx|_und}, /* 74..77 */ + {_sei ,_imp}, {_adc ,_aby}, {_ill ,_nom}, {_rra,_aby|_und}, /* 78..7B */ + {_ill ,_nom}, {_adc ,_abx}, {_ror ,_abx}, {_rra,_abx|_und}, /* 7C..7F */ + {_ill ,_nom}, {_sta ,_idx}, {_ill ,_nom}, {_sax,_idx|_und}, /* 80..83 */ + {_sty ,_zpg}, {_sta ,_zpg}, {_stx ,_zpg}, {_sax,_zpg|_und}, /* 84..87 */ + {_dey ,_imp}, {_ill ,_nom}, {_txa ,_imp}, {_xaa,_imm|_und}, /* 88..8B */ + {_sty ,_abs}, {_sta ,_abs}, {_stx ,_abs}, {_sax,_abs|_und}, /* 8C..8F */ + {_bcc ,_rel}, {_sta ,_idy}, {_ill ,_nom}, {_ahx,_idy|_und}, /* 90..93 */ + {_sty ,_zpx}, {_sta ,_zpx}, {_stx ,_zpy}, {_sax,_zpy|_und}, /* 94..97 */ + {_tya ,_imp}, {_sta ,_aby}, {_txs ,_imp}, {_tas,_aby|_und}, /* 98..9B */ + {_shy,_abx|_und},{_sta,_abx},{_shx,_aby|_und},{_ahx,_aby|_und},/* 9C..9F */ + {_ldy ,_imm}, {_lda ,_idx}, {_ldx ,_imm}, {_lax,_idx|_und}, /* A0..A3 */ + {_ldy ,_zpg}, {_lda ,_zpg}, {_ldx ,_zpg}, {_lax,_zpg|_und}, /* A4..A7 */ + {_tay ,_imp}, {_lda ,_imm}, {_tax ,_imp}, {_lax,_imm|_und}, /* A8..AB */ + {_ldy ,_abs}, {_lda ,_abs}, {_ldx ,_abs}, {_lax,_abs|_und}, /* AC..AF */ + {_bcs ,_rel}, {_lda ,_idy}, {_ill ,_nom}, {_lax,_idy|_und}, /* B0..B3 */ + {_ldy ,_zpx}, {_lda ,_zpx}, {_ldx ,_zpy}, {_lax,_zpy|_und}, /* B4..B7 */ + {_clv ,_imp}, {_lda ,_aby}, {_tsx ,_imp}, {_las,_aby|_und}, /* B8..BB */ + {_ldy ,_abx}, {_lda ,_abx}, {_ldx ,_aby}, {_lax,_aby|_und}, /* BC..BF */ + {_cpy ,_imm}, {_cmp ,_idx}, {_ill ,_nom}, {_dcp,_idx|_und}, /* C0..C3 */ + {_cpy ,_zpg}, {_cmp ,_zpg}, {_dec ,_zpg}, {_dcp,_zpg|_und}, /* C4..C7 */ + {_iny ,_imp}, {_cmp ,_imm}, {_dex ,_imp}, {_axs,_imm|_und}, /* C8..CB */ + {_cpy ,_abs}, {_cmp ,_abs}, {_dec ,_abs}, {_dcp,_abs|_und}, /* CC..CF */ + {_bne ,_rel}, {_cmp ,_idy}, {_ill ,_nom}, {_dcp,_idy|_und}, /* D0..D3 */ + {_ill ,_nom}, {_cmp ,_zpx}, {_dec ,_zpx}, {_dcp,_zpx|_und}, /* D4..D7 */ + {_cld ,_imp}, {_cmp ,_aby}, {_ill ,_nom}, {_dcp,_aby|_und}, /* D8..DB */ + {_ill ,_nom}, {_cmp ,_abx}, {_dec ,_abx}, {_dcp,_abx|_und}, /* DC..DF */ + {_cpx ,_imm}, {_sbc ,_idx}, {_ill ,_nom}, {_isc,_idx|_und}, /* E0..E3 */ + {_cpx ,_zpg}, {_sbc ,_zpg}, {_inc ,_zpg}, {_isc,_zpg|_und}, /* E4..E7 */ + {_inx ,_imp}, {_sbc ,_imm}, {_nop ,_imp}, {_ill ,_nom}, /* E8..EB */ + {_cpx ,_abs}, {_sbc ,_abs}, {_inc ,_abs}, {_isc,_abs|_und}, /* EC..EF */ + {_beq ,_rel}, {_sbc ,_idy}, {_ill ,_nom}, {_isc,_idy|_und}, /* F0..F3 */ + {_ill ,_nom}, {_sbc ,_zpx}, {_inc ,_zpx}, {_isc,_zpx|_und}, /* F4..F7 */ + {_sed ,_imp}, {_sbc ,_aby}, {_ill ,_nom}, {_isc,_aby|_und}, /* F8..FB */ + {_ill ,_nom}, {_sbc ,_abx}, {_inc ,_abx}, {_isc,_abx|_und}, /* FC..FF */ }; // yet to determine what to do: @@ -1262,28 +1264,20 @@ adr_t Dasm6501::FetchInstructionDetails uint8_t &instpg, uint8_t &instb, uint8_t &mode, - int &MI, - const char *&I, - string *smnemo + int &mnemoIndex ) { -uint16_t W; - instpg = 0; // 6501 has no instruction page instb = GetUByte(PC++); -W = (uint16_t)instb * 2; -MI = codes[W++]; -mode = codes[W]; +mnemoIndex = codes[instb].mne; +mode = codes[instb].adrmode; bool und = !!(mode & _und); mode &= ~_und; if (und && !useUndefined) /* if unwanted undefined opcode */ { - MI = _ill; + mnemoIndex = _ill; /* convert to illegal instruction */ mode = _nom; } -I = mnemo[MI].mne; -if (smnemo) - *smnemo = I; return PC; } @@ -1325,72 +1319,72 @@ Dasm6504::Dasm6504(Application *pApp) : Dasm6501(pApp) /* m65c02_codes : table of all 65C02 instruction bytes and types */ /*****************************************************************************/ -uint8_t Dasm65C02::m65c02_codes[512] = +CMatrixEntry Dasm65C02::m65c02_codes[256] = { - _brk ,_imp, _ora ,_idx, _ill ,_nom, _ill ,_nom, /* 00..03 */ - _tsb ,_zpg, _ora ,_zpg, _asl ,_zpg, _rmb ,_zpb, /* 04..07 */ - _php ,_imp, _ora ,_imm, _asl ,_acc, _ill ,_nom, /* 08..0B */ - _tsb ,_abs, _ora ,_abs, _asl ,_abs, _bbr ,_bbt, /* 0C..0F */ - _bpl ,_rel, _ora ,_idy, _ora ,_zpi, _ill ,_nom, /* 10..13 */ - _trb ,_zpg, _ora ,_zpx, _asl ,_zpx, _rmb ,_zpb, /* 14..17 */ - _clc ,_imp, _ora ,_aby, _inc ,_imp, _ill ,_nom, /* 18..1B */ - _trb ,_abs, _ora ,_abx, _asl ,_abx, _bbr ,_bbt, /* 1C..1F */ - _jsr,_abs|_nof,_and ,_idx, _ill ,_nom, _ill ,_nom, /* 20..23 */ - _bit ,_zpg, _and ,_zpg, _rol ,_zpg, _rmb ,_zpb, /* 24..27 */ - _plp ,_imp, _and ,_imm, _rol ,_acc, _ill ,_nom, /* 28..2B */ - _bit ,_abs, _and ,_abs, _rol ,_abs, _bbr ,_bbt, /* 2C..2F */ - _bmi ,_rel, _and ,_idy, _and ,_zpi, _ill ,_nom, /* 30..33 */ - _bit ,_zpx, _and ,_zpx, _rol ,_zpx, _rmb ,_zpb, /* 34..37 */ - _sec ,_imp, _and ,_aby, _dec ,_imp, _ill ,_nom, /* 38..3B */ - _bit ,_abx, _and ,_abx, _rol ,_abx, _bbr ,_bbt, /* 3C..3F */ - _rti ,_imp, _eor ,_idx, _ill ,_nom, _ill ,_nom, /* 40..43 */ - _ill ,_nom, _eor ,_zpg, _lsr ,_zpg, _rmb ,_zpb, /* 44..47 */ - _pha ,_imp, _eor ,_imm, _lsr ,_acc, _ill ,_nom, /* 48..4B */ - _jmp ,_abs, _eor ,_abs, _lsr ,_abs, _bbr ,_bbt, /* 4C..4F */ - _bvc ,_rel, _eor ,_idy, _eor ,_zpi, _ill ,_nom, /* 50..53 */ - _ill ,_nom, _eor ,_zpx, _lsr ,_zpx, _rmb ,_zpb, /* 54..57 */ - _cli ,_imp, _eor ,_aby, _phy ,_imp, _ill ,_nom, /* 58..5B */ - _ill ,_nom, _eor ,_abx, _lsr ,_abx, _bbr ,_bbt, /* 5C..5F */ - _rts ,_imp, _adc ,_idx, _ill ,_nom, _ill ,_nom, /* 60..63 */ - _stz ,_zpg, _adc ,_zpg, _ror ,_zpg, _rmb ,_zpb, /* 64..67 */ - _pla ,_imp, _adc ,_imm, _ror ,_acc, _ill ,_nom, /* 68..6B */ - _jmp ,_ind, _adc ,_abs, _ror ,_abs, _bbr ,_bbt, /* 6C..6F */ - _bvs ,_rel, _adc ,_idy, _adc ,_zpi, _ill ,_nom, /* 70..73 */ - _stz ,_zpx, _adc ,_zpx, _ror ,_zpx, _rmb ,_zpb, /* 74..77 */ - _sei ,_imp, _adc ,_aby, _ply ,_imp, _ill ,_nom, /* 78..7B */ - _jmp ,_abx, _adc ,_abx, _ror ,_abx, _bbr ,_bbt, /* 7C..7F */ - _bra ,_rel, _sta ,_idx, _ill ,_nom, _ill ,_nom, /* 80..83 */ - _sty ,_zpg, _sta ,_zpg, _stx ,_zpg, _smb ,_zpb, /* 84..87 */ - _dey ,_imp, _bit ,_imm, _txa ,_imp, _ill ,_nom, /* 88..8B */ - _sty ,_abs, _sta ,_abs, _stx ,_abs, _bbs ,_bbt, /* 8C..8F */ - _bcc ,_rel, _sta ,_idy, _sta ,_zpi, _ill ,_nom, /* 90..93 */ - _sty ,_zpx, _sta ,_zpx, _stx ,_zpy, _smb ,_zpb, /* 94..97 */ - _tya ,_imp, _sta ,_aby, _txs ,_imp, _ill ,_nom, /* 98..9B */ - _stz ,_abs, _sta ,_abx, _stz ,_abx, _bbs ,_bbt, /* 9C..9F */ - _ldy ,_imm, _lda ,_idx, _ldx ,_imm, _ill ,_nom, /* A0..A3 */ - _ldy ,_zpg, _lda ,_zpg, _ldx ,_zpg, _smb ,_zpb, /* A4..A7 */ - _tay ,_imp, _lda ,_imm, _tax ,_imp, _ill ,_nom, /* A8..AB */ - _ldy ,_abs, _lda ,_abs, _ldx ,_abs, _bbs ,_bbt, /* AC..AF */ - _bcs ,_rel, _lda ,_idy, _lda ,_zpi, _ill ,_nom, /* B0..B3 */ - _ldy ,_zpx, _lda ,_zpx, _ldx ,_zpy, _smb ,_zpb, /* B4..B7 */ - _clv ,_imp, _lda ,_aby, _tsx ,_imp, _ill ,_nom, /* B8..BB */ - _ldy ,_abx, _lda ,_abx, _ldx ,_aby, _bbs ,_bbt, /* BC..BF */ - _cpy ,_imm, _cmp ,_idx, _ill ,_nom, _ill ,_nom, /* C0..C3 */ - _cpy ,_zpg, _cmp ,_zpg, _dec ,_zpg, _smb ,_zpb, /* C4..C7 */ - _iny ,_imp, _cmp ,_imm, _dex ,_imp, _wai ,_imp, /* C8..CB */ - _cpy ,_abs, _cmp ,_abs, _dec ,_abs, _bbs ,_bbt, /* CC..CF */ - _bne ,_rel, _cmp ,_idy, _cmp ,_zpi, _ill ,_nom, /* D0..D3 */ - _ill ,_nom, _cmp ,_zpx, _dec ,_zpx, _smb ,_zpb, /* D4..D7 */ - _cld ,_imp, _cmp ,_aby, _phx ,_imp, _stp ,_imp, /* D8..DB */ - _ill ,_nom, _cmp ,_abx, _dec ,_abx, _bbs ,_bbt, /* DC..DF */ - _cpx ,_imm, _sbc ,_idx, _ill ,_nom, _ill ,_nom, /* E0..E3 */ - _cpx ,_zpg, _sbc ,_zpg, _inc ,_zpg, _smb ,_zpb, /* E4..E7 */ - _inx ,_imp, _sbc ,_imm, _nop ,_imp, _ill ,_nom, /* E8..EB */ - _cpx ,_abs, _sbc ,_abs, _inc ,_abs, _bbs ,_bbt, /* EC..EF */ - _beq ,_rel, _sbc ,_idy, _sbc ,_zpi, _ill ,_nom, /* F0..F3 */ - _ill ,_nom, _sbc ,_zpx, _inc ,_zpx, _smb ,_zpb, /* F4..F7 */ - _sed ,_imp, _sbc ,_aby, _plx ,_imp, _ill ,_nom, /* F8..FB */ - _ill ,_nom, _sbc ,_abx, _inc ,_abx, _bbs ,_bbt, /* FC..FF */ + {_brk ,_imp}, {_ora ,_idx}, {_ill ,_nom}, {_ill ,_nom}, /* 00..03 */ + {_tsb ,_zpg}, {_ora ,_zpg}, {_asl ,_zpg}, {_rmb ,_zpb}, /* 04..07 */ + {_php ,_imp}, {_ora ,_imm}, {_asl ,_acc}, {_ill ,_nom}, /* 08..0B */ + {_tsb ,_abs}, {_ora ,_abs}, {_asl ,_abs}, {_bbr ,_bbt}, /* 0C..0F */ + {_bpl ,_rel}, {_ora ,_idy}, {_ora ,_zpi}, {_ill ,_nom}, /* 10..13 */ + {_trb ,_zpg}, {_ora ,_zpx}, {_asl ,_zpx}, {_rmb ,_zpb}, /* 14..17 */ + {_clc ,_imp}, {_ora ,_aby}, {_inc ,_imp}, {_ill ,_nom}, /* 18..1B */ + {_trb ,_abs}, {_ora ,_abx}, {_asl ,_abx}, {_bbr ,_bbt}, /* 1C..1F */ + {_jsr,_abs|_nof},{_and,_idx}, {_ill ,_nom}, {_ill ,_nom}, /* 20..23 */ + {_bit ,_zpg}, {_and ,_zpg}, {_rol ,_zpg}, {_rmb ,_zpb}, /* 24..27 */ + {_plp ,_imp}, {_and ,_imm}, {_rol ,_acc}, {_ill ,_nom}, /* 28..2B */ + {_bit ,_abs}, {_and ,_abs}, {_rol ,_abs}, {_bbr ,_bbt}, /* 2C..2F */ + {_bmi ,_rel}, {_and ,_idy}, {_and ,_zpi}, {_ill ,_nom}, /* 30..33 */ + {_bit ,_zpx}, {_and ,_zpx}, {_rol ,_zpx}, {_rmb ,_zpb}, /* 34..37 */ + {_sec ,_imp}, {_and ,_aby}, {_dec ,_imp}, {_ill ,_nom}, /* 38..3B */ + {_bit ,_abx}, {_and ,_abx}, {_rol ,_abx}, {_bbr ,_bbt}, /* 3C..3F */ + {_rti ,_imp}, {_eor ,_idx}, {_ill ,_nom}, {_ill ,_nom}, /* 40..43 */ + {_ill ,_nom}, {_eor ,_zpg}, {_lsr ,_zpg}, {_rmb ,_zpb}, /* 44..47 */ + {_pha ,_imp}, {_eor ,_imm}, {_lsr ,_acc}, {_ill ,_nom}, /* 48..4B */ + {_jmp ,_abs}, {_eor ,_abs}, {_lsr ,_abs}, {_bbr ,_bbt}, /* 4C..4F */ + {_bvc ,_rel}, {_eor ,_idy}, {_eor ,_zpi}, {_ill ,_nom}, /* 50..53 */ + {_ill ,_nom}, {_eor ,_zpx}, {_lsr ,_zpx}, {_rmb ,_zpb}, /* 54..57 */ + {_cli ,_imp}, {_eor ,_aby}, {_phy ,_imp}, {_ill ,_nom}, /* 58..5B */ + {_ill ,_nom}, {_eor ,_abx}, {_lsr ,_abx}, {_bbr ,_bbt}, /* 5C..5F */ + {_rts ,_imp}, {_adc ,_idx}, {_ill ,_nom}, {_ill ,_nom}, /* 60..63 */ + {_stz ,_zpg}, {_adc ,_zpg}, {_ror ,_zpg}, {_rmb ,_zpb}, /* 64..67 */ + {_pla ,_imp}, {_adc ,_imm}, {_ror ,_acc}, {_ill ,_nom}, /* 68..6B */ + {_jmp ,_ind}, {_adc ,_abs}, {_ror ,_abs}, {_bbr ,_bbt}, /* 6C..6F */ + {_bvs ,_rel}, {_adc ,_idy}, {_adc ,_zpi}, {_ill ,_nom}, /* 70..73 */ + {_stz ,_zpx}, {_adc ,_zpx}, {_ror ,_zpx}, {_rmb ,_zpb}, /* 74..77 */ + {_sei ,_imp}, {_adc ,_aby}, {_ply ,_imp}, {_ill ,_nom}, /* 78..7B */ + {_jmp ,_abx}, {_adc ,_abx}, {_ror ,_abx}, {_bbr ,_bbt}, /* 7C..7F */ + {_bra ,_rel}, {_sta ,_idx}, {_ill ,_nom}, {_ill ,_nom}, /* 80..83 */ + {_sty ,_zpg}, {_sta ,_zpg}, {_stx ,_zpg}, {_smb ,_zpb}, /* 84..87 */ + {_dey ,_imp}, {_bit ,_imm}, {_txa ,_imp}, {_ill ,_nom}, /* 88..8B */ + {_sty ,_abs}, {_sta ,_abs}, {_stx ,_abs}, {_bbs ,_bbt}, /* 8C..8F */ + {_bcc ,_rel}, {_sta ,_idy}, {_sta ,_zpi}, {_ill ,_nom}, /* 90..93 */ + {_sty ,_zpx}, {_sta ,_zpx}, {_stx ,_zpy}, {_smb ,_zpb}, /* 94..97 */ + {_tya ,_imp}, {_sta ,_aby}, {_txs ,_imp}, {_ill ,_nom}, /* 98..9B */ + {_stz ,_abs}, {_sta ,_abx}, {_stz ,_abx}, {_bbs ,_bbt}, /* 9C..9F */ + {_ldy ,_imm}, {_lda ,_idx}, {_ldx ,_imm}, {_ill ,_nom}, /* A0..A3 */ + {_ldy ,_zpg}, {_lda ,_zpg}, {_ldx ,_zpg}, {_smb ,_zpb}, /* A4..A7 */ + {_tay ,_imp}, {_lda ,_imm}, {_tax ,_imp}, {_ill ,_nom}, /* A8..AB */ + {_ldy ,_abs}, {_lda ,_abs}, {_ldx ,_abs}, {_bbs ,_bbt}, /* AC..AF */ + {_bcs ,_rel}, {_lda ,_idy}, {_lda ,_zpi}, {_ill ,_nom}, /* B0..B3 */ + {_ldy ,_zpx}, {_lda ,_zpx}, {_ldx ,_zpy}, {_smb ,_zpb}, /* B4..B7 */ + {_clv ,_imp}, {_lda ,_aby}, {_tsx ,_imp}, {_ill ,_nom}, /* B8..BB */ + {_ldy ,_abx}, {_lda ,_abx}, {_ldx ,_aby}, {_bbs ,_bbt}, /* BC..BF */ + {_cpy ,_imm}, {_cmp ,_idx}, {_ill ,_nom}, {_ill ,_nom}, /* C0..C3 */ + {_cpy ,_zpg}, {_cmp ,_zpg}, {_dec ,_zpg}, {_smb ,_zpb}, /* C4..C7 */ + {_iny ,_imp}, {_cmp ,_imm}, {_dex ,_imp}, {_wai ,_imp}, /* C8..CB */ + {_cpy ,_abs}, {_cmp ,_abs}, {_dec ,_abs}, {_bbs ,_bbt}, /* CC..CF */ + {_bne ,_rel}, {_cmp ,_idy}, {_cmp ,_zpi}, {_ill ,_nom}, /* D0..D3 */ + {_ill ,_nom}, {_cmp ,_zpx}, {_dec ,_zpx}, {_smb ,_zpb}, /* D4..D7 */ + {_cld ,_imp}, {_cmp ,_aby}, {_phx ,_imp}, {_stp ,_imp}, /* D8..DB */ + {_ill ,_nom}, {_cmp ,_abx}, {_dec ,_abx}, {_bbs ,_bbt}, /* DC..DF */ + {_cpx ,_imm}, {_sbc ,_idx}, {_ill ,_nom}, {_ill ,_nom}, /* E0..E3 */ + {_cpx ,_zpg}, {_sbc ,_zpg}, {_inc ,_zpg}, {_smb ,_zpb}, /* E4..E7 */ + {_inx ,_imp}, {_sbc ,_imm}, {_nop ,_imp}, {_ill ,_nom}, /* E8..EB */ + {_cpx ,_abs}, {_sbc ,_abs}, {_inc ,_abs}, {_bbs ,_bbt}, /* EC..EF */ + {_beq ,_rel}, {_sbc ,_idy}, {_sbc ,_zpi}, {_ill ,_nom}, /* F0..F3 */ + {_ill ,_nom}, {_sbc ,_zpx}, {_inc ,_zpx}, {_smb ,_zpb}, /* F4..F7 */ + {_sed ,_imp}, {_sbc ,_aby}, {_plx ,_imp}, {_ill ,_nom}, /* F8..FB */ + {_ill ,_nom}, {_sbc ,_abx}, {_inc ,_abx}, {_bbs ,_bbt}, /* FC..FF */ }; /*****************************************************************************/ @@ -1439,10 +1433,9 @@ adr_t Dasm65C02::ParseCode { uint8_t instpg, instb, T, mode; uint16_t W; -int MI; -const char *I; +int mnemoIndex; bool bSetLabel; -adr_t PC = FetchInstructionDetails(addr, instpg, instb, mode, MI, I); +adr_t PC = FetchInstructionDetails(addr, instpg, instb, mode, mnemoIndex); switch (mode) /* which mode is this ? */ { @@ -1464,7 +1457,7 @@ switch (mode) /* which mode is this ? */ T = GetUByte(PC); W = (uint16_t)dp | T; W = (uint16_t)PhaseInner(W, PC); - AddRelativeLabel(W, PC, mnemo[MI].memType, true, BusCode, addr); + AddRelativeLabel(W, PC, mnemo[mnemoIndex].memType, true, BusCode, addr); } } PC++; @@ -1486,7 +1479,7 @@ switch (mode) /* which mode is this ? */ T = GetUByte(PC); W = (uint16_t)dp | T; W = (uint16_t)PhaseInner(W, PC); - AddRelativeLabel(W, PC, mnemo[MI].memType, true, BusCode, addr); + AddRelativeLabel(W, PC, mnemo[mnemoIndex].memType, true, BusCode, addr); } } PC++; @@ -1498,7 +1491,7 @@ switch (mode) /* which mode is this ? */ if (bSetLabel) { W = (uint16_t)DephaseOuter(W, PC - 1); - AddRelativeLabel(W, PC - 1, mnemo[MI].memType, true, BusCode, addr); + AddRelativeLabel(W, PC - 1, mnemo[mnemoIndex].memType, true, BusCode, addr); } break; @@ -1523,13 +1516,13 @@ adr_t Dasm65C02::DisassembleCode { uint8_t instpg, instb, T, mode; uint16_t W; -int MI; -const char *I; -adr_t PC = FetchInstructionDetails(addr, instpg, instb, mode, MI, I, &smnemo); +int mnemoIndex; +adr_t PC = FetchInstructionDetails(addr, instpg, instb, mode, mnemoIndex); bool bGetLabel; Label *lbl; char bitnum; +smnemo = mnemo[mnemoIndex].mne; switch (mode) /* which mode is this? */ { case _zpi: /* (zero page) */ @@ -1616,4 +1609,3 @@ switch (mode) /* which mode is this? */ } return PC - addr; /* pass back # processed bytes */ } - diff --git a/Dasm6500.h b/Dasm6500.h index 8e70019..6f90040 100644 --- a/Dasm6500.h +++ b/Dasm6500.h @@ -25,6 +25,16 @@ #include "Disassembler.h" +/*****************************************************************************/ +/* CMatrixEntry : little structure for the code matrix entries */ +/*****************************************************************************/ + +struct CMatrixEntry + { + uint16_t mne; /* index of mnemonic */ + uint8_t adrmode; /* addressing mode */ + }; + /*****************************************************************************/ /* Dasm650X : base class for a MOS Technology 650x processor */ /*****************************************************************************/ @@ -96,7 +106,7 @@ class Dasm650X : virtual string Number2String(adr_t value, int nDigits, adr_t addr, int bus = BusCode); virtual string Address2String(adr_t addr, int bus = BusCode) { (void)bus; return sformat("$%04X", addr); } - virtual adr_t FetchInstructionDetails(adr_t PC, uint8_t &instpg, uint8_t &instb, uint8_t &mode, int &MI, const char *&I, string *smnemo = NULL); + virtual adr_t FetchInstructionDetails(adr_t PC, uint8_t &instpg, uint8_t &instb, uint8_t &mode, int &mnemoIndex); void AddForced(string &smnemo, string &sparm, bool bAbsolute = true); protected: @@ -125,6 +135,16 @@ class Dasm650X : // 6500 mnemonics enum Mnemonics6500 { + _equ, /* start with pseudo-ops */ + _rmb, + _fcb, + _fdb, + _fcc, + _org, + _phase, + _dephase, + _end, + _ill, /* illegal */ _adc, @@ -187,9 +207,9 @@ class Dasm650X : mnemo6500_count }; - static uint8_t m6500_codes[512]; + static CMatrixEntry m6500_codes[256]; - uint8_t *codes; + CMatrixEntry *codes; static const char *bit_r[]; static const char *block_r[]; static OpCode opcodes[mnemo6500_count]; @@ -221,7 +241,7 @@ class Dasm6501 : string Get6501Option(string name); protected: - virtual adr_t FetchInstructionDetails(adr_t PC, uint8_t &instpg, uint8_t &instb, uint8_t &mode, int &MI, const char *&I, string *smnemo = NULL); + virtual adr_t FetchInstructionDetails(adr_t PC, uint8_t &instpg, uint8_t &instb, uint8_t &mode, int &mnemoIndex); protected: // 6501 addressing modes @@ -255,7 +275,7 @@ class Dasm6501 : mnemo6501_count }; - static uint8_t m6501_codes[512]; + static CMatrixEntry m6501_codes[256]; static OpCode m6501_opcodes[mnemo6501_count - mnemo6500_count]; bool useUndefined; }; @@ -350,7 +370,7 @@ class Dasm65C02 : mnemo65C02_count }; - static uint8_t m65c02_codes[512]; + static CMatrixEntry m65c02_codes[256]; static OpCode m65c02_opcodes[mnemo65C02_count - mnemo6500_count]; bool useUndefined; }; diff --git a/Dasm6800.cpp b/Dasm6800.cpp index aa6c7d4..7340c12 100644 --- a/Dasm6800.cpp +++ b/Dasm6800.cpp @@ -58,72 +58,72 @@ static bool bRegistered[] = /* m6800_codes : table of all 6800 instruction bytes and types */ /*****************************************************************************/ -uint8_t Dasm6800::m6800_codes[512] = +CMatrixEntry Dasm6800::m6800_codes[256] = { - _ill ,_nom, _nop ,_imp, _ill ,_nom, _ill ,_nom, /* 00..03 */ - _ill ,_nom, _ill ,_nom, _tap ,_imp, _tpa ,_imp, /* 04..07 */ - _inx ,_imp, _dex ,_imp, _clv ,_imp, _sev ,_imp, /* 08..0B */ - _clc ,_imp, _sec ,_imp, _cli ,_imp, _sei ,_imp, /* 0C..0F */ - _sba ,_imp, _cba ,_imp, _ill ,_nom, _ill ,_nom, /* 10..13 */ - _ill ,_nom, _ill ,_nom, _tab ,_imp, _tba ,_imp, /* 14..17 */ - _ill ,_nom, _daa ,_imp, _ill ,_nom, _aba ,_imp, /* 18..1B */ - _ill ,_nom, _ill ,_nom, _ill ,_nom, _ill ,_nom, /* 1C..1F */ - _bra ,_reb, _ill ,_nom, _bhi ,_reb, _bls ,_reb, /* 20..23 */ - _bcc ,_reb, _bcs ,_reb, _bne ,_reb, _beq ,_reb, /* 24..27 */ - _bvc ,_reb, _bvs ,_reb, _bpl ,_reb, _bmi ,_reb, /* 28..2B */ - _bge ,_reb, _blt ,_reb, _bgt ,_reb, _ble ,_reb, /* 2C..2F */ - _tsx ,_imp, _ins ,_imp, _pula ,_imp, _pulb ,_imp, /* 30..33 */ - _des ,_imp, _txs ,_imp, _psha ,_imp, _pshb ,_imp, /* 34..37 */ - _ill ,_nom, _rts ,_imp, _ill ,_nom, _rti ,_imp, /* 38..3B */ - _ill ,_nom, _ill ,_nom, _wai ,_imp, _swi ,_imp, /* 3C..3F */ - _nega ,_imp, _ill ,_nom, _ill ,_nom, _coma ,_imp, /* 40..43 */ - _lsra ,_imp, _ill ,_nom, _rora ,_imp, _asra ,_imp, /* 44..47 */ - _asla ,_imp, _rola ,_imp, _deca ,_imp, _ill ,_nom, /* 48..4B */ - _inca ,_imp, _tsta ,_imp, _ill ,_nom, _clra ,_imp, /* 4C..4F */ - _negb ,_imp, _ill ,_nom, _ill ,_nom, _comb ,_imp, /* 50..53 */ - _lsrb ,_imp, _ill ,_nom, _rorb ,_imp, _asrb ,_imp, /* 54..57 */ - _aslb ,_imp, _rolb ,_imp, _decb ,_imp, _ill ,_nom, /* 58..5B */ - _incb ,_imp, _tstb ,_imp, _ill ,_nom, _clrb ,_imp, /* 5C..5F */ - _neg ,_ix8, _ill ,_nom, _ill ,_nom, _com ,_ix8, /* 60..63 */ - _lsr ,_ix8, _ill ,_nom, _ror ,_ix8, _asr ,_ix8, /* 64..67 */ - _asl ,_ix8, _rol ,_ix8, _dec ,_ix8, _ill ,_nom, /* 68..6B */ - _inc ,_ix8, _tst ,_ix8, _jmp ,_ix8, _clr ,_ix8, /* 6C..6F */ - _neg ,_ext, _ill ,_nom, _ill ,_nom, _com ,_ext, /* 70..73 */ - _lsr ,_ext, _ill ,_nom, _ror ,_ext, _asr ,_ext, /* 74..77 */ - _asl ,_ext, _rol ,_ext, _dec ,_ext, _ill ,_nom, /* 78..7B */ - _inc ,_ext, _tst ,_ext, _jmp ,_ext, _clr ,_ext, /* 7C..7F */ - _suba ,_imb, _cmpa ,_imb, _sbca ,_imb, _ill ,_nom, /* 80..83 */ - _anda ,_imb, _bita ,_imb, _lda ,_imb, _ill ,_nom, /* 84..87 */ - _eora ,_imb, _adca ,_imb, _ora ,_imb, _adda ,_imb, /* 88..8B */ - _cpx ,_imw, _bsr ,_reb, _lds ,_imw, _ill ,_nom, /* 8C..8F */ - _suba ,_dir, _cmpa ,_dir, _sbca ,_dir, _ill ,_nom, /* 90..93 */ - _anda ,_dir, _bita ,_dir, _lda ,_dir, _sta ,_dir, /* 94..97 */ - _eora ,_dir, _adca ,_dir, _ora ,_dir, _adda ,_dir, /* 98..9B */ - _cpx ,_dir, _ill ,_nom, _lds ,_dir, _sts ,_dir, /* 9C..9F */ - _suba ,_ix8, _cmpa ,_ix8, _sbca ,_ix8, _ill ,_nom, /* A0..A3 */ - _anda ,_ix8, _bita ,_ix8, _lda ,_ix8, _sta ,_ix8, /* A4..A7 */ - _eora ,_ix8, _adca ,_ix8, _ora ,_ix8, _adda ,_ix8, /* A8..AB */ - _cpx ,_ix8, _jsr ,_ix8, _lds ,_ix8, _sts ,_ix8, /* AC..AF */ - _suba ,_ext, _cmpa ,_ext, _sbca ,_ext, _ill ,_nom, /* B0..B3 */ - _anda ,_ext, _bita ,_ext, _lda ,_ext, _sta ,_ext, /* B4..B7 */ - _eora ,_ext, _adca ,_ext, _ora ,_ext, _adda ,_ext, /* B8..BB */ - _cpx ,_ext, _jsr ,_ext, _lds ,_ext, _sts ,_ext, /* BC..BF */ - _subb ,_imb, _cmpb ,_imb, _sbcb ,_imb, _ill ,_nom, /* C0..C3 */ - _andb ,_imb, _bitb ,_imb, _ldb ,_imb, _ill ,_nom, /* C4..C7 */ - _eorb ,_imb, _adcb ,_imb, _orb ,_imb, _addb ,_imb, /* C8..CB */ - _ill ,_nom, _ill ,_nom, _ldx ,_imw, _ill ,_nom, /* CC..CF */ - _subb ,_dir, _cmpb ,_dir, _sbcb ,_dir, _ill ,_nom, /* D0..D3 */ - _andb ,_dir, _bitb ,_dir, _ldb ,_dir, _stb ,_dir, /* D4..D7 */ - _eorb ,_dir, _adcb ,_dir, _orb ,_dir, _addb ,_dir, /* D8..DB */ - _ill ,_nom, _ill ,_nom, _ldx ,_dir, _stx ,_dir, /* DC..DF */ - _subb ,_ix8, _cmpb ,_ix8, _sbcb ,_ix8, _ill ,_nom, /* E0..E3 */ - _andb ,_ix8, _bitb ,_ix8, _ldb ,_ix8, _stb ,_ix8, /* E4..E7 */ - _eorb ,_ix8, _adcb ,_ix8, _orb ,_ix8, _addb ,_ix8, /* E8..EB */ - _ill ,_nom, _ill ,_nom, _ldx ,_ix8, _stx ,_ix8, /* EC..EF */ - _subb ,_ext, _cmpb ,_ext, _sbcb ,_ext, _ill ,_nom, /* F0..F3 */ - _andb ,_ext, _bitb ,_ext, _ldb ,_ext, _stb ,_ext, /* F4..F7 */ - _eorb ,_ext, _adcb ,_ext, _orb ,_ext, _addb ,_ext, /* F8..FB */ - _ill ,_nom, _ill ,_nom, _ldx ,_ext, _stx ,_ext, /* FC..FF */ + {_ill ,_nom}, {_nop ,_imp}, {_ill ,_nom}, {_ill ,_nom}, /* 00..03 */ + {_ill ,_nom}, {_ill ,_nom}, {_tap ,_imp}, {_tpa ,_imp}, /* 04..07 */ + {_inx ,_imp}, {_dex ,_imp}, {_clv ,_imp}, {_sev ,_imp}, /* 08..0B */ + {_clc ,_imp}, {_sec ,_imp}, {_cli ,_imp}, {_sei ,_imp}, /* 0C..0F */ + {_sba ,_imp}, {_cba ,_imp}, {_ill ,_nom}, {_ill ,_nom}, /* 10..13 */ + {_ill ,_nom}, {_ill ,_nom}, {_tab ,_imp}, {_tba ,_imp}, /* 14..17 */ + {_ill ,_nom}, {_daa ,_imp}, {_ill ,_nom}, {_aba ,_imp}, /* 18..1B */ + {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, /* 1C..1F */ + {_bra ,_reb}, {_ill ,_nom}, {_bhi ,_reb}, {_bls ,_reb}, /* 20..23 */ + {_bcc ,_reb}, {_bcs ,_reb}, {_bne ,_reb}, {_beq ,_reb}, /* 24..27 */ + {_bvc ,_reb}, {_bvs ,_reb}, {_bpl ,_reb}, {_bmi ,_reb}, /* 28..2B */ + {_bge ,_reb}, {_blt ,_reb}, {_bgt ,_reb}, {_ble ,_reb}, /* 2C..2F */ + {_tsx ,_imp}, {_ins ,_imp}, {_pula ,_imp}, {_pulb ,_imp}, /* 30..33 */ + {_des ,_imp}, {_txs ,_imp}, {_psha ,_imp}, {_pshb ,_imp}, /* 34..37 */ + {_ill ,_nom}, {_rts ,_imp}, {_ill ,_nom}, {_rti ,_imp}, /* 38..3B */ + {_ill ,_nom}, {_ill ,_nom}, {_wai ,_imp}, {_swi ,_imp}, /* 3C..3F */ + {_nega ,_imp}, {_ill ,_nom}, {_ill ,_nom}, {_coma ,_imp}, /* 40..43 */ + {_lsra ,_imp}, {_ill ,_nom}, {_rora ,_imp}, {_asra ,_imp}, /* 44..47 */ + {_asla ,_imp}, {_rola ,_imp}, {_deca ,_imp}, {_ill ,_nom}, /* 48..4B */ + {_inca ,_imp}, {_tsta ,_imp}, {_ill ,_nom}, {_clra ,_imp}, /* 4C..4F */ + {_negb ,_imp}, {_ill ,_nom}, {_ill ,_nom}, {_comb ,_imp}, /* 50..53 */ + {_lsrb ,_imp}, {_ill ,_nom}, {_rorb ,_imp}, {_asrb ,_imp}, /* 54..57 */ + {_aslb ,_imp}, {_rolb ,_imp}, {_decb ,_imp}, {_ill ,_nom}, /* 58..5B */ + {_incb ,_imp}, {_tstb ,_imp}, {_ill ,_nom}, {_clrb ,_imp}, /* 5C..5F */ + {_neg ,_ix8}, {_ill ,_nom}, {_ill ,_nom}, {_com ,_ix8}, /* 60..63 */ + {_lsr ,_ix8}, {_ill ,_nom}, {_ror ,_ix8}, {_asr ,_ix8}, /* 64..67 */ + {_asl ,_ix8}, {_rol ,_ix8}, {_dec ,_ix8}, {_ill ,_nom}, /* 68..6B */ + {_inc ,_ix8}, {_tst ,_ix8}, {_jmp ,_ix8}, {_clr ,_ix8}, /* 6C..6F */ + {_neg ,_ext}, {_ill ,_nom}, {_ill ,_nom}, {_com ,_ext}, /* 70..73 */ + {_lsr ,_ext}, {_ill ,_nom}, {_ror ,_ext}, {_asr ,_ext}, /* 74..77 */ + {_asl ,_ext}, {_rol ,_ext}, {_dec ,_ext}, {_ill ,_nom}, /* 78..7B */ + {_inc ,_ext}, {_tst ,_ext}, {_jmp ,_ext}, {_clr ,_ext}, /* 7C..7F */ + {_suba ,_imb}, {_cmpa ,_imb}, {_sbca ,_imb}, {_ill ,_nom}, /* 80..83 */ + {_anda ,_imb}, {_bita ,_imb}, {_lda ,_imb}, {_ill ,_nom}, /* 84..87 */ + {_eora ,_imb}, {_adca ,_imb}, {_ora ,_imb}, {_adda ,_imb}, /* 88..8B */ + {_cpx ,_imw}, {_bsr ,_reb}, {_lds ,_imw}, {_ill ,_nom}, /* 8C..8F */ + {_suba ,_dir}, {_cmpa ,_dir}, {_sbca ,_dir}, {_ill ,_nom}, /* 90..93 */ + {_anda ,_dir}, {_bita ,_dir}, {_lda ,_dir}, {_sta ,_dir}, /* 94..97 */ + {_eora ,_dir}, {_adca ,_dir}, {_ora ,_dir}, {_adda ,_dir}, /* 98..9B */ + {_cpx ,_dir}, {_ill ,_nom}, {_lds ,_dir}, {_sts ,_dir}, /* 9C..9F */ + {_suba ,_ix8}, {_cmpa ,_ix8}, {_sbca ,_ix8}, {_ill ,_nom}, /* A0..A3 */ + {_anda ,_ix8}, {_bita ,_ix8}, {_lda ,_ix8}, {_sta ,_ix8}, /* A4..A7 */ + {_eora ,_ix8}, {_adca ,_ix8}, {_ora ,_ix8}, {_adda ,_ix8}, /* A8..AB */ + {_cpx ,_ix8}, {_jsr ,_ix8}, {_lds ,_ix8}, {_sts ,_ix8}, /* AC..AF */ + {_suba ,_ext}, {_cmpa ,_ext}, {_sbca ,_ext}, {_ill ,_nom}, /* B0..B3 */ + {_anda ,_ext}, {_bita ,_ext}, {_lda ,_ext}, {_sta ,_ext}, /* B4..B7 */ + {_eora ,_ext}, {_adca ,_ext}, {_ora ,_ext}, {_adda ,_ext}, /* B8..BB */ + {_cpx ,_ext}, {_jsr ,_ext}, {_lds ,_ext}, {_sts ,_ext}, /* BC..BF */ + {_subb ,_imb}, {_cmpb ,_imb}, {_sbcb ,_imb}, {_ill ,_nom}, /* C0..C3 */ + {_andb ,_imb}, {_bitb ,_imb}, {_ldb ,_imb}, {_ill ,_nom}, /* C4..C7 */ + {_eorb ,_imb}, {_adcb ,_imb}, {_orb ,_imb}, {_addb ,_imb}, /* C8..CB */ + {_ill ,_nom}, {_ill ,_nom}, {_ldx ,_imw}, {_ill ,_nom}, /* CC..CF */ + {_subb ,_dir}, {_cmpb ,_dir}, {_sbcb ,_dir}, {_ill ,_nom}, /* D0..D3 */ + {_andb ,_dir}, {_bitb ,_dir}, {_ldb ,_dir}, {_stb ,_dir}, /* D4..D7 */ + {_eorb ,_dir}, {_adcb ,_dir}, {_orb ,_dir}, {_addb ,_dir}, /* D8..DB */ + {_ill ,_nom}, {_ill ,_nom}, {_ldx ,_dir}, {_stx ,_dir}, /* DC..DF */ + {_subb ,_ix8}, {_cmpb ,_ix8}, {_sbcb ,_ix8}, {_ill ,_nom}, /* E0..E3 */ + {_andb ,_ix8}, {_bitb ,_ix8}, {_ldb ,_ix8}, {_stb ,_ix8}, /* E4..E7 */ + {_eorb ,_ix8}, {_adcb ,_ix8}, {_orb ,_ix8}, {_addb ,_ix8}, /* E8..EB */ + {_ill ,_nom}, {_ill ,_nom}, {_ldx ,_ix8}, {_stx ,_ix8}, /* EC..EF */ + {_subb ,_ext}, {_cmpb ,_ext}, {_sbcb ,_ext}, {_ill ,_nom}, /* F0..F3 */ + {_andb ,_ext}, {_bitb ,_ext}, {_ldb ,_ext}, {_stb ,_ext}, /* F4..F7 */ + {_eorb ,_ext}, {_adcb ,_ext}, {_orb ,_ext}, {_addb ,_ext}, /* F8..FB */ + {_ill ,_nom}, {_ill ,_nom}, {_ldx ,_ext}, {_stx ,_ext}, /* FC..FF */ }; const char *Dasm6800::bit_r[] = {"CC","A","B","??"}; @@ -139,6 +139,19 @@ const char *Dasm6800::block_r[] = OpCode Dasm6800::opcodes[mnemo6800_count] = { + { "EQU", Data }, /* _equ */ + { "RMB", Data }, /* _rmb */ + { "FCB", Data }, /* _fcb */ + { "FDB", Data }, /* _fcb */ + { "FCC", Data }, /* _fcc */ + { "FCS", Data }, /* _fcs */ + { "ORG", Data }, /* _org */ + { "PHASE", Data }, /* _phase */ + { "DEPHASE", Data }, /* _dephase */ + { "END", Data }, /* _end */ + { "IF", Data }, /* _if */ + { "ELSE", Data }, /* _else */ + { "ENDIF", Data }, /* _endif */ { "???", Data }, /* _ill */ { "ABA", Data }, /* _aba */ { "ADCA", Data }, /* _adca */ @@ -187,6 +200,7 @@ OpCode Dasm6800::opcodes[mnemo6800_count] = { "DAA", Data }, /* _daa */ { "DECA", Data }, /* _deca */ { "DECB", Data }, /* _decb */ + { "DECD", Data }, /* _decd */ { "DEC", Data }, /* _dec */ { "DES", Data }, /* _des */ { "DEX", Data }, /* _dex */ @@ -194,6 +208,7 @@ OpCode Dasm6800::opcodes[mnemo6800_count] = { "EORB", Data }, /* _eorb */ { "INCA", Data }, /* _inca */ { "INCB", Data }, /* _incb */ + { "INCD", Data }, /* _incd */ { "INC", Data }, /* _inc */ { "INS", Data }, /* _ins */ { "INX", Data }, /* _inx */ @@ -488,7 +503,9 @@ while (ReadFlexRecord(f, &rec)) AddMemory(nStart, rec.GetSize(), Code, rec.GetData()); for (i = nStart; i <= nEnd; i++) /* mark area as used */ { - SetCellUsed(i); + bool bUsed = ((begin == NO_ADDRESS || i >= begin) && + (end == NO_ADDRESS || i <= end)); + SetCellUsed(i, bUsed); SetDisplay(i, defaultDisplay); } } @@ -509,10 +526,7 @@ if (fgetc(f) != EOF) /* if not read through the whole file*/ fseek(f, nCurPos, SEEK_SET); /* reset position for next filetype */ if (nRecs > 0) { - if (fbegin < begin) - begin = fbegin; - if (fend > end) - end = fend; + offset = fend + 1; sLoadType = "FLEX"; } @@ -775,21 +789,13 @@ adr_t Dasm6800::FetchInstructionDetails uint8_t &instpg, uint8_t &instb, uint8_t &mode, - int &MI, - const char *&I, - string *smnemo + int &mnemoIndex ) { -uint16_t W; - instpg = 0; instb = GetUByte(PC++); -W = (uint16_t)instb * 2; -MI = codes[W++]; -I = mnemo[MI].mne; -mode = codes[W]; -if (smnemo) - *smnemo = I; +mnemoIndex = codes[instb].mne; +mode = codes[instb].adrmode; return PC; } @@ -805,10 +811,9 @@ adr_t Dasm6800::ParseCode { uint8_t instpg, instb, T, mode; uint16_t W; -int MI; -const char *I; +int mnemoIndex; bool bSetLabel; -adr_t PC = FetchInstructionDetails(addr, instpg, instb, mode, MI, I); +adr_t PC = FetchInstructionDetails(addr, instpg, instb, mode, mnemoIndex); switch (mode) /* which mode is this ? */ { @@ -834,7 +839,7 @@ switch (mode) /* which mode is this ? */ if (bSetLabel) { W = (uint16_t)PhaseInner(W, PC); - AddRelativeLabel(W, PC, mnemo[MI].memType, true, BusCode, addr); + AddRelativeLabel(W, PC, mnemo[mnemoIndex].memType, true, BusCode, addr); } PC += 2; break; @@ -856,7 +861,7 @@ switch (mode) /* which mode is this ? */ T = GetUByte(PC); W = (uint16_t)dp | T; W = (uint16_t)PhaseInner(W, PC); - AddRelativeLabel(W, PC, mnemo[MI].memType, true, BusCode, addr); + AddRelativeLabel(W, PC, mnemo[mnemoIndex].memType, true, BusCode, addr); } } PC++; @@ -871,7 +876,7 @@ switch (mode) /* which mode is this ? */ { W = GetUWord(PC); W = (uint16_t)PhaseInner(W, PC); - AddRelativeLabel(W, PC, mnemo[MI].memType, true, BusCode, addr); + AddRelativeLabel(W, PC, mnemo[mnemoIndex].memType, true, BusCode, addr); } PC += 2; break; @@ -891,8 +896,8 @@ switch (mode) /* which mode is this ? */ if (bSetLabel) { W = (uint16_t)DephaseOuter(W, PC - 1); - // AddLabel(W, mnemo[MI].memType, "", true); - AddRelativeLabel(W, PC, mnemo[MI].memType, true, BusCode, addr); + // AddLabel(W, mnemo[mnemoIndex].memType, "", true); + AddRelativeLabel(W, PC, mnemo[mnemoIndex].memType, true, BusCode, addr); } break; @@ -922,7 +927,7 @@ if (lbltxt.find_first_of("+-") == string::npos) slabel = lbltxt; else slabel = Label2String(laddr, 4, true, laddr, bus); - smnemo = "EQU"; + smnemo = mnemo[_equ].mne; sparm = Address2String(laddr, bus); Disassembler::DisassembleLabel(label, slabel, smnemo, sparm, bus); return true; @@ -945,7 +950,7 @@ bool Dasm6800::DisassembleDefLabel { (void)bus; slabel = label->GetText(); -smnemo = "EQU"; +smnemo = mnemo[_equ].mne; sparm = label->GetDefinition(); Disassembler::DisassembleDefLabel(label, slabel, smnemo, sparm, bus); return true; @@ -1005,12 +1010,12 @@ adr_t done; if (flags & SHMF_RMB) /* if reserved memory block */ { done = end; /* remember it's done completely */ - smnemo = "RMB"; + smnemo = mnemo[_rmb].mne; sparm = Number2String(end - addr, 4, addr); } else if (useFCC && (flags & SHMF_TXT)) /* if FCC (text) allowed */ { - smnemo = "FCC"; + smnemo = mnemo[_fcc].mne; sparm = '"'; /* start the game */ for (done = addr; done < end; done++) /* assemble as many as possible */ { /* if this would become too long */ @@ -1024,7 +1029,7 @@ else if (useFCC && (flags & SHMF_TXT)) /* if FCC (text) allowed */ else if (flags & 0xff) /* if not byte-sized */ { // 680x can ony do byte and word, so assume word entities - smnemo = "FDB"; + smnemo = mnemo[_fdb].mne; /* assemble as many as possible */ for (done = addr; done < end; done += 2) { @@ -1040,7 +1045,7 @@ else if (flags & 0xff) /* if not byte-sized */ } else /* if FCB (hex or binary) */ { - smnemo = "FCB"; + smnemo = mnemo[_fcb].mne; /* assemble as many as possible */ for (done = addr; done < end; done++) { @@ -1081,16 +1086,16 @@ adr_t Dasm6800::DisassembleCode uint8_t instpg, instb, T, mode; uint16_t W; adr_t Wrel; -int MI; -const char *I; -adr_t PC = FetchInstructionDetails(addr, instpg, instb, mode, MI, I, &smnemo); +int mnemoIndex; +adr_t PC = FetchInstructionDetails(addr, instpg, instb, mode, mnemoIndex); bool bGetLabel; Label *lbl; +smnemo = mnemo[mnemoIndex].mne; switch (mode) /* which mode is this? */ { case _nom: /* no mode */ - smnemo = "FCB"; + smnemo = mnemo[_fcb].mne; lbl = FindLabel(PC, Const, bus); sparm = lbl ? lbl->GetText() : Number2String(instb, 2, PC); PC = addr + 1; @@ -1259,14 +1264,14 @@ switch (u2) case 0xcd01 : /* ADDB #1 + ADCA #0 -> INCD */ if (!IsCLabel(PC + 1) && GetUWord(PC + 1) == 0x8900) { - smnemo = "INCD"; PC += 3; + smnemo = mnemo[_incd].mne; PC += 3; return true; } break; case 0xc001 : /* SUBB #1 SBCA #0 -> DECD */ if (!IsCLabel(PC + 1) && GetUWord(PC + 1) == 0x8200) { - smnemo = "DECD"; PC += 3; + smnemo = mnemo[_decd].mne; PC += 3; return true; } break; @@ -1299,7 +1304,7 @@ if (addr == NO_ADDRESS && prevaddr == NO_ADDRESS) { LineChange chg; changes.push_back(chg); /* append empty line before END */ - chg.oper = MnemoCase("END"); + chg.oper = mnemo[_end].mne; if (load != NO_ADDRESS && /* if entry point address given */ bLoadLabel) /* and labelling wanted */ chg.opnds = Label2String(load, 4, true, load); @@ -1326,7 +1331,7 @@ else // no bus check necessary, there's only one changes.push_back(chg); if (prevphase != NO_ADDRESS && prevphstart != curphstart) { - chg.oper = MnemoCase("DEPHASE"); + chg.oper = MnemoCase(mnemo[_dephase].mne); changes.push_back(chg); changes.push_back(LineChange()); } @@ -1337,14 +1342,14 @@ else // no bus check necessary, there's only one { if (prevaddr != NO_ADDRESS) { - chg.oper = MnemoCase("ORG"); + chg.oper = MnemoCase(mnemo[_org].mne); chg.opnds = "* + "; chg.opnds += Number2String(addr - (prevaddr + prevsz), 4, NO_ADDRESS); } } else { - chg.oper = MnemoCase("ORG"); + chg.oper = MnemoCase(mnemo[_org].mne); chg.opnds = Number2String(addr, 4, NO_ADDRESS); changes.push_back(chg); } @@ -1354,7 +1359,7 @@ else // no bus check necessary, there's only one // && curphase != addr ) { - chg.oper = MnemoCase("PHASE"); + chg.oper = MnemoCase(mnemo[_phase].mne); chg.opnds = Number2String(curphase, 4, NO_ADDRESS); changes.push_back(chg); } diff --git a/Dasm6800.h b/Dasm6800.h index 7941ef4..df2fe5e 100644 --- a/Dasm6800.h +++ b/Dasm6800.h @@ -42,6 +42,15 @@ #define RB_VARIANT 0 #endif +/*****************************************************************************/ +/* CMatrixEntry : little structure for the code matrix entries */ +/*****************************************************************************/ + +struct CMatrixEntry + { + uint16_t mne; /* index of mnemonic */ + uint8_t adrmode; /* addressing mode */ + }; /*****************************************************************************/ /* Dasm6800 : class for a Motorola 6800 processor */ @@ -116,7 +125,7 @@ class Dasm6800 : virtual string Number2String(adr_t value, int nDigits, adr_t addr, int bus = BusCode); virtual string Address2String(adr_t addr, int bus = BusCode) { (void)bus; return sformat("$%04X", addr); } - virtual adr_t FetchInstructionDetails(adr_t PC, uint8_t &instpg, uint8_t &instb, uint8_t &mode, int &MI, const char *&I, string *smnemo = NULL); + virtual adr_t FetchInstructionDetails(adr_t PC, uint8_t &instpg, uint8_t &instb, uint8_t &mode, int &mnemoIndex); virtual string GetIx8IndexReg(uint8_t instpg) { (void)instpg; return MnemoCase(",X"); } virtual bool SetConvenience(uint8_t instpg, uint16_t u2, string &smnemo, adr_t &PC); void AddForced(string &smnemo, string &sparm, bool bExtended = true); @@ -140,6 +149,19 @@ class Dasm6800 : // 6800 mnemonics enum Mnemonics6800 { + _equ, /* start with pseudo-ops */ + _rmb, + _fcb, + _fdb, + _fcc, + _fcs, + _org, + _phase, + _dephase, + _end, + _if, + _else, + _endif, _ill, /* illegal */ _aba, _adca, @@ -188,6 +210,7 @@ class Dasm6800 : _daa, _deca, _decb, + _decd, _dec, _des, _dex, @@ -195,6 +218,7 @@ class Dasm6800 : _eorb, _inca, _incb, + _incd, _inc, _ins, _inx, @@ -257,9 +281,9 @@ class Dasm6800 : mnemo6800_count }; - static uint8_t m6800_codes[512]; + static CMatrixEntry m6800_codes[256]; - uint8_t *codes; + CMatrixEntry *codes; static const char *bit_r[]; static const char *block_r[]; static OpCode opcodes[mnemo6800_count]; diff --git a/Dasm68000.cpp b/Dasm68000.cpp index b76c4b9..469ba9a 100644 --- a/Dasm68000.cpp +++ b/Dasm68000.cpp @@ -217,6 +217,11 @@ Dasm68000::OpDef Dasm68000::OpTable[optblSize] = OpCode Dasm68000::opcodes[mnemo68000_count] = { + { "EQU", Data }, /* _equ */ + { "ORG", Data }, /* _org */ + { "PHASE", Data }, /* _phase */ + { "DEPHASE", Data }, /* _dephase */ + { "END", Data }, /* _end */ { "???", Data }, /* _ill */ { "ABCD", Data }, /* _abcd */ { "ADDA", Data }, /* _adda */ @@ -1585,7 +1590,7 @@ if (lbltxt.find_first_of("+-") == string::npos) slabel = lbltxt; else slabel = Label2String(laddr, GetBusWidth() / 4, true, laddr, bus); - smnemo = "EQU"; + smnemo = mnemo[_equ].mne; sparm = Address2String(laddr, bus); Disassembler::DisassembleLabel(label, slabel, smnemo, sparm, bus); return true; @@ -1608,7 +1613,7 @@ bool Dasm68000::DisassembleDefLabel { (void)bus; slabel = label->GetText(); -smnemo = "EQU"; +smnemo = mnemo[_equ].mne; sparm = label->GetDefinition(); Disassembler::DisassembleDefLabel(label, slabel, smnemo, sparm, bus); return true; @@ -2717,7 +2722,7 @@ if (addr == NO_ADDRESS && prevaddr == NO_ADDRESS) { LineChange chg; changes.push_back(chg); /* append empty line before END */ - chg.oper = MnemoCase("END"); + chg.oper = MnemoCase(mnemo[_end].mne); if (load != NO_ADDRESS && /* if entry point address given */ bLoadLabel) /* and labelling wanted */ chg.opnds = Label2String(load, GetBusWidth() / 4, true, load); @@ -2743,14 +2748,14 @@ else // no bus check necessary, there's only one changes.push_back(chg); if (prevphase != NO_ADDRESS && prevphstart != curphstart) { - chg.oper = MnemoCase("DEPHASE"); + chg.oper = MnemoCase(mnemo[_dephase].mne); changes.push_back(chg); changes.push_back(LineChange()); } if (addr != NO_ADDRESS) { // TODO: check how that interferes with PIC! - chg.oper = MnemoCase("ORG"); + chg.oper = MnemoCase(mnemo[_org].mne); chg.opnds = Number2String(addr, 6, NO_ADDRESS); changes.push_back(chg); if (curphase != NO_ADDRESS && @@ -2759,7 +2764,7 @@ else // no bus check necessary, there's only one // && curphase != addr ) { - chg.oper = MnemoCase("PHASE"); + chg.oper = MnemoCase(mnemo[_phase].mne); chg.opnds = Number2String(curphase, 6, NO_ADDRESS); changes.push_back(chg); } diff --git a/Dasm68000.h b/Dasm68000.h index dbdf6dc..e6227fc 100644 --- a/Dasm68000.h +++ b/Dasm68000.h @@ -148,6 +148,12 @@ class Dasm68000 : }; enum Mnemonics68000 { + _equ, + _org, + _phase, + _dephase, + _end, + _ill, /* illegal */ _abcd, _adda, diff --git a/Dasm6801.cpp b/Dasm6801.cpp index 66794b4..7ef4fb7 100644 --- a/Dasm6801.cpp +++ b/Dasm6801.cpp @@ -56,72 +56,72 @@ static bool bRegistered[] = /* m6801_codes : table of all 6801 instruction bytes and types */ /*****************************************************************************/ -uint8_t Dasm6801::m6801_codes[512] = +CMatrixEntry Dasm6801::m6801_codes[256] = { - _ill ,_nom, _nop ,_imp, _ill ,_nom, _ill ,_nom, /* 00..03 */ - _lsrd ,_imp, _asld ,_imp, _tap ,_imp, _tpa ,_imp, /* 04..07 */ - _inx ,_imp, _dex ,_imp, _clv ,_imp, _sev ,_imp, /* 08..0B */ - _clc ,_imp, _sec ,_imp, _cli ,_imp, _sei ,_imp, /* 0C..0F */ - _sba ,_imp, _cba ,_imp, _ill ,_nom, _ill ,_nom, /* 10..13 */ - _ill ,_nom, _ill ,_nom, _tab ,_imp, _tba ,_imp, /* 14..17 */ - _ill ,_nom, _daa ,_imp, _ill ,_nom, _aba ,_imp, /* 18..1B */ - _ill ,_nom, _ill ,_nom, _ill ,_nom, _ill ,_nom, /* 1C..1F */ - _bra ,_reb, _brn ,_reb, _bhi ,_reb, _bls ,_reb, /* 20..23 */ - _bcc ,_reb, _bcs ,_reb, _bne ,_reb, _beq ,_reb, /* 24..27 */ - _bvc ,_reb, _bvs ,_reb, _bpl ,_reb, _bmi ,_reb, /* 28..2B */ - _bge ,_reb, _blt ,_reb, _bgt ,_reb, _ble ,_reb, /* 2C..2F */ - _tsx ,_imp, _ins ,_imp, _pula ,_imp, _pulb ,_imp, /* 30..33 */ - _des ,_imp, _txs ,_imp, _psha ,_imp, _pshb ,_imp, /* 34..37 */ - _pulx ,_imp, _rts ,_imp, _abx ,_imp, _rti ,_imp, /* 38..3B */ - _pshx ,_imp, _mul ,_imp, _wai ,_imp, _swi ,_imp, /* 3C..3F */ - _nega ,_imp, _ill ,_nom, _ill ,_nom, _coma ,_imp, /* 40..43 */ - _lsra ,_imp, _ill ,_nom, _rora ,_imp, _asra ,_imp, /* 44..47 */ - _asla ,_imp, _rola ,_imp, _deca ,_imp, _ill ,_nom, /* 48..4B */ - _inca ,_imp, _tsta ,_imp, _ill ,_nom, _clra ,_imp, /* 4C..4F */ - _negb ,_imp, _ill ,_nom, _ill ,_nom, _comb ,_imp, /* 50..53 */ - _lsrb ,_imp, _ill ,_nom, _rorb ,_imp, _asrb ,_imp, /* 54..57 */ - _aslb ,_imp, _rolb ,_imp, _decb ,_imp, _ill ,_nom, /* 58..5B */ - _incb ,_imp, _tstb ,_imp, _ill ,_nom, _clrb ,_imp, /* 5C..5F */ - _neg ,_ix8, _ill ,_nom, _ill ,_nom, _com ,_ix8, /* 60..63 */ - _lsr ,_ix8, _ill ,_nom, _ror ,_ix8, _asr ,_ix8, /* 64..67 */ - _asl ,_ix8, _rol ,_ix8, _dec ,_ix8, _ill ,_nom, /* 68..6B */ - _inc ,_ix8, _tst ,_ix8, _jmp ,_ix8, _clr ,_ix8, /* 6C..6F */ - _neg ,_ext, _ill ,_nom, _ill ,_nom, _com ,_ext, /* 70..73 */ - _lsr ,_ext, _ill ,_nom, _ror ,_ext, _asr ,_ext, /* 74..77 */ - _asl ,_ext, _rol ,_ext, _dec ,_ext, _ill ,_nom, /* 78..7B */ - _inc ,_ext, _tst ,_ext, _jmp ,_ext, _clr ,_ext, /* 7C..7F */ - _suba ,_imb, _cmpa ,_imb, _sbca ,_imb, _subd ,_imw, /* 80..83 */ - _anda ,_imb, _bita ,_imb, _lda ,_imb, _ill ,_nom, /* 84..87 */ - _eora ,_imb, _adca ,_imb, _ora ,_imb, _adda ,_imb, /* 88..8B */ - _cpx ,_imw, _bsr ,_reb, _lds ,_imw, _ill ,_nom, /* 8C..8F */ - _suba ,_dir, _cmpa ,_dir, _sbca ,_dir, _subd ,_dir, /* 90..93 */ - _anda ,_dir, _bita ,_dir, _lda ,_dir, _sta ,_dir, /* 94..97 */ - _eora ,_dir, _adca ,_dir, _ora ,_dir, _adda ,_dir, /* 98..9B */ - _cpx ,_dir, _jsr ,_dir, _lds ,_dir, _sts ,_dir, /* 9C..9F */ - _suba ,_ix8, _cmpa ,_ix8, _sbca ,_ix8, _subd ,_ix8, /* A0..A3 */ - _anda ,_ix8, _bita ,_ix8, _lda ,_ix8, _sta ,_ix8, /* A4..A7 */ - _eora ,_ix8, _adca ,_ix8, _ora ,_ix8, _adda ,_ix8, /* A8..AB */ - _cpx ,_ix8, _jsr ,_ix8, _lds ,_ix8, _sts ,_ix8, /* AC..AF */ - _suba ,_ext, _cmpa ,_ext, _sbca ,_ext, _subd ,_ext, /* B0..B3 */ - _anda ,_ext, _bita ,_ext, _lda ,_ext, _sta ,_ext, /* B4..B7 */ - _eora ,_ext, _adca ,_ext, _ora ,_ext, _adda ,_ext, /* B8..BB */ - _cpx ,_ext, _jsr ,_ext, _lds ,_ext, _sts ,_ext, /* BC..BF */ - _subb ,_imb, _cmpb ,_imb, _sbcb ,_imb, _addd ,_imw, /* C0..C3 */ - _andb ,_imb, _bitb ,_imb, _ldb ,_imb, _ill ,_nom, /* C4..C7 */ - _eorb ,_imb, _adcb ,_imb, _orb ,_imb, _addb ,_imb, /* C8..CB */ - _ldd ,_imw, _ill ,_nom, _ldx ,_imw, _ill ,_nom, /* CC..CF */ - _subb ,_dir, _cmpb ,_dir, _sbcb ,_dir, _addd ,_dir, /* D0..D3 */ - _andb ,_dir, _bitb ,_dir, _ldb ,_dir, _stb ,_dir, /* D4..D7 */ - _eorb ,_dir, _adcb ,_dir, _orb ,_dir, _addb ,_dir, /* D8..DB */ - _ldd ,_dir, _std ,_dir, _ldx ,_dir, _stx ,_dir, /* DC..DF */ - _subb ,_ix8, _cmpb ,_ix8, _sbcb ,_ix8, _addd ,_ix8, /* E0..E3 */ - _andb ,_ix8, _bitb ,_ix8, _ldb ,_ix8, _stb ,_ix8, /* E4..E7 */ - _eorb ,_ix8, _adcb ,_ix8, _orb ,_ix8, _addb ,_ix8, /* E8..EB */ - _ldd ,_ix8, _std ,_ix8, _ldx ,_ix8, _stx ,_ix8, /* EC..EF */ - _subb ,_ext, _cmpb ,_ext, _sbcb ,_ext, _addd ,_ext, /* F0..F3 */ - _andb ,_ext, _bitb ,_ext, _ldb ,_ext, _stb ,_ext, /* F4..F7 */ - _eorb ,_ext, _adcb ,_ext, _orb ,_ext, _addb ,_ext, /* F8..FB */ - _ldd ,_ext, _std ,_ext, _ldx ,_ext, _stx ,_ext, /* FC..FF */ + {_ill ,_nom}, {_nop ,_imp}, {_ill ,_nom}, {_ill ,_nom}, /* 00..03 */ + {_lsrd ,_imp}, {_asld ,_imp}, {_tap ,_imp}, {_tpa ,_imp}, /* 04..07 */ + {_inx ,_imp}, {_dex ,_imp}, {_clv ,_imp}, {_sev ,_imp}, /* 08..0B */ + {_clc ,_imp}, {_sec ,_imp}, {_cli ,_imp}, {_sei ,_imp}, /* 0C..0F */ + {_sba ,_imp}, {_cba ,_imp}, {_ill ,_nom}, {_ill ,_nom}, /* 10..13 */ + {_ill ,_nom}, {_ill ,_nom}, {_tab ,_imp}, {_tba ,_imp}, /* 14..17 */ + {_ill ,_nom}, {_daa ,_imp}, {_ill ,_nom}, {_aba ,_imp}, /* 18..1B */ + {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, /* 1C..1F */ + {_bra ,_reb}, {_brn ,_reb}, {_bhi ,_reb}, {_bls ,_reb}, /* 20..23 */ + {_bcc ,_reb}, {_bcs ,_reb}, {_bne ,_reb}, {_beq ,_reb}, /* 24..27 */ + {_bvc ,_reb}, {_bvs ,_reb}, {_bpl ,_reb}, {_bmi ,_reb}, /* 28..2B */ + {_bge ,_reb}, {_blt ,_reb}, {_bgt ,_reb}, {_ble ,_reb}, /* 2C..2F */ + {_tsx ,_imp}, {_ins ,_imp}, {_pula ,_imp}, {_pulb ,_imp}, /* 30..33 */ + {_des ,_imp}, {_txs ,_imp}, {_psha ,_imp}, {_pshb ,_imp}, /* 34..37 */ + {_pulx ,_imp}, {_rts ,_imp}, {_abx ,_imp}, {_rti ,_imp}, /* 38..3B */ + {_pshx ,_imp}, {_mul ,_imp}, {_wai ,_imp}, {_swi ,_imp}, /* 3C..3F */ + {_nega ,_imp}, {_ill ,_nom}, {_ill ,_nom}, {_coma ,_imp}, /* 40..43 */ + {_lsra ,_imp}, {_ill ,_nom}, {_rora ,_imp}, {_asra ,_imp}, /* 44..47 */ + {_asla ,_imp}, {_rola ,_imp}, {_deca ,_imp}, {_ill ,_nom}, /* 48..4B */ + {_inca ,_imp}, {_tsta ,_imp}, {_ill ,_nom}, {_clra ,_imp}, /* 4C..4F */ + {_negb ,_imp}, {_ill ,_nom}, {_ill ,_nom}, {_comb ,_imp}, /* 50..53 */ + {_lsrb ,_imp}, {_ill ,_nom}, {_rorb ,_imp}, {_asrb ,_imp}, /* 54..57 */ + {_aslb ,_imp}, {_rolb ,_imp}, {_decb ,_imp}, {_ill ,_nom}, /* 58..5B */ + {_incb ,_imp}, {_tstb ,_imp}, {_ill ,_nom}, {_clrb ,_imp}, /* 5C..5F */ + {_neg ,_ix8}, {_ill ,_nom}, {_ill ,_nom}, {_com ,_ix8}, /* 60..63 */ + {_lsr ,_ix8}, {_ill ,_nom}, {_ror ,_ix8}, {_asr ,_ix8}, /* 64..67 */ + {_asl ,_ix8}, {_rol ,_ix8}, {_dec ,_ix8}, {_ill ,_nom}, /* 68..6B */ + {_inc ,_ix8}, {_tst ,_ix8}, {_jmp ,_ix8}, {_clr ,_ix8}, /* 6C..6F */ + {_neg ,_ext}, {_ill ,_nom}, {_ill ,_nom}, {_com ,_ext}, /* 70..73 */ + {_lsr ,_ext}, {_ill ,_nom}, {_ror ,_ext}, {_asr ,_ext}, /* 74..77 */ + {_asl ,_ext}, {_rol ,_ext}, {_dec ,_ext}, {_ill ,_nom}, /* 78..7B */ + {_inc ,_ext}, {_tst ,_ext}, {_jmp ,_ext}, {_clr ,_ext}, /* 7C..7F */ + {_suba ,_imb}, {_cmpa ,_imb}, {_sbca ,_imb}, {_subd ,_imw}, /* 80..83 */ + {_anda ,_imb}, {_bita ,_imb}, {_lda ,_imb}, {_ill ,_nom}, /* 84..87 */ + {_eora ,_imb}, {_adca ,_imb}, {_ora ,_imb}, {_adda ,_imb}, /* 88..8B */ + {_cpx ,_imw}, {_bsr ,_reb}, {_lds ,_imw}, {_ill ,_nom}, /* 8C..8F */ + {_suba ,_dir}, {_cmpa ,_dir}, {_sbca ,_dir}, {_subd ,_dir}, /* 90..93 */ + {_anda ,_dir}, {_bita ,_dir}, {_lda ,_dir}, {_sta ,_dir}, /* 94..97 */ + {_eora ,_dir}, {_adca ,_dir}, {_ora ,_dir}, {_adda ,_dir}, /* 98..9B */ + {_cpx ,_dir}, {_jsr ,_dir}, {_lds ,_dir}, {_sts ,_dir}, /* 9C..9F */ + {_suba ,_ix8}, {_cmpa ,_ix8}, {_sbca ,_ix8}, {_subd ,_ix8}, /* A0..A3 */ + {_anda ,_ix8}, {_bita ,_ix8}, {_lda ,_ix8}, {_sta ,_ix8}, /* A4..A7 */ + {_eora ,_ix8}, {_adca ,_ix8}, {_ora ,_ix8}, {_adda ,_ix8}, /* A8..AB */ + {_cpx ,_ix8}, {_jsr ,_ix8}, {_lds ,_ix8}, {_sts ,_ix8}, /* AC..AF */ + {_suba ,_ext}, {_cmpa ,_ext}, {_sbca ,_ext}, {_subd ,_ext}, /* B0..B3 */ + {_anda ,_ext}, {_bita ,_ext}, {_lda ,_ext}, {_sta ,_ext}, /* B4..B7 */ + {_eora ,_ext}, {_adca ,_ext}, {_ora ,_ext}, {_adda ,_ext}, /* B8..BB */ + {_cpx ,_ext}, {_jsr ,_ext}, {_lds ,_ext}, {_sts ,_ext}, /* BC..BF */ + {_subb ,_imb}, {_cmpb ,_imb}, {_sbcb ,_imb}, {_addd ,_imw}, /* C0..C3 */ + {_andb ,_imb}, {_bitb ,_imb}, {_ldb ,_imb}, {_ill ,_nom}, /* C4..C7 */ + {_eorb ,_imb}, {_adcb ,_imb}, {_orb ,_imb}, {_addb ,_imb}, /* C8..CB */ + {_ldd ,_imw}, {_ill ,_nom}, {_ldx ,_imw}, {_ill ,_nom}, /* CC..CF */ + {_subb ,_dir}, {_cmpb ,_dir}, {_sbcb ,_dir}, {_addd ,_dir}, /* D0..D3 */ + {_andb ,_dir}, {_bitb ,_dir}, {_ldb ,_dir}, {_stb ,_dir}, /* D4..D7 */ + {_eorb ,_dir}, {_adcb ,_dir}, {_orb ,_dir}, {_addb ,_dir}, /* D8..DB */ + {_ldd ,_dir}, {_std ,_dir}, {_ldx ,_dir}, {_stx ,_dir}, /* DC..DF */ + {_subb ,_ix8}, {_cmpb ,_ix8}, {_sbcb ,_ix8}, {_addd ,_ix8}, /* E0..E3 */ + {_andb ,_ix8}, {_bitb ,_ix8}, {_ldb ,_ix8}, {_stb ,_ix8}, /* E4..E7 */ + {_eorb ,_ix8}, {_adcb ,_ix8}, {_orb ,_ix8}, {_addb ,_ix8}, /* E8..EB */ + {_ldd ,_ix8}, {_std ,_ix8}, {_ldx ,_ix8}, {_stx ,_ix8}, /* EC..EF */ + {_subb ,_ext}, {_cmpb ,_ext}, {_sbcb ,_ext}, {_addd ,_ext}, /* F0..F3 */ + {_andb ,_ext}, {_bitb ,_ext}, {_ldb ,_ext}, {_stb ,_ext}, /* F4..F7 */ + {_eorb ,_ext}, {_adcb ,_ext}, {_orb ,_ext}, {_addb ,_ext}, /* F8..FB */ + {_ldd ,_ext}, {_std ,_ext}, {_ldx ,_ext}, {_stx ,_ext}, /* FC..FF */ }; /*****************************************************************************/ diff --git a/Dasm6801.h b/Dasm6801.h index fcaf7be..6f3ca9f 100644 --- a/Dasm6801.h +++ b/Dasm6801.h @@ -64,7 +64,7 @@ class Dasm6801 : public Dasm6800 }; - static uint8_t m6801_codes[512]; + static CMatrixEntry m6801_codes[256]; static OpCode opcodes[mnemo6801_count - mnemo6800_count]; }; diff --git a/Dasm6809.cpp b/Dasm6809.cpp index 05920f6..6580b38 100644 --- a/Dasm6809.cpp +++ b/Dasm6809.cpp @@ -126,216 +126,216 @@ const char *Dasm6809::os9_codes[0x100] = /* m6809_codes : table of all 6809 instruction bytes and types */ /*****************************************************************************/ -uint8_t Dasm6809::m6809_codes[512] = +CMatrixEntry Dasm6809::m6809_codes[256] = { - _neg ,_dir, _ill ,_nom, _ill ,_nom, _com ,_dir, /* 00..03 */ - _lsr ,_dir, _ill ,_nom, _ror ,_dir, _asr ,_dir, /* 04..07 */ - _asl ,_dir, _rol ,_dir, _dec ,_dir, _ill ,_nom, /* 08..0B */ - _inc ,_dir, _tst ,_dir, _jmp ,_dir, _clr ,_dir, /* 0C..0F */ - _ill ,_nom, _ill ,_nom, _nop ,_imp, _sync ,_imp, /* 10..13 */ - _ill ,_nom, _ill ,_nom, _lbra ,_rew, _lbsr ,_rew, /* 14..17 */ - _ill ,_nom, _daa ,_imp, _orcc ,_imb, _ill ,_nom, /* 18..1B */ - _andcc,_imb, _sex ,_imp, _exg ,_r1 , _tfr ,_r1 , /* 1C..1F */ - _bra ,_reb, _brn ,_reb, _bhi ,_reb, _bls ,_reb, /* 20..23 */ - _bcc ,_reb, _bcs ,_reb, _bne ,_reb, _beq ,_reb, /* 24..27 */ - _bvc ,_reb, _bvs ,_reb, _bpl ,_reb, _bmi ,_reb, /* 28..2B */ - _bge ,_reb, _blt ,_reb, _bgt ,_reb, _ble ,_reb, /* 2C..2F */ - _leax ,_ind, _leay ,_ind, _leas ,_ind, _leau ,_ind, /* 30..33 */ - _pshs ,_r2 , _puls ,_r2 , _pshu ,_r3 , _pulu ,_r3 , /* 34..37 */ - _ill ,_nom, _rts ,_imp, _abx ,_imp, _rti ,_imp, /* 38..3B */ - _cwai ,_imb, _mul ,_imp, _reset,_imp, _swi ,_imp, /* 3C..3F */ - _nega ,_imp, _ill ,_nom, _ill ,_nom, _coma ,_imp, /* 40..43 */ - _lsra ,_imp, _ill ,_nom, _rora ,_imp, _asra ,_imp, /* 44..47 */ - _asla ,_imp, _rola ,_imp, _deca ,_imp, _ill ,_nom, /* 48..4B */ - _inca ,_imp, _tsta ,_imp, _ill ,_nom, _clra ,_imp, /* 4C..4F */ - _negb ,_imp, _ill ,_nom, _ill ,_nom, _comb ,_imp, /* 50..53 */ - _lsrb ,_imp, _ill ,_nom, _rorb ,_imp, _asrb ,_imp, /* 54..57 */ - _aslb ,_imp, _rolb ,_imp, _decb ,_imp, _ill ,_nom, /* 58..5B */ - _incb ,_imp, _tstb ,_imp, _ill ,_nom, _clrb ,_imp, /* 5C..5F */ - _neg ,_ind, _ill ,_nom, _ill ,_nom, _com ,_ind, /* 60..63 */ - _lsr ,_ind, _ill ,_nom, _ror ,_ind, _asr ,_ind, /* 64..67 */ - _asl ,_ind, _rol ,_ind, _dec ,_ind, _ill ,_nom, /* 68..6B */ - _inc ,_ind, _tst ,_ind, _jmp ,_ind, _clr ,_ind, /* 6C..6F */ - _neg ,_ext, _ill ,_nom, _ill ,_nom, _com ,_ext, /* 70..73 */ - _lsr ,_ext, _ill ,_nom, _ror ,_ext, _asr ,_ext, /* 74..77 */ - _asl ,_ext, _rol ,_ext, _dec ,_ext, _ill ,_nom, /* 78..7B */ - _inc ,_ext, _tst ,_ext, _jmp ,_ext, _clr ,_ext, /* 7C..7F */ - _suba ,_imb, _cmpa ,_imb, _sbca ,_imb, _subd ,_imw, /* 80..83 */ - _anda ,_imb, _bita ,_imb, _lda ,_imb, _ill ,_nom, /* 84..87 */ - _eora ,_imb, _adca ,_imb, _ora ,_imb, _adda ,_imb, /* 88..8B */ - _cmpx ,_imw, _bsr ,_reb, _ldx ,_imw, _ill ,_nom, /* 8C..8F */ - _suba ,_dir, _cmpa ,_dir, _sbca ,_dir, _subd ,_dir, /* 90..93 */ - _anda ,_dir, _bita ,_dir, _lda ,_dir, _sta ,_dir, /* 94..97 */ - _eora ,_dir, _adca ,_dir, _ora ,_dir, _adda ,_dir, /* 98..9B */ - _cmpx ,_dir, _jsr ,_dir, _ldx ,_dir, _stx ,_dir, /* 9C..9F */ - _suba ,_ind, _cmpa ,_ind, _sbca ,_ind, _subd ,_ind, /* A0..A3 */ - _anda ,_ind, _bita ,_ind, _lda ,_ind, _sta ,_ind, /* A4..A7 */ - _eora ,_ind, _adca ,_ind, _ora ,_ind, _adda ,_ind, /* A8..AB */ - _cmpx ,_ind, _jsr ,_ind, _ldx ,_ind, _stx ,_ind, /* AC..AF */ - _suba ,_ext, _cmpa ,_ext, _sbca ,_ext, _subd ,_ext, /* B0..B3 */ - _anda ,_ext, _bita ,_ext, _lda ,_ext, _sta ,_ext, /* B4..B7 */ - _eora ,_ext, _adca ,_ext, _ora ,_ext, _adda ,_ext, /* B8..BB */ - _cmpx ,_ext, _jsr ,_ext, _ldx ,_ext, _stx ,_ext, /* BC..BF */ - _subb ,_imb, _cmpb ,_imb, _sbcb ,_imb, _addd ,_imw, /* C0..C3 */ - _andb ,_imb, _bitb ,_imb, _ldb ,_imb, _ill ,_nom, /* C4..C7 */ - _eorb ,_imb, _adcb ,_imb, _orb ,_imb, _addb ,_imb, /* C8..CB */ - _ldd ,_imw, _ill ,_nom, _ldu ,_imw, _ill ,_nom, /* CC..CF */ - _subb ,_dir, _cmpb ,_dir, _sbcb ,_dir, _addd ,_dir, /* D0..D3 */ - _andb ,_dir, _bitb ,_dir, _ldb ,_dir, _stb ,_dir, /* D4..D7 */ - _eorb ,_dir, _adcb ,_dir, _orb ,_dir, _addb ,_dir, /* D8..DB */ - _ldd ,_dir, _std ,_dir, _ldu ,_dir, _stu ,_dir, /* DC..DF */ - _subb ,_ind, _cmpb ,_ind, _sbcb ,_ind, _addd ,_ind, /* E0..E3 */ - _andb ,_ind, _bitb ,_ind, _ldb ,_ind, _stb ,_ind, /* E4..E7 */ - _eorb ,_ind, _adcb ,_ind, _orb ,_ind, _addb ,_ind, /* E8..EB */ - _ldd ,_ind, _std ,_ind, _ldu ,_ind, _stu ,_ind, /* EC..EF */ - _subb ,_ext, _cmpb ,_ext, _sbcb ,_ext, _addd ,_ext, /* F0..F3 */ - _andb ,_ext, _bitb ,_ext, _ldb ,_ext, _stb ,_ext, /* F4..F7 */ - _eorb ,_ext, _adcb ,_ext, _orb ,_ext, _addb ,_ext, /* F8..FB */ - _ldd ,_ext, _std ,_ext, _ldu ,_ext, _stu ,_ext, /* FC..FF */ + {_neg ,_dir}, {_ill ,_nom}, {_ill ,_nom}, {_com ,_dir}, /* 00..03 */ + {_lsr ,_dir}, {_ill ,_nom}, {_ror ,_dir}, {_asr ,_dir}, /* 04..07 */ + {_asl ,_dir}, {_rol ,_dir}, {_dec ,_dir}, {_ill ,_nom}, /* 08..0B */ + {_inc ,_dir}, {_tst ,_dir}, {_jmp ,_dir}, {_clr ,_dir}, /* 0C..0F */ + {_ill ,_nom}, {_ill ,_nom}, {_nop ,_imp}, {_sync ,_imp}, /* 10..13 */ + {_ill ,_nom}, {_ill ,_nom}, {_lbra ,_rew}, {_lbsr ,_rew}, /* 14..17 */ + {_ill ,_nom}, {_daa ,_imp}, {_orcc ,_imb}, {_ill ,_nom}, /* 18..1B */ + {_andcc,_imb}, {_sex ,_imp}, {_exg ,_r1 }, {_tfr ,_r1 }, /* 1C..1F */ + {_bra ,_reb}, {_brn ,_reb}, {_bhi ,_reb}, {_bls ,_reb}, /* 20..23 */ + {_bcc ,_reb}, {_bcs ,_reb}, {_bne ,_reb}, {_beq ,_reb}, /* 24..27 */ + {_bvc ,_reb}, {_bvs ,_reb}, {_bpl ,_reb}, {_bmi ,_reb}, /* 28..2B */ + {_bge ,_reb}, {_blt ,_reb}, {_bgt ,_reb}, {_ble ,_reb}, /* 2C..2F */ + {_leax ,_ind}, {_leay ,_ind}, {_leas ,_ind}, {_leau ,_ind}, /* 30..33 */ + {_pshs ,_r2 }, {_puls ,_r2 }, {_pshu ,_r3 }, {_pulu ,_r3 }, /* 34..37 */ + {_ill ,_nom}, {_rts ,_imp}, {_abx ,_imp}, {_rti ,_imp}, /* 38..3B */ + {_cwai ,_imb}, {_mul ,_imp}, {_reset,_imp}, {_swi ,_imp}, /* 3C..3F */ + {_nega ,_imp}, {_ill ,_nom}, {_ill ,_nom}, {_coma ,_imp}, /* 40..43 */ + {_lsra ,_imp}, {_ill ,_nom}, {_rora ,_imp}, {_asra ,_imp}, /* 44..47 */ + {_asla ,_imp}, {_rola ,_imp}, {_deca ,_imp}, {_ill ,_nom}, /* 48..4B */ + {_inca ,_imp}, {_tsta ,_imp}, {_ill ,_nom}, {_clra ,_imp}, /* 4C..4F */ + {_negb ,_imp}, {_ill ,_nom}, {_ill ,_nom}, {_comb ,_imp}, /* 50..53 */ + {_lsrb ,_imp}, {_ill ,_nom}, {_rorb ,_imp}, {_asrb ,_imp}, /* 54..57 */ + {_aslb ,_imp}, {_rolb ,_imp}, {_decb ,_imp}, {_ill ,_nom}, /* 58..5B */ + {_incb ,_imp}, {_tstb ,_imp}, {_ill ,_nom}, {_clrb ,_imp}, /* 5C..5F */ + {_neg ,_ind}, {_ill ,_nom}, {_ill ,_nom}, {_com ,_ind}, /* 60..63 */ + {_lsr ,_ind}, {_ill ,_nom}, {_ror ,_ind}, {_asr ,_ind}, /* 64..67 */ + {_asl ,_ind}, {_rol ,_ind}, {_dec ,_ind}, {_ill ,_nom}, /* 68..6B */ + {_inc ,_ind}, {_tst ,_ind}, {_jmp ,_ind}, {_clr ,_ind}, /* 6C..6F */ + {_neg ,_ext}, {_ill ,_nom}, {_ill ,_nom}, {_com ,_ext}, /* 70..73 */ + {_lsr ,_ext}, {_ill ,_nom}, {_ror ,_ext}, {_asr ,_ext}, /* 74..77 */ + {_asl ,_ext}, {_rol ,_ext}, {_dec ,_ext}, {_ill ,_nom}, /* 78..7B */ + {_inc ,_ext}, {_tst ,_ext}, {_jmp ,_ext}, {_clr ,_ext}, /* 7C..7F */ + {_suba ,_imb}, {_cmpa ,_imb}, {_sbca ,_imb}, {_subd ,_imw}, /* 80..83 */ + {_anda ,_imb}, {_bita ,_imb}, {_lda ,_imb}, {_ill ,_nom}, /* 84..87 */ + {_eora ,_imb}, {_adca ,_imb}, {_ora ,_imb}, {_adda ,_imb}, /* 88..8B */ + {_cmpx ,_imw}, {_bsr ,_reb}, {_ldx ,_imw}, {_ill ,_nom}, /* 8C..8F */ + {_suba ,_dir}, {_cmpa ,_dir}, {_sbca ,_dir}, {_subd ,_dir}, /* 90..93 */ + {_anda ,_dir}, {_bita ,_dir}, {_lda ,_dir}, {_sta ,_dir}, /* 94..97 */ + {_eora ,_dir}, {_adca ,_dir}, {_ora ,_dir}, {_adda ,_dir}, /* 98..9B */ + {_cmpx ,_dir}, {_jsr ,_dir}, {_ldx ,_dir}, {_stx ,_dir}, /* 9C..9F */ + {_suba ,_ind}, {_cmpa ,_ind}, {_sbca ,_ind}, {_subd ,_ind}, /* A0..A3 */ + {_anda ,_ind}, {_bita ,_ind}, {_lda ,_ind}, {_sta ,_ind}, /* A4..A7 */ + {_eora ,_ind}, {_adca ,_ind}, {_ora ,_ind}, {_adda ,_ind}, /* A8..AB */ + {_cmpx ,_ind}, {_jsr ,_ind}, {_ldx ,_ind}, {_stx ,_ind}, /* AC..AF */ + {_suba ,_ext}, {_cmpa ,_ext}, {_sbca ,_ext}, {_subd ,_ext}, /* B0..B3 */ + {_anda ,_ext}, {_bita ,_ext}, {_lda ,_ext}, {_sta ,_ext}, /* B4..B7 */ + {_eora ,_ext}, {_adca ,_ext}, {_ora ,_ext}, {_adda ,_ext}, /* B8..BB */ + {_cmpx ,_ext}, {_jsr ,_ext}, {_ldx ,_ext}, {_stx ,_ext}, /* BC..BF */ + {_subb ,_imb}, {_cmpb ,_imb}, {_sbcb ,_imb}, {_addd ,_imw}, /* C0..C3 */ + {_andb ,_imb}, {_bitb ,_imb}, {_ldb ,_imb}, {_ill ,_nom}, /* C4..C7 */ + {_eorb ,_imb}, {_adcb ,_imb}, {_orb ,_imb}, {_addb ,_imb}, /* C8..CB */ + {_ldd ,_imw}, {_ill ,_nom}, {_ldu ,_imw}, {_ill ,_nom}, /* CC..CF */ + {_subb ,_dir}, {_cmpb ,_dir}, {_sbcb ,_dir}, {_addd ,_dir}, /* D0..D3 */ + {_andb ,_dir}, {_bitb ,_dir}, {_ldb ,_dir}, {_stb ,_dir}, /* D4..D7 */ + {_eorb ,_dir}, {_adcb ,_dir}, {_orb ,_dir}, {_addb ,_dir}, /* D8..DB */ + {_ldd ,_dir}, {_std ,_dir}, {_ldu ,_dir}, {_stu ,_dir}, /* DC..DF */ + {_subb ,_ind}, {_cmpb ,_ind}, {_sbcb ,_ind}, {_addd ,_ind}, /* E0..E3 */ + {_andb ,_ind}, {_bitb ,_ind}, {_ldb ,_ind}, {_stb ,_ind}, /* E4..E7 */ + {_eorb ,_ind}, {_adcb ,_ind}, {_orb ,_ind}, {_addb ,_ind}, /* E8..EB */ + {_ldd ,_ind}, {_std ,_ind}, {_ldu ,_ind}, {_stu ,_ind}, /* EC..EF */ + {_subb ,_ext}, {_cmpb ,_ext}, {_sbcb ,_ext}, {_addd ,_ext}, /* F0..F3 */ + {_andb ,_ext}, {_bitb ,_ext}, {_ldb ,_ext}, {_stb ,_ext}, /* F4..F7 */ + {_eorb ,_ext}, {_adcb ,_ext}, {_orb ,_ext}, {_addb ,_ext}, /* F8..FB */ + {_ldd ,_ext}, {_std ,_ext}, {_ldu ,_ext}, {_stu ,_ext}, /* FC..FF */ }; /*****************************************************************************/ /* m6809_codes10 : $10 extended instruction 2nd byte */ /*****************************************************************************/ -uint8_t Dasm6809::m6809_codes10[512] = +CMatrixEntry Dasm6809::m6809_codes10[256] = { - _ill ,_nom, _ill ,_nom, _ill ,_nom, _ill ,_nom, /* 00..03 */ - _ill ,_nom, _ill ,_nom, _ill ,_nom, _ill ,_nom, /* 04..07 */ - _ill ,_nom, _ill ,_nom, _ill ,_nom, _ill ,_nom, /* 08..0B */ - _ill ,_nom, _ill ,_nom, _ill ,_nom, _ill ,_nom, /* 0C..0F */ - _ill ,_nom, _ill ,_nom, _ill ,_nom, _ill ,_nom, /* 10..13 */ - _ill ,_nom, _ill ,_nom, _ill ,_nom, _ill ,_nom, /* 14..17 */ - _ill ,_nom, _ill ,_nom, _ill ,_nom, _ill ,_nom, /* 18..1B */ - _ill ,_nom, _ill ,_nom, _ill ,_nom, _ill ,_nom, /* 1C..1F */ - _ill ,_nom, _lbrn ,_rew, _lbhi ,_rew, _lbls ,_rew, /* 20..23 */ - _lbcc ,_rew, _lbcs ,_rew, _lbne ,_rew, _lbeq ,_rew, /* 24..27 */ - _lbvc ,_rew, _lbvs ,_rew, _lbpl ,_rew, _lbmi ,_rew, /* 28..2B */ - _lbge ,_rew, _lblt ,_rew, _lbgt ,_rew, _lble ,_rew, /* 2C..2F */ - _ill ,_nom, _ill ,_nom, _ill ,_nom, _ill ,_nom, /* 30..33 */ - _ill ,_nom, _ill ,_nom, _ill ,_nom, _ill ,_nom, /* 34..37 */ - _ill ,_nom, _ill ,_nom, _ill ,_nom, _ill ,_nom, /* 38..3B */ - _ill ,_nom, _ill ,_nom, _ill ,_nom, _swi2 ,_imp, /* 3C..3F */ - _ill ,_nom, _ill ,_nom, _ill ,_nom, _ill ,_nom, /* 40..43 */ - _ill ,_nom, _ill ,_nom, _ill ,_nom, _ill ,_nom, /* 44..47 */ - _ill ,_nom, _ill ,_nom, _ill ,_nom, _ill ,_nom, /* 48..4B */ - _ill ,_nom, _ill ,_nom, _ill ,_nom, _ill ,_nom, /* 4C..4F */ - _ill ,_nom, _ill ,_nom, _ill ,_nom, _ill ,_nom, /* 50..53 */ - _ill ,_nom, _ill ,_nom, _ill ,_nom, _ill ,_nom, /* 54..57 */ - _ill ,_nom, _ill ,_nom, _ill ,_nom, _ill ,_nom, /* 58..5B */ - _ill ,_nom, _ill ,_nom, _ill ,_nom, _ill ,_nom, /* 5C..5F */ - _ill ,_nom, _ill ,_nom, _ill ,_nom, _ill ,_nom, /* 60..63 */ - _ill ,_nom, _ill ,_nom, _ill ,_nom, _ill ,_nom, /* 64..67 */ - _ill ,_nom, _ill ,_nom, _ill ,_nom, _ill ,_nom, /* 68..6B */ - _ill ,_nom, _ill ,_nom, _ill ,_nom, _ill ,_nom, /* 6C..6F */ - _ill ,_nom, _ill ,_nom, _ill ,_nom, _ill ,_nom, /* 70..73 */ - _ill ,_nom, _ill ,_nom, _ill ,_nom, _ill ,_nom, /* 74..77 */ - _ill ,_nom, _ill ,_nom, _ill ,_nom, _ill ,_nom, /* 78..7B */ - _ill ,_nom, _ill ,_nom, _ill ,_nom, _ill ,_nom, /* 7C..7F */ - _ill ,_nom, _ill ,_nom, _ill ,_nom, _cmpd ,_imw, /* 80..83 */ - _ill ,_nom, _ill ,_nom, _ill ,_nom, _ill ,_nom, /* 84..87 */ - _ill ,_nom, _ill ,_nom, _ill ,_nom, _ill ,_nom, /* 88..8B */ - _cmpy ,_imw, _ill ,_nom, _ldy ,_imw, _ill ,_nom, /* 8C..8F */ - _ill ,_nom, _ill ,_nom, _ill ,_nom, _cmpd ,_dir, /* 90..93 */ - _ill ,_nom, _ill ,_nom, _ill ,_nom, _ill ,_nom, /* 94..97 */ - _ill ,_nom, _ill ,_nom, _ill ,_nom, _ill ,_nom, /* 98..9B */ - _cmpy ,_dir, _ill ,_nom, _ldy ,_dir, _sty ,_dir, /* 9C..9F */ - _ill ,_nom, _ill ,_nom, _ill ,_nom, _cmpd ,_ind, /* A0..A3 */ - _ill ,_nom, _ill ,_nom, _ill ,_nom, _ill ,_nom, /* A4..A7 */ - _ill ,_nom, _ill ,_nom, _ill ,_nom, _ill ,_nom, /* A8..AB */ - _cmpy ,_ind, _ill ,_nom, _ldy ,_ind, _sty ,_ind, /* AC..AF */ - _ill ,_nom, _ill ,_nom, _ill ,_nom, _cmpd ,_ext, /* B0..B3 */ - _ill ,_nom, _ill ,_nom, _ill ,_nom, _ill ,_nom, /* B4..B7 */ - _ill ,_nom, _ill ,_nom, _ill ,_nom, _ill ,_nom, /* B8..BB */ - _cmpy ,_ext, _ill ,_nom, _ldy ,_ext, _sty ,_ext, /* BC..BF */ - _ill ,_nom, _ill ,_nom, _ill ,_nom, _ill ,_nom, /* C0..C3 */ - _ill ,_nom, _ill ,_nom, _ill ,_nom, _ill ,_nom, /* C4..C7 */ - _ill ,_nom, _ill ,_nom, _ill ,_nom, _ill ,_nom, /* C8..CB */ - _ill ,_nom, _ill ,_nom, _lds ,_imw, _ill ,_nom, /* CC..CF */ - _ill ,_nom, _ill ,_nom, _ill ,_nom, _ill ,_nom, /* D0..D3 */ - _ill ,_nom, _ill ,_nom, _ill ,_nom, _ill ,_nom, /* D4..D7 */ - _ill ,_nom, _ill ,_nom, _ill ,_nom, _ill ,_nom, /* D8..DB */ - _ill ,_nom, _ill ,_nom, _lds ,_dir, _sts ,_dir, /* DC..DF */ - _ill ,_nom, _ill ,_nom, _ill ,_nom, _ill ,_nom, /* E0..E3 */ - _ill ,_nom, _ill ,_nom, _ill ,_nom, _ill ,_nom, /* E4..E7 */ - _ill ,_nom, _ill ,_nom, _ill ,_nom, _ill ,_nom, /* E8..EB */ - _ill ,_nom, _ill ,_nom, _lds ,_ind, _sts ,_ind, /* EC..EF */ - _ill ,_nom, _ill ,_nom, _ill ,_nom, _ill ,_nom, /* F0..F3 */ - _ill ,_nom, _ill ,_nom, _ill ,_nom, _ill ,_nom, /* F4..F7 */ - _ill ,_nom, _ill ,_nom, _ill ,_nom, _ill ,_nom, /* F8..FB */ - _ill ,_nom, _ill ,_nom, _lds ,_ext, _sts ,_ext, /* FC..FF */ + {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, /* 00..03 */ + {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, /* 04..07 */ + {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, /* 08..0B */ + {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, /* 0C..0F */ + {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, /* 10..13 */ + {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, /* 14..17 */ + {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, /* 18..1B */ + {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, /* 1C..1F */ + {_ill ,_nom}, {_lbrn ,_rew}, {_lbhi ,_rew}, {_lbls ,_rew}, /* 20..23 */ + {_lbcc ,_rew}, {_lbcs ,_rew}, {_lbne ,_rew}, {_lbeq ,_rew}, /* 24..27 */ + {_lbvc ,_rew}, {_lbvs ,_rew}, {_lbpl ,_rew}, {_lbmi ,_rew}, /* 28..2B */ + {_lbge ,_rew}, {_lblt ,_rew}, {_lbgt ,_rew}, {_lble ,_rew}, /* 2C..2F */ + {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, /* 30..33 */ + {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, /* 34..37 */ + {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, /* 38..3B */ + {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, {_swi2 ,_imp}, /* 3C..3F */ + {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, /* 40..43 */ + {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, /* 44..47 */ + {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, /* 48..4B */ + {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, /* 4C..4F */ + {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, /* 50..53 */ + {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, /* 54..57 */ + {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, /* 58..5B */ + {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, /* 5C..5F */ + {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, /* 60..63 */ + {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, /* 64..67 */ + {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, /* 68..6B */ + {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, /* 6C..6F */ + {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, /* 70..73 */ + {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, /* 74..77 */ + {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, /* 78..7B */ + {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, /* 7C..7F */ + {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, {_cmpd ,_imw}, /* 80..83 */ + {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, /* 84..87 */ + {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, /* 88..8B */ + {_cmpy ,_imw}, {_ill ,_nom}, {_ldy ,_imw}, {_ill ,_nom}, /* 8C..8F */ + {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, {_cmpd ,_dir}, /* 90..93 */ + {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, /* 94..97 */ + {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, /* 98..9B */ + {_cmpy ,_dir}, {_ill ,_nom}, {_ldy ,_dir}, {_sty ,_dir}, /* 9C..9F */ + {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, {_cmpd ,_ind}, /* A0..A3 */ + {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, /* A4..A7 */ + {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, /* A8..AB */ + {_cmpy ,_ind}, {_ill ,_nom}, {_ldy ,_ind}, {_sty ,_ind}, /* AC..AF */ + {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, {_cmpd ,_ext}, /* B0..B3 */ + {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, /* B4..B7 */ + {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, /* B8..BB */ + {_cmpy ,_ext}, {_ill ,_nom}, {_ldy ,_ext}, {_sty ,_ext}, /* BC..BF */ + {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, /* C0..C3 */ + {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, /* C4..C7 */ + {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, /* C8..CB */ + {_ill ,_nom}, {_ill ,_nom}, {_lds ,_imw}, {_ill ,_nom}, /* CC..CF */ + {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, /* D0..D3 */ + {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, /* D4..D7 */ + {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, /* D8..DB */ + {_ill ,_nom}, {_ill ,_nom}, {_lds ,_dir}, {_sts ,_dir}, /* DC..DF */ + {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, /* E0..E3 */ + {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, /* E4..E7 */ + {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, /* E8..EB */ + {_ill ,_nom}, {_ill ,_nom}, {_lds ,_ind}, {_sts ,_ind}, /* EC..EF */ + {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, /* F0..F3 */ + {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, /* F4..F7 */ + {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, /* F8..FB */ + {_ill ,_nom}, {_ill ,_nom}, {_lds ,_ext}, {_sts ,_ext}, /* FC..FF */ }; /*****************************************************************************/ /* m6809_codes11 : $11 extended instruction 2nd byte */ /*****************************************************************************/ -uint8_t Dasm6809::m6809_codes11[512] = +CMatrixEntry Dasm6809::m6809_codes11[256] = { - _ill ,_nom, _ill ,_nom, _ill ,_nom, _ill ,_nom, /* 00..03 */ - _ill ,_nom, _ill ,_nom, _ill ,_nom, _ill ,_nom, /* 04..07 */ - _ill ,_nom, _ill ,_nom, _ill ,_nom, _ill ,_nom, /* 08..0B */ - _ill ,_nom, _ill ,_nom, _ill ,_nom, _ill ,_nom, /* 0C..0F */ - _ill ,_nom, _ill ,_nom, _ill ,_nom, _ill ,_nom, /* 10..13 */ - _ill ,_nom, _ill ,_nom, _ill ,_nom, _ill ,_nom, /* 14..17 */ - _ill ,_nom, _ill ,_nom, _ill ,_nom, _ill ,_nom, /* 18..1B */ - _ill ,_nom, _ill ,_nom, _ill ,_nom, _ill ,_nom, /* 1C..1F */ - _ill ,_nom, _ill ,_nom, _ill ,_nom, _ill ,_nom, /* 20..23 */ - _ill ,_nom, _ill ,_nom, _ill ,_nom, _ill ,_nom, /* 24..27 */ - _ill ,_nom, _ill ,_nom, _ill ,_nom, _ill ,_nom, /* 28..2B */ - _ill ,_nom, _ill ,_nom, _ill ,_nom, _ill ,_nom, /* 2C..2F */ - _ill ,_nom, _ill ,_nom, _ill ,_nom, _ill ,_nom, /* 30..33 */ - _ill ,_nom, _ill ,_nom, _ill ,_nom, _ill ,_nom, /* 34..37 */ - _ill ,_nom, _ill ,_nom, _ill ,_nom, _ill ,_nom, /* 38..3B */ - _ill ,_nom, _ill ,_nom, _ill ,_nom, _swi3 ,_imp, /* 3C..3F */ - _ill ,_nom, _ill ,_nom, _ill ,_nom, _ill ,_nom, /* 40..43 */ - _ill ,_nom, _ill ,_nom, _ill ,_nom, _ill ,_nom, /* 44..47 */ - _ill ,_nom, _ill ,_nom, _ill ,_nom, _ill ,_nom, /* 48..4B */ - _ill ,_nom, _ill ,_nom, _ill ,_nom, _ill ,_nom, /* 4C..4F */ - _ill ,_nom, _ill ,_nom, _ill ,_nom, _ill ,_nom, /* 50..53 */ - _ill ,_nom, _ill ,_nom, _ill ,_nom, _ill ,_nom, /* 54..57 */ - _ill ,_nom, _ill ,_nom, _ill ,_nom, _ill ,_nom, /* 58..5B */ - _ill ,_nom, _ill ,_nom, _ill ,_nom, _ill ,_nom, /* 5C..5F */ - _ill ,_nom, _ill ,_nom, _ill ,_nom, _ill ,_nom, /* 60..63 */ - _ill ,_nom, _ill ,_nom, _ill ,_nom, _ill ,_nom, /* 64..67 */ - _ill ,_nom, _ill ,_nom, _ill ,_nom, _ill ,_nom, /* 68..6B */ - _ill ,_nom, _ill ,_nom, _ill ,_nom, _ill ,_nom, /* 6C..6F */ - _ill ,_nom, _ill ,_nom, _ill ,_nom, _ill ,_nom, /* 70..73 */ - _ill ,_nom, _ill ,_nom, _ill ,_nom, _ill ,_nom, /* 74..77 */ - _ill ,_nom, _ill ,_nom, _ill ,_nom, _ill ,_nom, /* 78..7B */ - _ill ,_nom, _ill ,_nom, _ill ,_nom, _ill ,_nom, /* 7C..7F */ - _ill ,_nom, _ill ,_nom, _ill ,_nom, _cmpu ,_imw, /* 80..83 */ - _ill ,_nom, _ill ,_nom, _ill ,_nom, _ill ,_nom, /* 84..87 */ - _ill ,_nom, _ill ,_nom, _ill ,_nom, _ill ,_nom, /* 88..8B */ - _cmps ,_imw, _ill ,_nom, _ill ,_nom, _ill ,_nom, /* 8C..8F */ - _ill ,_nom, _ill ,_nom, _ill ,_nom, _cmpu ,_dir, /* 90..93 */ - _ill ,_nom, _ill ,_nom, _ill ,_nom, _ill ,_nom, /* 94..97 */ - _ill ,_nom, _ill ,_nom, _ill ,_nom, _ill ,_nom, /* 98..9B */ - _cmps ,_dir, _ill ,_nom, _ill ,_nom, _ill ,_nom, /* 9C..9F */ - _ill ,_nom, _ill ,_nom, _ill ,_nom, _cmpu ,_ind, /* A0..A3 */ - _ill ,_nom, _ill ,_nom, _ill ,_nom, _ill ,_nom, /* A4..A7 */ - _ill ,_nom, _ill ,_nom, _ill ,_nom, _ill ,_nom, /* A8..AB */ - _cmps ,_ind, _ill ,_nom, _ill ,_nom, _ill ,_nom, /* AC..AF */ - _ill ,_nom, _ill ,_nom, _ill ,_nom, _cmpu ,_ext, /* B0..B3 */ - _ill ,_nom, _ill ,_nom, _ill ,_nom, _ill ,_nom, /* B4..B7 */ - _ill ,_nom, _ill ,_nom, _ill ,_nom, _ill ,_nom, /* B8..BB */ - _cmps ,_ext, _ill ,_nom, _ill ,_nom, _ill ,_nom, /* BC..BF */ - _ill ,_nom, _ill ,_nom, _ill ,_nom, _ill ,_nom, /* C0..C3 */ - _ill ,_nom, _ill ,_nom, _ill ,_nom, _ill ,_nom, /* C4..C7 */ - _ill ,_nom, _ill ,_nom, _ill ,_nom, _ill ,_nom, /* C8..CB */ - _ill ,_nom, _ill ,_nom, _ill ,_nom, _ill ,_nom, /* CC..CF */ - _ill ,_nom, _ill ,_nom, _ill ,_nom, _ill ,_nom, /* D0..D3 */ - _ill ,_nom, _ill ,_nom, _ill ,_nom, _ill ,_nom, /* D4..D7 */ - _ill ,_nom, _ill ,_nom, _ill ,_nom, _ill ,_nom, /* D8..DB */ - _ill ,_nom, _ill ,_nom, _ill ,_nom, _ill ,_nom, /* DC..DF */ - _ill ,_nom, _ill ,_nom, _ill ,_nom, _ill ,_nom, /* E0..E3 */ - _ill ,_nom, _ill ,_nom, _ill ,_nom, _ill ,_nom, /* E4..E7 */ - _ill ,_nom, _ill ,_nom, _ill ,_nom, _ill ,_nom, /* E8..EB */ - _ill ,_nom, _ill ,_nom, _ill ,_nom, _ill ,_nom, /* EC..EF */ - _ill ,_nom, _ill ,_nom, _ill ,_nom, _ill ,_nom, /* F0..F3 */ - _ill ,_nom, _ill ,_nom, _ill ,_nom, _ill ,_nom, /* F4..F7 */ - _ill ,_nom, _ill ,_nom, _ill ,_nom, _ill ,_nom, /* F8..FB */ - _ill ,_nom, _ill ,_nom, _ill ,_nom, _ill ,_nom, /* FC..FF */ + {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, /* 00..03 */ + {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, /* 04..07 */ + {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, /* 08..0B */ + {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, /* 0C..0F */ + {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, /* 10..13 */ + {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, /* 14..17 */ + {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, /* 18..1B */ + {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, /* 1C..1F */ + {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, /* 20..23 */ + {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, /* 24..27 */ + {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, /* 28..2B */ + {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, /* 2C..2F */ + {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, /* 30..33 */ + {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, /* 34..37 */ + {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, /* 38..3B */ + {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, {_swi3 ,_imp}, /* 3C..3F */ + {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, /* 40..43 */ + {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, /* 44..47 */ + {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, /* 48..4B */ + {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, /* 4C..4F */ + {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, /* 50..53 */ + {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, /* 54..57 */ + {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, /* 58..5B */ + {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, /* 5C..5F */ + {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, /* 60..63 */ + {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, /* 64..67 */ + {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, /* 68..6B */ + {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, /* 6C..6F */ + {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, /* 70..73 */ + {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, /* 74..77 */ + {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, /* 78..7B */ + {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, /* 7C..7F */ + {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, {_cmpu ,_imw}, /* 80..83 */ + {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, /* 84..87 */ + {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, /* 88..8B */ + {_cmps ,_imw}, {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, /* 8C..8F */ + {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, {_cmpu ,_dir}, /* 90..93 */ + {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, /* 94..97 */ + {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, /* 98..9B */ + {_cmps ,_dir}, {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, /* 9C..9F */ + {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, {_cmpu ,_ind}, /* A0..A3 */ + {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, /* A4..A7 */ + {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, /* A8..AB */ + {_cmps ,_ind}, {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, /* AC..AF */ + {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, {_cmpu ,_ext}, /* B0..B3 */ + {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, /* B4..B7 */ + {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, /* B8..BB */ + {_cmps ,_ext}, {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, /* BC..BF */ + {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, /* C0..C3 */ + {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, /* C4..C7 */ + {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, /* C8..CB */ + {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, /* CC..CF */ + {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, /* D0..D3 */ + {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, /* D4..D7 */ + {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, /* D8..DB */ + {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, /* DC..DF */ + {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, /* E0..E3 */ + {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, /* E4..E7 */ + {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, /* E8..EB */ + {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, /* EC..EF */ + {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, /* F0..F3 */ + {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, /* F4..F7 */ + {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, /* F8..FB */ + {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, /* FC..FF */ }; @@ -404,6 +404,8 @@ OpCode Dasm6809::opcodes[mnemo6809_count - mnemo6800_count] = { "SWI3", Data }, /* _swi3 */ { "SYNC", Data }, /* _sync */ { "TFR", Data }, /* _tfr */ + { "SETDP", Data }, /* _setdp */ + { "OS9", Data }, /* _os9 */ // Convenience mnemonics { "CLF", Data }, /* _clf */ { "CLIF", Data }, /* _clif */ @@ -412,6 +414,12 @@ OpCode Dasm6809::opcodes[mnemo6809_count - mnemo6800_count] = { "DEY", Data }, /* _dey */ { "INU", Data }, /* _inu */ { "INY", Data }, /* _iny */ + { "PSHD", Data }, /* _pshd */ + { "PSHX", Data }, /* _pshx */ + { "PSHY", Data }, /* _pshy */ + { "PULD", Data }, /* _puld */ + { "PULX", Data }, /* _pulx */ + { "PULY", Data }, /* _puly */ { "SEF", Data }, /* _sef */ { "SEIF", Data }, /* _seif */ { "SEZ", Data }, /* _sez */ @@ -575,7 +583,7 @@ static struct /* structure to convert key to type */ } sKey[] = { { "SETDP", infoSetDP }, - { "UNSETDP", infoSetDP }, + { "UNSETDP", infoUnsetDP }, }; InfoCmd cmdType = infoUnknown; @@ -637,6 +645,80 @@ switch (cmdType) return true; } +/*****************************************************************************/ +/* LoadRel : loads a relocatable module generated by RELASMB */ +/*****************************************************************************/ + +bool Dasm6809::LoadRel(FILE *f, string &sLoadType) +{ +int c = fgetc(f); /* fetch first byte to decide */ +if (c == EOF) /* whether it may be a rel module */ + return false; +ungetc(c, f); +if (c != 0x03) + return false; + +int nCurPos = ftell(f); /* remember where we started */ + +bool ok = true; +bool isCommon = true; +// read the capsules +int nCapStart = nCurPos; +while (ok) + { + ok &= LoadRelCapsule(f, isCommon); + if (feof(f)) + break; + nCapStart = ftell(f); + } + +if (ok) + sLoadType = "REL"; +else + fseek(f, nCurPos, SEEK_SET); /* seek back */ +return ok; +} + +/*****************************************************************************/ +/* LoadRelCapsule : loads a relocatable module capsule */ +/*****************************************************************************/ + +bool Dasm6809::LoadRelCapsule(FILE *f, bool &isCommon) +{ +RelCapsuleHeader c; +if (fread(&c, 1, sizeof(c), f) != sizeof(c)) + return false; +if (c.signature != 0x03 || + (c.flags1 != 0x10 && c.flags1 != 0x12 && c.flags1 != 0x18)) + return false; +// module layout: +// []* +int capsbytes = sizeof(c); + +switch (c.flags1) /* what's this one, exactly? */ + { + case 0x10 : /* a relative code capsule? */ + isCommon = false; + break; + case 0x12 : /* an absolute code capsule? */ + isCommon = false; + break; + case 0x18 : /* a common capsule ? */ + if (!isCommon) /* that must be before code */ + return false; + break; + } + +while (capsbytes % 0xfc) /* capsule is filled up with zeroes */ + { /* to FLEX sector size (252) */ + int x = fgetc(f); + if (x) + return false; + capsbytes++; + } +return true; +} + /*****************************************************************************/ /* LoadOS9 : loads an OS9 module */ /*****************************************************************************/ @@ -733,10 +815,13 @@ if (crc24[0] != 0x80 || /* CRCCHK checks against $800FE3! */ } // loaded & checked OK, so set up contents +#if 0 if (fbegin < begin) begin = fbegin; if (fend > end) end = fend; +#endif + sLoadType = "OS9"; os9Patch = true; // in this case, DO patch OS9 codes. bPIC = true; // and default to position-independent code @@ -838,7 +923,9 @@ for (i = fbegin; i <= fend; i++) SetMemType(i, Data); else SetMemType(i, Code); - SetCellUsed(i); + bool bUsed = ((begin == NO_ADDRESS || i >= begin) && + (end == NO_ADDRESS || i <= end)); + SetCellUsed(i, bUsed); SetDisplay(i, defaultDisplay); } SetupOS9(fbegin, wModSize, mod.h); @@ -857,28 +944,30 @@ if (os9ModHeader) if (wExecOff) AddLabel(loadAddr + wExecOff, Code, modstrt, true); - pApp->AddComment(fbegin, false, " IF 0", true, false); + pApp->AddComment(fbegin, false, sformat("%*s %s%*s 0", 7, "", mnemo[_if].mne, 5, ""), true, false); pApp->AddComment(startContent, false, "", true, false); - pApp->AddComment(startContent, false, " ENDIF", true, false); - pApp->AddComment(startContent, false, datasize + " EQU " + Number2String(wPSReq, 4, NO_ADDRESS), true, false); - pApp->AddComment(startContent, false, modnm + " fcs /" + modname + "/", true, false); - string modcmd(" mod "); + pApp->AddComment(startContent, false, sformat("%*s %s", 7, "", mnemo[_endif].mne), true, false); + pApp->AddComment(startContent, false, datasize + " " + mnemo[_equ].mne + " " + Number2String(wPSReq, 4, NO_ADDRESS), true, false); + pApp->AddComment(startContent, false, modnm + " " + mnemo[_fcs].mne + " /" + modname + "/", true, false); + string modcmd(sformat("%*s %s%*s", 7, "", "mod", 4, "")); modcmd += modsiz + "," + modnm + "," + modtypename + "," + attributes + ","; modcmd += modstrt + "," + datasize; pApp->AddComment(startContent, false, modcmd, true, false); - pApp->AddComment(startContent, false, " ELSE", true, false); + pApp->AddComment(startContent, false, sformat("%*s %s", 7, "", mnemo[_else].mne), true, false); adr_t chksadr = fend - 2; - pApp->AddComment(chksadr, false, " IF 0", true, false); + pApp->AddComment(chksadr, false, sformat("%*s %s%*s 0", 7, "", mnemo[_if].mne, 5, ""), true, false); pApp->AddComment(chksadr, false, "", true, false); - pApp->AddComment(chksadr, true, " ENDIF", true, false); - pApp->AddComment(chksadr, true, modsiz + " equ *", true, false); - pApp->AddComment(chksadr, true, " emod", true, false); - pApp->AddComment(chksadr, true, " ELSE", true, false); + pApp->AddComment(chksadr, true, sformat("%*s %s", 7, "", mnemo[_endif].mne), true, false); + pApp->AddComment(chksadr, true, modsiz + " " + mnemo[_equ].mne + " *", true, false); + pApp->AddComment(chksadr, true, sformat("%*s %s", 7, "", "emod"), true, false); + pApp->AddComment(chksadr, true, sformat("%*s %s", 7, "", mnemo[_else].mne), true, false); } else if (wExecOff) AddLabel(fbegin + wExecOff, Code, "", true); +offset = fend + 1; + (void)wPSReq; // keep gcc happy return true; @@ -1022,6 +1111,7 @@ return true; bool Dasm6809::LoadFile(string filename, FILE *f, string &sLoadType, int interleave, int bus) { return LoadOS9(f, sLoadType) || // OS9 files need no interleave nor bus + LoadRel(f, sLoadType) || // RELASMB output needs no interleave nor bus Dasm6800::LoadFile(filename, f, sLoadType, interleave, bus); } @@ -1082,42 +1172,29 @@ adr_t Dasm6809::FetchInstructionDetails uint8_t &instpg, uint8_t &instb, uint8_t &mode, - int &MI, - const char *&I, - string *smnemo + int &mnemoIndex ) { -uint16_t W; -uint8_t T; - instpg = instb = GetUByte(PC++); if (instpg == 0x10) { - T = GetUByte(PC++); - W = T * 2; - MI = T = codes10[W++]; - I = mnemo[MI].mne; - mode = codes10[W]; + instb = GetUByte(PC++); + mnemoIndex = codes10[instb].mne; + mode = codes10[instb].adrmode; } else if (instpg == 0x11) { - T = GetUByte(PC++); - W = T * 2; - MI = codes11[W++]; - I = mnemo[MI].mne; - mode = codes11[W]; + instb = GetUByte(PC++); + mnemoIndex = codes11[instb].mne; + mode = codes11[instb].adrmode; } else { instpg = 0; - W = (uint16_t)instb * 2; - MI = codes[W++]; - mode = codes[W]; - I = mnemo[MI].mne; + mnemoIndex = codes[instb].mne; + mode = codes[instb].adrmode; } -if (smnemo) - *smnemo = I; return PC; } @@ -1238,13 +1315,13 @@ switch (u2) smnemo = mnemo[_psha].mne; PC++; return true; case 0x3406 : /* PSHS D -> PSHD */ - smnemo = "PSHD"; PC++; + smnemo = mnemo[_pshd].mne; PC++; return true; case 0x3410 : /* PSHS X -> PSHX */ - smnemo = "PSHX"; PC++; + smnemo = mnemo[_pshx].mne; PC++; return true; case 0x3420 : /* PSHS Y -> PSHY */ - smnemo = "PSHY"; PC++; + smnemo = mnemo[_pshy].mne; PC++; return true; case 0x3502 : /* PULS A -> PULA */ smnemo = mnemo[_pula].mne; PC++; @@ -1253,19 +1330,19 @@ switch (u2) smnemo = mnemo[_pulb].mne; PC++; return true; case 0x3506 : /* PULS D -> PULD */ - smnemo = "PULD"; PC++; + smnemo = mnemo[_puld].mne; PC++; return true; case 0x3510 : /* PULS X -> PULX */ - smnemo = "PULX"; PC++; + smnemo = mnemo[_pulx].mne; PC++; return true; case 0x3520 : /* PULS Y -> PULY */ - smnemo = "PULY"; PC++; + smnemo = mnemo[_puly].mne; PC++; return true; case 0x8300 : /* SUBD #1 -> DECD */ W = GetUWord(PC); if (W == 1) { - smnemo = "DECD"; PC += 2; + smnemo = mnemo[_decd].mne; PC += 2; return true; } break; @@ -1273,7 +1350,7 @@ switch (u2) W = GetUWord(PC); if (W == 1) { - smnemo = "INCD"; PC += 2; + smnemo = mnemo[_incd].mne; PC += 2; return true; } break; @@ -1290,7 +1367,7 @@ return Dasm6800::SetConvenience(instpg, u2, smnemo, PC); /*****************************************************************************/ #define HMHMHM 0 -adr_t Dasm6809::IndexParse(int MI, adr_t pc, adr_t instaddr) +adr_t Dasm6809::IndexParse(int mnemoIndex, adr_t pc, adr_t instaddr) { uint8_t T; uint16_t W; @@ -1330,10 +1407,10 @@ if (T & 0x80) T = GetUByte(PC++); if (bSetLabel) #if HMHMHM - AddRelativeLabel((uint16_t)((int)((char)T) + PC), PC - 1, mnemo[MI].memType, + AddRelativeLabel((uint16_t)((int)((char)T) + PC), PC - 1, mnemo[mnemoIndex].memType, true, BusCode, instaddr); #else - AddLabel((uint16_t)((int)((char)T) + PC), mnemo[MI].memType, "", true); + AddLabel((uint16_t)((int)((char)T) + PC), mnemo[mnemoIndex].memType, "", true); #endif break; case 0x08: @@ -1351,10 +1428,10 @@ if (T & 0x80) (W != Wrel || /* if it's relative, or label's there*/ FindLabel(Wrel))) #if 1 - AddRelativeLabel(W, PC, mnemo[MI].memType, true, BusCode, instaddr); + AddRelativeLabel(W, PC, mnemo[mnemoIndex].memType, true, BusCode, instaddr); #else AddLabel(Wrel, /* mark it as used */ - mnemo[MI].memType, "", true); + mnemo[mnemoIndex].memType, "", true); #endif PC++; break; @@ -1370,10 +1447,10 @@ if (T & 0x80) W = GetUWord(PC); PC += 2; if (bSetLabel) #if HMHMHM - AddRelativeLabel((uint16_t)(W + PC), PC - 2, mnemo[MI].memType, true, + AddRelativeLabel((uint16_t)(W + PC), PC - 2, mnemo[mnemoIndex].memType, true, BusCode, instaddr); #else - AddLabel((uint16_t)(W + PC), mnemo[MI].memType, "", true); + AddLabel((uint16_t)(W + PC), mnemo[mnemoIndex].memType, "", true); #endif break; case 0x09: @@ -1390,10 +1467,10 @@ if (T & 0x80) (W != Wrel || /* if it's relative, or label's there*/ FindLabel(Wrel))) #if 1 - AddRelativeLabel(W, PC, mnemo[MI].memType, true, BusCode, instaddr); + AddRelativeLabel(W, PC, mnemo[mnemoIndex].memType, true, BusCode, instaddr); #else AddLabel(Wrel, /* mark it as used */ - mnemo[MI].memType, "", true); + mnemo[mnemoIndex].memType, "", true); #endif PC += 2; break; @@ -1406,10 +1483,10 @@ if (T & 0x80) W = GetUWord(PC); PC += 2; if (bSetLabel) #if HMHMHM - AddRelativeLabel((uint16_t)(W + PC), PC - 2, mnemo[MI].memType, true, + AddRelativeLabel((uint16_t)(W + PC), PC - 2, mnemo[mnemoIndex].memType, true, BusCode, instaddr); #else - AddLabel((uint16_t)(W + PC), mnemo[MI].memType, "", true); + AddLabel((uint16_t)(W + PC), mnemo[mnemoIndex].memType, "", true); #endif break; @@ -1424,9 +1501,9 @@ if (T & 0x80) W = GetUWord(PC); if (bSetLabel) #if HMHMHM - AddRelativeLabel(W, PC, mnemo[MI].memType, true, BusCode, instaddr); + AddRelativeLabel(W, PC, mnemo[mnemoIndex].memType, true, BusCode, instaddr); #else - AddLabel(W, mnemo[MI].memType, "", true); + AddLabel(W, mnemo[mnemoIndex].memType, "", true); #endif PC += 2; } @@ -1447,9 +1524,9 @@ else W = (uint16_t)(c + Wrel); if (bSetLabel) #if HMHMHM - AddRelativeLabel(W, PC - 1, mnemo[MI].memType, true, BusCode, instaddr); + AddRelativeLabel(W, PC - 1, mnemo[mnemoIndex].memType, true, BusCode, instaddr); #else - AddLabel(W, mnemo[MI].memType, "", true); + AddLabel(W, mnemo[mnemoIndex].memType, "", true); #endif } else @@ -1777,19 +1854,18 @@ adr_t Dasm6809::ParseCode { uint8_t instpg, instb, /* T, */ mode; uint16_t W; -int MI; -const char *I; +int mnemoIndex; bool bSetLabel; Label *lbl; -adr_t PC = FetchInstructionDetails(addr, instpg, instb, mode, MI, I); +adr_t PC = FetchInstructionDetails(addr, instpg, instb, mode, mnemoIndex); -if ((MI == _swi2) && os9Patch) +if ((mnemoIndex == _swi2) && os9Patch) return (PC + 1 - addr); switch (mode) /* which mode is this ? */ { case _ind: /* indexed */ - PC = IndexParse(MI, PC, addr); + PC = IndexParse(mnemoIndex, PC, addr); break; case _rew: /* relative word */ @@ -1802,7 +1878,7 @@ switch (mode) /* which mode is this ? */ W += (uint16_t)PC; W = (uint16_t)DephaseOuter(W, PC - 2); if (bSetLabel) - AddLabel(W, mnemo[MI].memType, "", true); + AddLabel(W, mnemo[mnemoIndex].memType, "", true); break; case _r1: /* tfr/exg mode */ @@ -1834,17 +1910,16 @@ adr_t Dasm6809::DisassembleCode { uint8_t instpg, instb, T, mode; uint16_t W; -int MI; -const char *I; -adr_t PC = addr; +int mnemoIndex; +adr_t PC = FetchInstructionDetails(addr, instpg, instb, mode, mnemoIndex); bool bGetLabel; Label *lbl; -PC = FetchInstructionDetails(PC, instpg, instb, mode, MI, I, &smnemo); -if ((MI == _swi2) && os9Patch) +smnemo = mnemo[mnemoIndex].mne; +if ((mnemoIndex == _swi2) && os9Patch) { T = GetUByte(PC++); - smnemo = "OS9"; + smnemo = mnemo[_os9].mne; sparm = os9_codes[T]; return PC - addr; } @@ -1984,7 +2059,7 @@ if (!bAfterLine) /* if before the address */ { LineChange chg; changes.push_back(chg); - chg.oper = MnemoCase("SETDP"); + chg.oper = MnemoCase(mnemo[_setdp].mne); if (dp != NO_ADDRESS) chg.opnds = sformat("$%02X", dp >> 8); changes.push_back(chg); diff --git a/Dasm6809.h b/Dasm6809.h index b303b65..30f9599 100644 --- a/Dasm6809.h +++ b/Dasm6809.h @@ -109,7 +109,37 @@ class MemAttribute6809Handler : public MemAttributeHandler /*****************************************************************************/ -/* OS8 file structures */ +/* REL file structures */ +/*****************************************************************************/ +// This is based on an incomplete analysis done by William Gee Jr., +// posted on the Flex Usergroup mailing list, 2003-09-24 + +#pragma pack(1) + +struct RelCapsuleHeader + { + uint8_t signature; /* Capsule signature - must be 3 */ + uint8_t flags1; /* Flags 1; can be one of: */ + /* 0x10 - relative code capsule */ + /* 0x12 - absolute code capsule */ + /* 0x18 - common capsule */ + uint8_t datalen[2]; /* Length of data */ + uint8_t unknown1[4]; /* unknown */ + uint8_t extsize[2]; /* Size of external table */ + uint8_t progstart[2]; /* Program start address */ + uint8_t unknown2[2]; /* unknown */ + uint8_t glbsize[2]; /* Size of global table */ + uint8_t unknown3[2]; /* unknown */ + uint8_t namelen[2]; /* Length of module name */ + uint8_t flags2; /* Flags 2; can be one of: */ + /* 0x80 - start address is given */ + uint8_t unknown4[3]; /* unknown */ + }; +#pragma pack() + + +/*****************************************************************************/ +/* OS9 file structures */ /*****************************************************************************/ #pragma pack(1) @@ -192,6 +222,8 @@ class Dasm6809 : public Dasm6800 virtual bool ProcessInfo(string key, string value, adr_t &from, adr_t &to, adr_t &step, vector> &remaps, bool bProcInfo = true, int bus = BusCode, int tgtbus = BusCode); + bool LoadRel(FILE *f, string &sLoadType); + bool LoadRelCapsule(FILE *f, bool &isCommon); bool LoadOS9(FILE *f, string &sLoadType); bool SetupOS9(adr_t loadAddr, uint16_t modsize, OS9ModuleHeader &h); bool SetupOS9(adr_t loadAddr, OS9UserModuleHeader &h); @@ -278,6 +310,8 @@ class Dasm6809 : public Dasm6800 _swi3, _sync, _tfr, + _setdp, + _os9, // Convenience mnemonics _clf, _clif, @@ -286,6 +320,12 @@ class Dasm6809 : public Dasm6800 _dey, _inu, _iny, + _pshd, + _pshx, + _pshy, + _puld, + _pulx, + _puly, _sef, _seif, _sez, @@ -293,14 +333,14 @@ class Dasm6809 : public Dasm6800 mnemo6809_count }; - static uint8_t m6809_codes[512]; - static uint8_t m6809_codes10[512]; - static uint8_t m6809_codes11[512]; + static CMatrixEntry m6809_codes[256]; + static CMatrixEntry m6809_codes10[256]; + static CMatrixEntry m6809_codes11[256]; static OpCode opcodes[mnemo6809_count - mnemo6800_count]; static const char *os9_codes[0x100]; - uint8_t *codes10; - uint8_t *codes11; + CMatrixEntry *codes10; + CMatrixEntry *codes11; const char **exg_tfr; static const char reg[]; @@ -313,9 +353,9 @@ class Dasm6809 : public Dasm6800 // must not be called from constructor! virtual MemAttributeHandler *CreateAttributeHandler() { return new MemAttribute6809Handler; } - virtual adr_t FetchInstructionDetails(adr_t PC, uint8_t &instpg, uint8_t &instb, uint8_t &mode, int &MI, const char *&I, string *smnemo = NULL); + virtual adr_t FetchInstructionDetails(adr_t PC, uint8_t &instpg, uint8_t &instb, uint8_t &mode, int &mnemoIndex); virtual bool SetConvenience(uint8_t instpg, uint16_t u2, string &smnemo, adr_t &PC); - virtual adr_t IndexParse(int MI, adr_t pc, adr_t instaddr = NO_ADDRESS); + virtual adr_t IndexParse(int mnemoIndex, adr_t pc, adr_t instaddr = NO_ADDRESS); virtual string IndexString(string &smnemo, adr_t &pc); void AddFlexLabels(); diff --git a/Dasm68HC11.cpp b/Dasm68HC11.cpp index 0ad7ecb..91217e6 100644 --- a/Dasm68HC11.cpp +++ b/Dasm68HC11.cpp @@ -51,288 +51,288 @@ static bool bRegistered[] = /* m68hc11_codes : table of all 68HC11 instruction bytes and types */ /*****************************************************************************/ -uint8_t Dasm68HC11::m68hc11_codes[512] = +CMatrixEntry Dasm68HC11::m68hc11_codes[256] = { - _test ,_imp, _nop ,_imp, _idiv ,_imp, _fdiv ,_imp, /* 00..03 */ - _lsrd ,_imp, _asld ,_imp, _tap ,_imp, _tpa ,_imp, /* 04..07 */ - _inx ,_imp, _dex ,_imp, _clv ,_imp, _sev ,_imp, /* 08..0B */ - _clc ,_imp, _sec ,_imp, _cli ,_imp, _sei ,_imp, /* 0C..0F */ - _sba ,_imp, _cba ,_imp, _brset,_bbd, _brclr,_bbd, /* 10..13 */ - _bset ,_bd, _bclr ,_bd, _tab ,_imp, _tba ,_imp, /* 14..17 */ - _ill ,_nom, _daa ,_imp, _ill ,_nom, _aba ,_imp, /* 18..1B */ - _bset ,_bi, _bclr ,_bi, _brset,_bbi, _brclr,_bbi, /* 1C..1F */ - _bra ,_reb, _brn ,_reb, _bhi ,_reb, _bls ,_reb, /* 20..23 */ - _bcc ,_reb, _bcs ,_reb, _bne ,_reb, _beq ,_reb, /* 24..27 */ - _bvc ,_reb, _bvs ,_reb, _bpl ,_reb, _bmi ,_reb, /* 28..2B */ - _bge ,_reb, _blt ,_reb, _bgt ,_reb, _ble ,_reb, /* 2C..2F */ - _tsx ,_imp, _ins ,_imp, _pula ,_imp, _pulb ,_imp, /* 30..33 */ - _des ,_imp, _txs ,_imp, _psha ,_imp, _pshb ,_imp, /* 34..37 */ - _pulx ,_imp, _rts ,_imp, _abx ,_imp, _rti ,_imp, /* 38..3B */ - _pshx ,_imp, _mul ,_imp, _wai ,_imp, _swi ,_imp, /* 3C..3F */ - _nega ,_imp, _ill ,_nom, _ill ,_nom, _coma ,_imp, /* 40..43 */ - _lsra ,_imp, _ill ,_nom, _rora ,_imp, _asra ,_imp, /* 44..47 */ - _asla ,_imp, _rola ,_imp, _deca ,_imp, _ill ,_nom, /* 48..4B */ - _inca ,_imp, _tsta ,_imp, _ill ,_nom, _clra ,_imp, /* 4C..4F */ - _negb ,_imp, _ill ,_nom, _ill ,_nom, _comb ,_imp, /* 50..53 */ - _lsrb ,_imp, _ill ,_nom, _rorb ,_imp, _asrb ,_imp, /* 54..57 */ - _aslb ,_imp, _rolb ,_imp, _decb ,_imp, _ill ,_nom, /* 58..5B */ - _incb ,_imp, _tstb ,_imp, _ill ,_nom, _clrb ,_imp, /* 5C..5F */ - _neg ,_ix8, _ill ,_nom, _ill ,_nom, _com ,_ix8, /* 60..63 */ - _lsr ,_ix8, _ill ,_nom, _ror ,_ix8, _asr ,_ix8, /* 64..67 */ - _asl ,_ix8, _rol ,_ix8, _dec ,_ix8, _ill ,_nom, /* 68..6B */ - _inc ,_ix8, _tst ,_ix8, _jmp ,_ix8, _clr ,_ix8, /* 6C..6F */ - _neg ,_ext, _ill ,_nom, _ill ,_nom, _com ,_ext, /* 70..73 */ - _lsr ,_ext, _ill ,_nom, _ror ,_ext, _asr ,_ext, /* 74..77 */ - _asl ,_ext, _rol ,_ext, _dec ,_ext, _ill ,_nom, /* 78..7B */ - _inc ,_ext, _tst ,_ext, _jmp ,_ext, _clr ,_ext, /* 7C..7F */ - _suba ,_imb, _cmpa ,_imb, _sbca ,_imb, _subd ,_imw, /* 80..83 */ - _anda ,_imb, _bita ,_imb, _lda ,_imb, _ill ,_nom, /* 84..87 */ - _eora ,_imb, _adca ,_imb, _ora ,_imb, _adda ,_imb, /* 88..8B */ - _cpx ,_imw, _bsr ,_reb, _lds ,_imw, _xgdx ,_imp, /* 8C..8F */ - _suba ,_dir, _cmpa ,_dir, _sbca ,_dir, _subd ,_dir, /* 90..93 */ - _anda ,_dir, _bita ,_dir, _lda ,_dir, _sta ,_dir, /* 94..97 */ - _eora ,_dir, _adca ,_dir, _ora ,_dir, _adda ,_dir, /* 98..9B */ - _cpx ,_dir, _jsr ,_dir, _lds ,_dir, _sts ,_dir, /* 9C..9F */ - _suba ,_ix8, _cmpa ,_ix8, _sbca ,_ix8, _subd ,_ix8, /* A0..A3 */ - _anda ,_ix8, _bita ,_ix8, _lda ,_ix8, _sta ,_ix8, /* A4..A7 */ - _eora ,_ix8, _adca ,_ix8, _ora ,_ix8, _adda ,_ix8, /* A8..AB */ - _cpx ,_ix8, _jsr ,_ix8, _lds ,_ix8, _sts ,_ix8, /* AC..AF */ - _suba ,_ext, _cmpa ,_ext, _sbca ,_ext, _subd ,_ext, /* B0..B3 */ - _anda ,_ext, _bita ,_ext, _lda ,_ext, _sta ,_ext, /* B4..B7 */ - _eora ,_ext, _adca ,_ext, _ora ,_ext, _adda ,_ext, /* B8..BB */ - _cpx ,_ext, _jsr ,_ext, _lds ,_ext, _sts ,_ext, /* BC..BF */ - _subb ,_imb, _cmpb ,_imb, _sbcb ,_imb, _addd ,_imw, /* C0..C3 */ - _andb ,_imb, _bitb ,_imb, _ldb ,_imb, _ill ,_nom, /* C4..C7 */ - _eorb ,_imb, _adcb ,_imb, _orb ,_imb, _addb ,_imb, /* C8..CB */ - _ldd ,_imw, _ill ,_nom, _ldx ,_imw, _stop ,_imp, /* CC..CF */ - _subb ,_dir, _cmpb ,_dir, _sbcb ,_dir, _addd ,_dir, /* D0..D3 */ - _andb ,_dir, _bitb ,_dir, _ldb ,_dir, _stb ,_dir, /* D4..D7 */ - _eorb ,_dir, _adcb ,_dir, _orb ,_dir, _addb ,_dir, /* D8..DB */ - _ldd ,_dir, _std ,_dir, _ldx ,_dir, _stx ,_dir, /* DC..DF */ - _subb ,_ix8, _cmpb ,_ix8, _sbcb ,_ix8, _addd ,_ix8, /* E0..E3 */ - _andb ,_ix8, _bitb ,_ix8, _ldb ,_ix8, _stb ,_ix8, /* E4..E7 */ - _eorb ,_ix8, _adcb ,_ix8, _orb ,_ix8, _addb ,_ix8, /* E8..EB */ - _ldd ,_ix8, _std ,_ix8, _ldx ,_ix8, _stx ,_ix8, /* EC..EF */ - _subb ,_ext, _cmpb ,_ext, _sbcb ,_ext, _addd ,_ext, /* F0..F3 */ - _andb ,_ext, _bitb ,_ext, _ldb ,_ext, _stb ,_ext, /* F4..F7 */ - _eorb ,_ext, _adcb ,_ext, _orb ,_ext, _addb ,_ext, /* F8..FB */ - _ldd ,_ext, _std ,_ext, _ldx ,_ext, _stx ,_ext, /* FC..FF */ + {_test ,_imp}, {_nop ,_imp}, {_idiv ,_imp}, {_fdiv ,_imp}, /* 00..03 */ + {_lsrd ,_imp}, {_asld ,_imp}, {_tap ,_imp}, {_tpa ,_imp}, /* 04..07 */ + {_inx ,_imp}, {_dex ,_imp}, {_clv ,_imp}, {_sev ,_imp}, /* 08..0B */ + {_clc ,_imp}, {_sec ,_imp}, {_cli ,_imp}, {_sei ,_imp}, /* 0C..0F */ + {_sba ,_imp}, {_cba ,_imp}, {_brset,_bbd}, {_brclr,_bbd}, /* 10..13 */ + {_bset ,_bd }, {_bclr ,_bd }, {_tab ,_imp}, {_tba ,_imp}, /* 14..17 */ + {_ill ,_nom}, {_daa ,_imp}, {_ill ,_nom}, {_aba ,_imp}, /* 18..1B */ + {_bset ,_bi }, {_bclr ,_bi }, {_brset,_bbi}, {_brclr,_bbi}, /* 1C..1F */ + {_bra ,_reb}, {_brn ,_reb}, {_bhi ,_reb}, {_bls ,_reb}, /* 20..23 */ + {_bcc ,_reb}, {_bcs ,_reb}, {_bne ,_reb}, {_beq ,_reb}, /* 24..27 */ + {_bvc ,_reb}, {_bvs ,_reb}, {_bpl ,_reb}, {_bmi ,_reb}, /* 28..2B */ + {_bge ,_reb}, {_blt ,_reb}, {_bgt ,_reb}, {_ble ,_reb}, /* 2C..2F */ + {_tsx ,_imp}, {_ins ,_imp}, {_pula ,_imp}, {_pulb ,_imp}, /* 30..33 */ + {_des ,_imp}, {_txs ,_imp}, {_psha ,_imp}, {_pshb ,_imp}, /* 34..37 */ + {_pulx ,_imp}, {_rts ,_imp}, {_abx ,_imp}, {_rti ,_imp}, /* 38..3B */ + {_pshx ,_imp}, {_mul ,_imp}, {_wai ,_imp}, {_swi ,_imp}, /* 3C..3F */ + {_nega ,_imp}, {_ill ,_nom}, {_ill ,_nom}, {_coma ,_imp}, /* 40..43 */ + {_lsra ,_imp}, {_ill ,_nom}, {_rora ,_imp}, {_asra ,_imp}, /* 44..47 */ + {_asla ,_imp}, {_rola ,_imp}, {_deca ,_imp}, {_ill ,_nom}, /* 48..4B */ + {_inca ,_imp}, {_tsta ,_imp}, {_ill ,_nom}, {_clra ,_imp}, /* 4C..4F */ + {_negb ,_imp}, {_ill ,_nom}, {_ill ,_nom}, {_comb ,_imp}, /* 50..53 */ + {_lsrb ,_imp}, {_ill ,_nom}, {_rorb ,_imp}, {_asrb ,_imp}, /* 54..57 */ + {_aslb ,_imp}, {_rolb ,_imp}, {_decb ,_imp}, {_ill ,_nom}, /* 58..5B */ + {_incb ,_imp}, {_tstb ,_imp}, {_ill ,_nom}, {_clrb ,_imp}, /* 5C..5F */ + {_neg ,_ix8}, {_ill ,_nom}, {_ill ,_nom}, {_com ,_ix8}, /* 60..63 */ + {_lsr ,_ix8}, {_ill ,_nom}, {_ror ,_ix8}, {_asr ,_ix8}, /* 64..67 */ + {_asl ,_ix8}, {_rol ,_ix8}, {_dec ,_ix8}, {_ill ,_nom}, /* 68..6B */ + {_inc ,_ix8}, {_tst ,_ix8}, {_jmp ,_ix8}, {_clr ,_ix8}, /* 6C..6F */ + {_neg ,_ext}, {_ill ,_nom}, {_ill ,_nom}, {_com ,_ext}, /* 70..73 */ + {_lsr ,_ext}, {_ill ,_nom}, {_ror ,_ext}, {_asr ,_ext}, /* 74..77 */ + {_asl ,_ext}, {_rol ,_ext}, {_dec ,_ext}, {_ill ,_nom}, /* 78..7B */ + {_inc ,_ext}, {_tst ,_ext}, {_jmp ,_ext}, {_clr ,_ext}, /* 7C..7F */ + {_suba ,_imb}, {_cmpa ,_imb}, {_sbca ,_imb}, {_subd ,_imw}, /* 80..83 */ + {_anda ,_imb}, {_bita ,_imb}, {_lda ,_imb}, {_ill ,_nom}, /* 84..87 */ + {_eora ,_imb}, {_adca ,_imb}, {_ora ,_imb}, {_adda ,_imb}, /* 88..8B */ + {_cpx ,_imw}, {_bsr ,_reb}, {_lds ,_imw}, {_xgdx ,_imp}, /* 8C..8F */ + {_suba ,_dir}, {_cmpa ,_dir}, {_sbca ,_dir}, {_subd ,_dir}, /* 90..93 */ + {_anda ,_dir}, {_bita ,_dir}, {_lda ,_dir}, {_sta ,_dir}, /* 94..97 */ + {_eora ,_dir}, {_adca ,_dir}, {_ora ,_dir}, {_adda ,_dir}, /* 98..9B */ + {_cpx ,_dir}, {_jsr ,_dir}, {_lds ,_dir}, {_sts ,_dir}, /* 9C..9F */ + {_suba ,_ix8}, {_cmpa ,_ix8}, {_sbca ,_ix8}, {_subd ,_ix8}, /* A0..A3 */ + {_anda ,_ix8}, {_bita ,_ix8}, {_lda ,_ix8}, {_sta ,_ix8}, /* A4..A7 */ + {_eora ,_ix8}, {_adca ,_ix8}, {_ora ,_ix8}, {_adda ,_ix8}, /* A8..AB */ + {_cpx ,_ix8}, {_jsr ,_ix8}, {_lds ,_ix8}, {_sts ,_ix8}, /* AC..AF */ + {_suba ,_ext}, {_cmpa ,_ext}, {_sbca ,_ext}, {_subd ,_ext}, /* B0..B3 */ + {_anda ,_ext}, {_bita ,_ext}, {_lda ,_ext}, {_sta ,_ext}, /* B4..B7 */ + {_eora ,_ext}, {_adca ,_ext}, {_ora ,_ext}, {_adda ,_ext}, /* B8..BB */ + {_cpx ,_ext}, {_jsr ,_ext}, {_lds ,_ext}, {_sts ,_ext}, /* BC..BF */ + {_subb ,_imb}, {_cmpb ,_imb}, {_sbcb ,_imb}, {_addd ,_imw}, /* C0..C3 */ + {_andb ,_imb}, {_bitb ,_imb}, {_ldb ,_imb}, {_ill ,_nom}, /* C4..C7 */ + {_eorb ,_imb}, {_adcb ,_imb}, {_orb ,_imb}, {_addb ,_imb}, /* C8..CB */ + {_ldd ,_imw}, {_ill ,_nom}, {_ldx ,_imw}, {_stop ,_imp}, /* CC..CF */ + {_subb ,_dir}, {_cmpb ,_dir}, {_sbcb ,_dir}, {_addd ,_dir}, /* D0..D3 */ + {_andb ,_dir}, {_bitb ,_dir}, {_ldb ,_dir}, {_stb ,_dir}, /* D4..D7 */ + {_eorb ,_dir}, {_adcb ,_dir}, {_orb ,_dir}, {_addb ,_dir}, /* D8..DB */ + {_ldd ,_dir}, {_std ,_dir}, {_ldx ,_dir}, {_stx ,_dir}, /* DC..DF */ + {_subb ,_ix8}, {_cmpb ,_ix8}, {_sbcb ,_ix8}, {_addd ,_ix8}, /* E0..E3 */ + {_andb ,_ix8}, {_bitb ,_ix8}, {_ldb ,_ix8}, {_stb ,_ix8}, /* E4..E7 */ + {_eorb ,_ix8}, {_adcb ,_ix8}, {_orb ,_ix8}, {_addb ,_ix8}, /* E8..EB */ + {_ldd ,_ix8}, {_std ,_ix8}, {_ldx ,_ix8}, {_stx ,_ix8}, /* EC..EF */ + {_subb ,_ext}, {_cmpb ,_ext}, {_sbcb ,_ext}, {_addd ,_ext}, /* F0..F3 */ + {_andb ,_ext}, {_bitb ,_ext}, {_ldb ,_ext}, {_stb ,_ext}, /* F4..F7 */ + {_eorb ,_ext}, {_adcb ,_ext}, {_orb ,_ext}, {_addb ,_ext}, /* F8..FB */ + {_ldd ,_ext}, {_std ,_ext}, {_ldx ,_ext}, {_stx ,_ext}, /* FC..FF */ }; /*****************************************************************************/ /* m68hc11_codes18 : $18 extended instruction 2nd byte */ /*****************************************************************************/ -uint8_t Dasm68HC11::m68hc11_codes18[512] = +CMatrixEntry Dasm68HC11::m68hc11_codes18[256] = { - _ill ,_nom, _ill ,_nom, _ill ,_nom, _ill ,_nom, /* 00..03 */ - _ill ,_nom, _ill ,_nom, _ill ,_nom, _ill ,_nom, /* 04..07 */ - _iny ,_imp, _dey ,_imp, _ill ,_nom, _ill ,_nom, /* 08..0B */ - _ill ,_nom, _ill ,_nom, _ill ,_nom, _ill ,_nom, /* 0C..0F */ - _ill ,_nom, _ill ,_nom, _ill ,_nom, _ill ,_nom, /* 10..13 */ - _ill ,_nom, _ill ,_nom, _ill ,_nom, _ill ,_nom, /* 14..17 */ - _ill ,_nom, _ill ,_nom, _ill ,_nom, _ill ,_nom, /* 18..1B */ - _bset ,_bi, _bclr ,_bi, _brset,_bbi, _brclr,_bbi, /* 1C..1F */ - _ill ,_nom, _ill ,_nom, _ill ,_nom, _ill ,_nom, /* 20..23 */ - _ill ,_nom, _ill ,_nom, _ill ,_nom, _ill ,_nom, /* 24..27 */ - _ill ,_nom, _ill ,_nom, _ill ,_nom, _ill ,_nom, /* 28..2B */ - _ill ,_nom, _ill ,_nom, _ill ,_nom, _ill ,_nom, /* 2C..2F */ - _tsy ,_imp, _ill ,_nom, _ill ,_nom, _ill ,_nom, /* 30..33 */ - _ill ,_nom, _tys ,_imp, _ill ,_nom, _ill ,_nom, /* 34..37 */ - _puly ,_imp, _ill ,_nom, _aby ,_imp, _ill ,_nom, /* 38..3B */ - _pshy ,_imp, _ill ,_nom, _ill ,_nom, _ill ,_nom, /* 3C..3F */ - _ill ,_nom, _ill ,_nom, _ill ,_nom, _ill ,_nom, /* 40..43 */ - _ill ,_nom, _ill ,_nom, _ill ,_nom, _ill ,_nom, /* 44..47 */ - _ill ,_nom, _ill ,_nom, _ill ,_nom, _ill ,_nom, /* 48..4B */ - _ill ,_nom, _ill ,_nom, _ill ,_nom, _ill ,_nom, /* 4C..4F */ - _ill ,_nom, _ill ,_nom, _ill ,_nom, _ill ,_nom, /* 50..53 */ - _ill ,_nom, _ill ,_nom, _ill ,_nom, _ill ,_nom, /* 54..57 */ - _ill ,_nom, _ill ,_nom, _ill ,_nom, _ill ,_nom, /* 58..5B */ - _ill ,_nom, _ill ,_nom, _ill ,_nom, _ill ,_nom, /* 5C..5F */ - _neg ,_ix8, _ill ,_nom, _ill ,_nom, _com ,_ix8, /* 60..63 */ - _lsr ,_ix8, _ill ,_nom, _ror ,_ix8, _asr ,_ix8, /* 64..67 */ - _asl ,_ix8, _rol ,_ix8, _dec ,_ix8, _ill ,_nom, /* 68..6B */ - _inc ,_ix8, _tst ,_ix8, _jmp ,_ix8, _clr ,_ix8, /* 6C..6F */ - _ill ,_nom, _ill ,_nom, _ill ,_nom, _ill ,_nom, /* 70..73 */ - _ill ,_nom, _ill ,_nom, _ill ,_nom, _ill ,_nom, /* 74..77 */ - _ill ,_nom, _ill ,_nom, _ill ,_nom, _ill ,_nom, /* 78..7B */ - _ill ,_nom, _ill ,_nom, _ill ,_nom, _ill ,_nom, /* 7C..7F */ - _ill ,_nom, _ill ,_nom, _ill ,_nom, _ill ,_nom, /* 80..83 */ - _ill ,_nom, _ill ,_nom, _ill ,_nom, _ill ,_nom, /* 84..87 */ - _ill ,_nom, _ill ,_nom, _ill ,_nom, _ill ,_nom, /* 88..8B */ - _cpy ,_imw, _ill ,_nom, _ill ,_nom, _xgdy ,_imp, /* 8C..8F */ - _ill ,_nom, _ill ,_nom, _ill ,_nom, _ill ,_nom, /* 90..93 */ - _ill ,_nom, _ill ,_nom, _ill ,_nom, _ill ,_nom, /* 94..97 */ - _ill ,_nom, _ill ,_nom, _ill ,_nom, _ill ,_nom, /* 98..9B */ - _cpy ,_dir, _ill ,_nom, _ill ,_nom, _ill ,_nom, /* 9C..9F */ - _suba ,_ix8, _cmpa ,_ix8, _sbca ,_ix8, _subd ,_ix8, /* A0..A3 */ - _anda ,_ix8, _bita ,_ix8, _lda ,_ix8, _sta ,_ix8, /* A4..A7 */ - _eora ,_ix8, _adca ,_ix8, _ora ,_ix8, _adda ,_ix8, /* A8..AB */ - _cpy ,_ix8, _jsr ,_ix8, _lds ,_ix8, _sts ,_ix8, /* AC..AF */ - _ill ,_nom, _ill ,_nom, _ill ,_nom, _ill ,_nom, /* B0..B3 */ - _ill ,_nom, _ill ,_nom, _ill ,_nom, _ill ,_nom, /* B4..B7 */ - _ill ,_nom, _ill ,_nom, _ill ,_nom, _ill ,_nom, /* B8..BB */ - _cpy ,_ext, _ill ,_nom, _ill ,_nom, _ill ,_nom, /* BC..BF */ - _ill ,_nom, _ill ,_nom, _ill ,_nom, _ill ,_nom, /* C0..C3 */ - _ill ,_nom, _ill ,_nom, _ill ,_nom, _ill ,_nom, /* C4..C7 */ - _ill ,_nom, _ill ,_nom, _ill ,_nom, _ill ,_nom, /* C8..CB */ - _ill ,_nom, _ill ,_nom, _ldy ,_imw, _ill ,_nom, /* CC..CF */ - _ill ,_nom, _ill ,_nom, _ill ,_nom, _ill ,_nom, /* D0..D3 */ - _ill ,_nom, _ill ,_nom, _ill ,_nom, _ill ,_nom, /* D4..D7 */ - _ill ,_nom, _ill ,_nom, _ill ,_nom, _ill ,_nom, /* D8..DB */ - _ill ,_nom, _ill ,_nom, _ldy ,_dir, _sty ,_dir, /* DC..DF */ - _subb ,_ix8, _cmpb ,_ix8, _sbcb ,_ix8, _addd ,_ix8, /* E0..E3 */ - _andb ,_ix8, _bitb ,_ix8, _ldb ,_ix8, _stb ,_ix8, /* E4..E7 */ - _eorb ,_ix8, _adcb ,_ix8, _orb ,_ix8, _addb ,_ix8, /* E8..EB */ - _ldd ,_ix8, _std ,_ix8, _ldy ,_ix8, _sty ,_ix8, /* EC..EF */ - _ill ,_nom, _ill ,_nom, _ill ,_nom, _ill ,_nom, /* F0..F3 */ - _ill ,_nom, _ill ,_nom, _ill ,_nom, _ill ,_nom, /* F4..F7 */ - _ill ,_nom, _ill ,_nom, _ill ,_nom, _ill ,_nom, /* F8..FB */ - _ill ,_nom, _ill ,_nom, _ldy ,_ext, _sty ,_ext, /* FC..FF */ + {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, /* 00..03 */ + {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, /* 04..07 */ + {_iny ,_imp}, {_dey ,_imp}, {_ill ,_nom}, {_ill ,_nom}, /* 08..0B */ + {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, /* 0C..0F */ + {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, /* 10..13 */ + {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, /* 14..17 */ + {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, /* 18..1B */ + {_bset ,_bi }, {_bclr ,_bi }, {_brset,_bbi}, {_brclr,_bbi}, /* 1C..1F */ + {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, /* 20..23 */ + {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, /* 24..27 */ + {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, /* 28..2B */ + {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, /* 2C..2F */ + {_tsy ,_imp}, {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, /* 30..33 */ + {_ill ,_nom}, {_tys ,_imp}, {_ill ,_nom}, {_ill ,_nom}, /* 34..37 */ + {_puly ,_imp}, {_ill ,_nom}, {_aby ,_imp}, {_ill ,_nom}, /* 38..3B */ + {_pshy ,_imp}, {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, /* 3C..3F */ + {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, /* 40..43 */ + {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, /* 44..47 */ + {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, /* 48..4B */ + {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, /* 4C..4F */ + {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, /* 50..53 */ + {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, /* 54..57 */ + {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, /* 58..5B */ + {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, /* 5C..5F */ + {_neg ,_ix8}, {_ill ,_nom}, {_ill ,_nom}, {_com ,_ix8}, /* 60..63 */ + {_lsr ,_ix8}, {_ill ,_nom}, {_ror ,_ix8}, {_asr ,_ix8}, /* 64..67 */ + {_asl ,_ix8}, {_rol ,_ix8}, {_dec ,_ix8}, {_ill ,_nom}, /* 68..6B */ + {_inc ,_ix8}, {_tst ,_ix8}, {_jmp ,_ix8}, {_clr ,_ix8}, /* 6C..6F */ + {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, /* 70..73 */ + {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, /* 74..77 */ + {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, /* 78..7B */ + {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, /* 7C..7F */ + {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, /* 80..83 */ + {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, /* 84..87 */ + {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, /* 88..8B */ + {_cpy ,_imw}, {_ill ,_nom}, {_ill ,_nom}, {_xgdy ,_imp}, /* 8C..8F */ + {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, /* 90..93 */ + {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, /* 94..97 */ + {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, /* 98..9B */ + {_cpy ,_dir}, {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, /* 9C..9F */ + {_suba ,_ix8}, {_cmpa ,_ix8}, {_sbca ,_ix8}, {_subd ,_ix8}, /* A0..A3 */ + {_anda ,_ix8}, {_bita ,_ix8}, {_lda ,_ix8}, {_sta ,_ix8}, /* A4..A7 */ + {_eora ,_ix8}, {_adca ,_ix8}, {_ora ,_ix8}, {_adda ,_ix8}, /* A8..AB */ + {_cpy ,_ix8}, {_jsr ,_ix8}, {_lds ,_ix8}, {_sts ,_ix8}, /* AC..AF */ + {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, /* B0..B3 */ + {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, /* B4..B7 */ + {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, /* B8..BB */ + {_cpy ,_ext}, {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, /* BC..BF */ + {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, /* C0..C3 */ + {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, /* C4..C7 */ + {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, /* C8..CB */ + {_ill ,_nom}, {_ill ,_nom}, {_ldy ,_imw}, {_ill ,_nom}, /* CC..CF */ + {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, /* D0..D3 */ + {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, /* D4..D7 */ + {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, /* D8..DB */ + {_ill ,_nom}, {_ill ,_nom}, {_ldy ,_dir}, {_sty ,_dir}, /* DC..DF */ + {_subb ,_ix8}, {_cmpb ,_ix8}, {_sbcb ,_ix8}, {_addd ,_ix8}, /* E0..E3 */ + {_andb ,_ix8}, {_bitb ,_ix8}, {_ldb ,_ix8}, {_stb ,_ix8}, /* E4..E7 */ + {_eorb ,_ix8}, {_adcb ,_ix8}, {_orb ,_ix8}, {_addb ,_ix8}, /* E8..EB */ + {_ldd ,_ix8}, {_std ,_ix8}, {_ldy ,_ix8}, {_sty ,_ix8}, /* EC..EF */ + {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, /* F0..F3 */ + {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, /* F4..F7 */ + {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, /* F8..FB */ + {_ill ,_nom}, {_ill ,_nom}, {_ldy ,_ext}, {_sty ,_ext}, /* FC..FF */ }; /*****************************************************************************/ /* m68hc11_codes1a : $1A extended instruction 2nd byte */ /*****************************************************************************/ -uint8_t Dasm68HC11::m68hc11_codes1a[512] = +CMatrixEntry Dasm68HC11::m68hc11_codes1a[256] = { - _ill ,_nom, _nop ,_imp, _ill ,_nom, _ill ,_nom, /* 00..03 */ - _ill ,_nom, _ill ,_nom, _ill ,_nom, _ill ,_nom, /* 04..07 */ - _iny ,_imp, _ill ,_nom, _ill ,_nom, _ill ,_nom, /* 08..0B */ - _ill ,_nom, _ill ,_nom, _ill ,_nom, _ill ,_nom, /* 0C..0F */ - _ill ,_nom, _ill ,_nom, _ill ,_nom, _ill ,_nom, /* 10..13 */ - _ill ,_nom, _ill ,_nom, _ill ,_nom, _ill ,_nom, /* 14..17 */ - _ill ,_nom, _ill ,_nom, _ill ,_nom, _ill ,_nom, /* 18..1B */ - _ill ,_nom, _ill ,_nom, _ill ,_nom, _ill ,_nom, /* 1C..1F */ - _ill ,_nom, _ill ,_nom, _ill ,_nom, _ill ,_nom, /* 20..23 */ - _ill ,_nom, _ill ,_nom, _ill ,_nom, _ill ,_nom, /* 24..27 */ - _ill ,_nom, _ill ,_nom, _ill ,_nom, _ill ,_nom, /* 28..2B */ - _ill ,_nom, _ill ,_nom, _ill ,_nom, _ill ,_nom, /* 2C..2F */ - _ill ,_nom, _ill ,_nom, _ill ,_nom, _ill ,_nom, /* 30..33 */ - _ill ,_nom, _ill ,_nom, _ill ,_nom, _ill ,_nom, /* 34..37 */ - _ill ,_nom, _ill ,_nom, _ill ,_nom, _ill ,_nom, /* 38..3B */ - _ill ,_nom, _ill ,_nom, _ill ,_nom, _ill ,_nom, /* 3C..3F */ - _ill ,_nom, _ill ,_nom, _ill ,_nom, _ill ,_nom, /* 40..43 */ - _ill ,_nom, _ill ,_nom, _ill ,_nom, _ill ,_nom, /* 44..47 */ - _ill ,_nom, _ill ,_nom, _ill ,_nom, _ill ,_nom, /* 48..4B */ - _ill ,_nom, _ill ,_nom, _ill ,_nom, _ill ,_nom, /* 4C..4F */ - _ill ,_nom, _ill ,_nom, _ill ,_nom, _ill ,_nom, /* 50..53 */ - _ill ,_nom, _ill ,_nom, _ill ,_nom, _ill ,_nom, /* 54..57 */ - _ill ,_nom, _ill ,_nom, _ill ,_nom, _ill ,_nom, /* 58..5B */ - _ill ,_nom, _ill ,_nom, _ill ,_nom, _ill ,_nom, /* 5C..5F */ - _ill ,_nom, _ill ,_nom, _ill ,_nom, _ill ,_nom, /* 60..63 */ - _ill ,_nom, _ill ,_nom, _ill ,_nom, _ill ,_nom, /* 64..67 */ - _ill ,_nom, _ill ,_nom, _ill ,_nom, _ill ,_nom, /* 68..6B */ - _ill ,_nom, _ill ,_nom, _ill ,_nom, _ill ,_nom, /* 6C..6F */ - _ill ,_nom, _ill ,_nom, _ill ,_nom, _ill ,_nom, /* 70..73 */ - _ill ,_nom, _ill ,_nom, _ill ,_nom, _ill ,_nom, /* 74..77 */ - _ill ,_nom, _ill ,_nom, _ill ,_nom, _ill ,_nom, /* 78..7B */ - _ill ,_nom, _ill ,_nom, _ill ,_nom, _ill ,_nom, /* 7C..7F */ - _ill ,_nom, _ill ,_nom, _ill ,_nom, _cpd ,_imw, /* 80..83 */ - _ill ,_nom, _ill ,_nom, _ill ,_nom, _ill ,_nom, /* 84..87 */ - _ill ,_nom, _ill ,_nom, _ill ,_nom, _ill ,_nom, /* 88..8B */ - _ill ,_nom, _ill ,_nom, _ill ,_nom, _ill ,_nom, /* 8C..8F */ - _ill ,_nom, _ill ,_nom, _ill ,_nom, _cpd ,_dir, /* 90..93 */ - _ill ,_nom, _ill ,_nom, _ill ,_nom, _ill ,_nom, /* 94..97 */ - _ill ,_nom, _ill ,_nom, _ill ,_nom, _ill ,_nom, /* 98..9B */ - _ill ,_nom, _ill ,_nom, _ill ,_nom, _ill ,_nom, /* 9C..9F */ - _ill ,_nom, _ill ,_nom, _ill ,_nom, _cpd ,_ix8, /* A0..A3 */ - _ill ,_nom, _ill ,_nom, _ill ,_nom, _ill ,_nom, /* A4..A7 */ - _ill ,_nom, _ill ,_nom, _ill ,_nom, _ill ,_nom, /* A8..AB */ - _cpy ,_ix8, _ill ,_nom, _ill ,_nom, _ill ,_nom, /* AC..AF */ - _ill ,_nom, _ill ,_nom, _ill ,_nom, _cpd ,_ext, /* B0..B3 */ - _ill ,_nom, _ill ,_nom, _ill ,_nom, _ill ,_nom, /* B4..B7 */ - _ill ,_nom, _ill ,_nom, _ill ,_nom, _ill ,_nom, /* B8..BB */ - _ill ,_nom, _ill ,_nom, _ill ,_nom, _ill ,_nom, /* BC..BF */ - _ill ,_nom, _ill ,_nom, _ill ,_nom, _ill ,_nom, /* C0..C3 */ - _ill ,_nom, _ill ,_nom, _ill ,_nom, _ill ,_nom, /* C4..C7 */ - _ill ,_nom, _ill ,_nom, _ill ,_nom, _ill ,_nom, /* C8..CB */ - _ill ,_nom, _ill ,_nom, _ill ,_nom, _ill ,_nom, /* CC..CF */ - _ill ,_nom, _ill ,_nom, _ill ,_nom, _ill ,_nom, /* D0..D3 */ - _ill ,_nom, _ill ,_nom, _ill ,_nom, _ill ,_nom, /* D4..D7 */ - _ill ,_nom, _ill ,_nom, _ill ,_nom, _ill ,_nom, /* D8..DB */ - _ill ,_nom, _ill ,_nom, _ill ,_nom, _ill ,_nom, /* DC..DF */ - _ill ,_nom, _ill ,_nom, _ill ,_nom, _ill ,_nom, /* E0..E3 */ - _ill ,_nom, _ill ,_nom, _ill ,_nom, _ill ,_nom, /* E4..E7 */ - _ill ,_nom, _ill ,_nom, _ill ,_nom, _ill ,_nom, /* E8..EB */ - _ill ,_nom, _ill ,_nom, _ldy ,_ix8, _sty ,_ix8, /* EC..EF */ - _ill ,_nom, _ill ,_nom, _ill ,_nom, _ill ,_nom, /* F0..F3 */ - _ill ,_nom, _ill ,_nom, _ill ,_nom, _ill ,_nom, /* F4..F7 */ - _ill ,_nom, _ill ,_nom, _ill ,_nom, _ill ,_nom, /* F8..FB */ - _ill ,_nom, _ill ,_nom, _ill ,_nom, _ill ,_nom, /* FC..FF */ + {_ill ,_nom}, {_nop ,_imp}, {_ill ,_nom}, {_ill ,_nom}, /* 00..03 */ + {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, /* 04..07 */ + {_iny ,_imp}, {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, /* 08..0B */ + {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, /* 0C..0F */ + {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, /* 10..13 */ + {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, /* 14..17 */ + {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, /* 18..1B */ + {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, /* 1C..1F */ + {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, /* 20..23 */ + {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, /* 24..27 */ + {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, /* 28..2B */ + {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, /* 2C..2F */ + {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, /* 30..33 */ + {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, /* 34..37 */ + {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, /* 38..3B */ + {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, /* 3C..3F */ + {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, /* 40..43 */ + {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, /* 44..47 */ + {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, /* 48..4B */ + {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, /* 4C..4F */ + {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, /* 50..53 */ + {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, /* 54..57 */ + {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, /* 58..5B */ + {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, /* 5C..5F */ + {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, /* 60..63 */ + {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, /* 64..67 */ + {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, /* 68..6B */ + {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, /* 6C..6F */ + {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, /* 70..73 */ + {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, /* 74..77 */ + {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, /* 78..7B */ + {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, /* 7C..7F */ + {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, {_cpd ,_imw}, /* 80..83 */ + {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, /* 84..87 */ + {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, /* 88..8B */ + {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, /* 8C..8F */ + {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, {_cpd ,_dir}, /* 90..93 */ + {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, /* 94..97 */ + {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, /* 98..9B */ + {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, /* 9C..9F */ + {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, {_cpd ,_ix8}, /* A0..A3 */ + {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, /* A4..A7 */ + {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, /* A8..AB */ + {_cpy ,_ix8}, {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, /* AC..AF */ + {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, {_cpd ,_ext}, /* B0..B3 */ + {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, /* B4..B7 */ + {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, /* B8..BB */ + {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, /* BC..BF */ + {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, /* C0..C3 */ + {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, /* C4..C7 */ + {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, /* C8..CB */ + {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, /* CC..CF */ + {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, /* D0..D3 */ + {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, /* D4..D7 */ + {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, /* D8..DB */ + {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, /* DC..DF */ + {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, /* E0..E3 */ + {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, /* E4..E7 */ + {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, /* E8..EB */ + {_ill ,_nom}, {_ill ,_nom}, {_ldy ,_ix8}, {_sty ,_ix8}, /* EC..EF */ + {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, /* F0..F3 */ + {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, /* F4..F7 */ + {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, /* F8..FB */ + {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, /* FC..FF */ }; /*****************************************************************************/ /* m68hc11_codescd : $CD extended instruction 2nd byte */ /*****************************************************************************/ -uint8_t Dasm68HC11::m68hc11_codescd[512] = +CMatrixEntry Dasm68HC11::m68hc11_codescd[256] = { - _ill ,_nom, _nop ,_imp, _ill ,_nom, _ill ,_nom, /* 00..03 */ - _ill ,_nom, _ill ,_nom, _ill ,_nom, _ill ,_nom, /* 04..07 */ - _iny ,_imp, _ill ,_nom, _ill ,_nom, _ill ,_nom, /* 08..0B */ - _ill ,_nom, _ill ,_nom, _ill ,_nom, _ill ,_nom, /* 0C..0F */ - _ill ,_nom, _ill ,_nom, _ill ,_nom, _ill ,_nom, /* 10..13 */ - _ill ,_nom, _ill ,_nom, _ill ,_nom, _ill ,_nom, /* 14..17 */ - _ill ,_nom, _ill ,_nom, _ill ,_nom, _ill ,_nom, /* 18..1B */ - _ill ,_nom, _ill ,_nom, _ill ,_nom, _ill ,_nom, /* 1C..1F */ - _ill ,_nom, _nop ,_imp, _ill ,_nom, _ill ,_nom, /* 20..23 */ - _ill ,_nom, _nop ,_imp, _ill ,_nom, _ill ,_nom, /* 24..27 */ - _ill ,_nom, _nop ,_imp, _ill ,_nom, _ill ,_nom, /* 28..2B */ - _ill ,_nom, _nop ,_imp, _ill ,_nom, _ill ,_nom, /* 2C..2F */ - _ill ,_nom, _nop ,_imp, _ill ,_nom, _ill ,_nom, /* 30..33 */ - _ill ,_nom, _nop ,_imp, _ill ,_nom, _ill ,_nom, /* 34..37 */ - _ill ,_nom, _nop ,_imp, _ill ,_nom, _ill ,_nom, /* 38..3B */ - _ill ,_nom, _nop ,_imp, _ill ,_nom, _ill ,_nom, /* 3C..3F */ - _ill ,_nom, _nop ,_imp, _ill ,_nom, _ill ,_nom, /* 40..43 */ - _ill ,_nom, _nop ,_imp, _ill ,_nom, _ill ,_nom, /* 44..47 */ - _ill ,_nom, _nop ,_imp, _ill ,_nom, _ill ,_nom, /* 48..4B */ - _ill ,_nom, _nop ,_imp, _ill ,_nom, _ill ,_nom, /* 4C..4F */ - _ill ,_nom, _nop ,_imp, _ill ,_nom, _ill ,_nom, /* 50..53 */ - _ill ,_nom, _nop ,_imp, _ill ,_nom, _ill ,_nom, /* 54..57 */ - _ill ,_nom, _nop ,_imp, _ill ,_nom, _ill ,_nom, /* 58..5B */ - _ill ,_nom, _nop ,_imp, _ill ,_nom, _ill ,_nom, /* 5C..5F */ - _ill ,_nom, _nop ,_imp, _ill ,_nom, _ill ,_nom, /* 60..63 */ - _ill ,_nom, _nop ,_imp, _ill ,_nom, _ill ,_nom, /* 64..67 */ - _ill ,_nom, _nop ,_imp, _ill ,_nom, _ill ,_nom, /* 68..6B */ - _ill ,_nom, _nop ,_imp, _ill ,_nom, _ill ,_nom, /* 6C..6F */ - _ill ,_nom, _nop ,_imp, _ill ,_nom, _ill ,_nom, /* 70..73 */ - _ill ,_nom, _nop ,_imp, _ill ,_nom, _ill ,_nom, /* 74..77 */ - _ill ,_nom, _nop ,_imp, _ill ,_nom, _ill ,_nom, /* 78..7B */ - _ill ,_nom, _nop ,_imp, _ill ,_nom, _ill ,_nom, /* 7C..7F */ - _ill ,_nom, _nop ,_imp, _ill ,_nom, _ill ,_nom, /* 80..83 */ - _ill ,_nom, _nop ,_imp, _ill ,_nom, _ill ,_nom, /* 84..87 */ - _ill ,_nom, _nop ,_imp, _ill ,_nom, _ill ,_nom, /* 88..8B */ - _ill ,_nom, _nop ,_imp, _ill ,_nom, _ill ,_nom, /* 8C..8F */ - _ill ,_nom, _nop ,_imp, _ill ,_nom, _ill ,_nom, /* 90..93 */ - _ill ,_nom, _nop ,_imp, _ill ,_nom, _ill ,_nom, /* 94..97 */ - _ill ,_nom, _nop ,_imp, _ill ,_nom, _ill ,_nom, /* 98..9B */ - _ill ,_nom, _nop ,_imp, _ill ,_nom, _ill ,_nom, /* 9C..9F */ - _ill ,_nom, _nop ,_imp, _ill ,_nom, _cpd ,_ix8, /* A0..A3 */ - _ill ,_nom, _nop ,_imp, _ill ,_nom, _ill ,_nom, /* A4..A7 */ - _ill ,_nom, _nop ,_imp, _ill ,_nom, _ill ,_nom, /* A8..AB */ - _cpx ,_ix8, _nop ,_imp, _ill ,_nom, _ill ,_nom, /* AC..AF */ - _ill ,_nom, _nop ,_imp, _ill ,_nom, _ill ,_nom, /* B0..B3 */ - _ill ,_nom, _nop ,_imp, _ill ,_nom, _ill ,_nom, /* B4..B7 */ - _ill ,_nom, _nop ,_imp, _ill ,_nom, _ill ,_nom, /* B8..BB */ - _ill ,_nom, _nop ,_imp, _ill ,_nom, _ill ,_nom, /* BC..BF */ - _ill ,_nom, _nop ,_imp, _ill ,_nom, _ill ,_nom, /* C0..C3 */ - _ill ,_nom, _nop ,_imp, _ill ,_nom, _ill ,_nom, /* C4..C7 */ - _ill ,_nom, _nop ,_imp, _ill ,_nom, _ill ,_nom, /* C8..CB */ - _ill ,_nom, _nop ,_imp, _ill ,_nom, _ill ,_nom, /* CC..CF */ - _ill ,_nom, _nop ,_imp, _ill ,_nom, _ill ,_nom, /* D0..D3 */ - _ill ,_nom, _nop ,_imp, _ill ,_nom, _ill ,_nom, /* D4..D7 */ - _ill ,_nom, _nop ,_imp, _ill ,_nom, _ill ,_nom, /* D8..DB */ - _ill ,_nom, _nop ,_imp, _ill ,_nom, _ill ,_nom, /* DC..DF */ - _ill ,_nom, _nop ,_imp, _ill ,_nom, _ill ,_nom, /* E0..E3 */ - _ill ,_nom, _nop ,_imp, _ill ,_nom, _ill ,_nom, /* E4..E7 */ - _ill ,_nom, _nop ,_imp, _ill ,_nom, _ill ,_nom, /* E8..EB */ - _ill ,_nom, _nop ,_imp, _ldx ,_ix8, _stx ,_ix8, /* EC..EF */ - _ill ,_nom, _nop ,_imp, _ill ,_nom, _ill ,_nom, /* F0..F3 */ - _ill ,_nom, _nop ,_imp, _ill ,_nom, _ill ,_nom, /* F4..F7 */ - _ill ,_nom, _nop ,_imp, _ill ,_nom, _ill ,_nom, /* F8..FB */ - _ill ,_nom, _nop ,_imp, _ill ,_nom, _ill ,_nom, /* FC..FF */ + {_ill ,_nom}, {_nop ,_imp}, {_ill ,_nom}, {_ill ,_nom}, /* 00..03 */ + {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, /* 04..07 */ + {_iny ,_imp}, {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, /* 08..0B */ + {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, /* 0C..0F */ + {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, /* 10..13 */ + {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, /* 14..17 */ + {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, /* 18..1B */ + {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, {_ill ,_nom}, /* 1C..1F */ + {_ill ,_nom}, {_nop ,_imp}, {_ill ,_nom}, {_ill ,_nom}, /* 20..23 */ + {_ill ,_nom}, {_nop ,_imp}, {_ill ,_nom}, {_ill ,_nom}, /* 24..27 */ + {_ill ,_nom}, {_nop ,_imp}, {_ill ,_nom}, {_ill ,_nom}, /* 28..2B */ + {_ill ,_nom}, {_nop ,_imp}, {_ill ,_nom}, {_ill ,_nom}, /* 2C..2F */ + {_ill ,_nom}, {_nop ,_imp}, {_ill ,_nom}, {_ill ,_nom}, /* 30..33 */ + {_ill ,_nom}, {_nop ,_imp}, {_ill ,_nom}, {_ill ,_nom}, /* 34..37 */ + {_ill ,_nom}, {_nop ,_imp}, {_ill ,_nom}, {_ill ,_nom}, /* 38..3B */ + {_ill ,_nom}, {_nop ,_imp}, {_ill ,_nom}, {_ill ,_nom}, /* 3C..3F */ + {_ill ,_nom}, {_nop ,_imp}, {_ill ,_nom}, {_ill ,_nom}, /* 40..43 */ + {_ill ,_nom}, {_nop ,_imp}, {_ill ,_nom}, {_ill ,_nom}, /* 44..47 */ + {_ill ,_nom}, {_nop ,_imp}, {_ill ,_nom}, {_ill ,_nom}, /* 48..4B */ + {_ill ,_nom}, {_nop ,_imp}, {_ill ,_nom}, {_ill ,_nom}, /* 4C..4F */ + {_ill ,_nom}, {_nop ,_imp}, {_ill ,_nom}, {_ill ,_nom}, /* 50..53 */ + {_ill ,_nom}, {_nop ,_imp}, {_ill ,_nom}, {_ill ,_nom}, /* 54..57 */ + {_ill ,_nom}, {_nop ,_imp}, {_ill ,_nom}, {_ill ,_nom}, /* 58..5B */ + {_ill ,_nom}, {_nop ,_imp}, {_ill ,_nom}, {_ill ,_nom}, /* 5C..5F */ + {_ill ,_nom}, {_nop ,_imp}, {_ill ,_nom}, {_ill ,_nom}, /* 60..63 */ + {_ill ,_nom}, {_nop ,_imp}, {_ill ,_nom}, {_ill ,_nom}, /* 64..67 */ + {_ill ,_nom}, {_nop ,_imp}, {_ill ,_nom}, {_ill ,_nom}, /* 68..6B */ + {_ill ,_nom}, {_nop ,_imp}, {_ill ,_nom}, {_ill ,_nom}, /* 6C..6F */ + {_ill ,_nom}, {_nop ,_imp}, {_ill ,_nom}, {_ill ,_nom}, /* 70..73 */ + {_ill ,_nom}, {_nop ,_imp}, {_ill ,_nom}, {_ill ,_nom}, /* 74..77 */ + {_ill ,_nom}, {_nop ,_imp}, {_ill ,_nom}, {_ill ,_nom}, /* 78..7B */ + {_ill ,_nom}, {_nop ,_imp}, {_ill ,_nom}, {_ill ,_nom}, /* 7C..7F */ + {_ill ,_nom}, {_nop ,_imp}, {_ill ,_nom}, {_ill ,_nom}, /* 80..83 */ + {_ill ,_nom}, {_nop ,_imp}, {_ill ,_nom}, {_ill ,_nom}, /* 84..87 */ + {_ill ,_nom}, {_nop ,_imp}, {_ill ,_nom}, {_ill ,_nom}, /* 88..8B */ + {_ill ,_nom}, {_nop ,_imp}, {_ill ,_nom}, {_ill ,_nom}, /* 8C..8F */ + {_ill ,_nom}, {_nop ,_imp}, {_ill ,_nom}, {_ill ,_nom}, /* 90..93 */ + {_ill ,_nom}, {_nop ,_imp}, {_ill ,_nom}, {_ill ,_nom}, /* 94..97 */ + {_ill ,_nom}, {_nop ,_imp}, {_ill ,_nom}, {_ill ,_nom}, /* 98..9B */ + {_ill ,_nom}, {_nop ,_imp}, {_ill ,_nom}, {_ill ,_nom}, /* 9C..9F */ + {_ill ,_nom}, {_nop ,_imp}, {_ill ,_nom}, {_cpd ,_ix8}, /* A0..A3 */ + {_ill ,_nom}, {_nop ,_imp}, {_ill ,_nom}, {_ill ,_nom}, /* A4..A7 */ + {_ill ,_nom}, {_nop ,_imp}, {_ill ,_nom}, {_ill ,_nom}, /* A8..AB */ + {_cpx ,_ix8}, {_nop ,_imp}, {_ill ,_nom}, {_ill ,_nom}, /* AC..AF */ + {_ill ,_nom}, {_nop ,_imp}, {_ill ,_nom}, {_ill ,_nom}, /* B0..B3 */ + {_ill ,_nom}, {_nop ,_imp}, {_ill ,_nom}, {_ill ,_nom}, /* B4..B7 */ + {_ill ,_nom}, {_nop ,_imp}, {_ill ,_nom}, {_ill ,_nom}, /* B8..BB */ + {_ill ,_nom}, {_nop ,_imp}, {_ill ,_nom}, {_ill ,_nom}, /* BC..BF */ + {_ill ,_nom}, {_nop ,_imp}, {_ill ,_nom}, {_ill ,_nom}, /* C0..C3 */ + {_ill ,_nom}, {_nop ,_imp}, {_ill ,_nom}, {_ill ,_nom}, /* C4..C7 */ + {_ill ,_nom}, {_nop ,_imp}, {_ill ,_nom}, {_ill ,_nom}, /* C8..CB */ + {_ill ,_nom}, {_nop ,_imp}, {_ill ,_nom}, {_ill ,_nom}, /* CC..CF */ + {_ill ,_nom}, {_nop ,_imp}, {_ill ,_nom}, {_ill ,_nom}, /* D0..D3 */ + {_ill ,_nom}, {_nop ,_imp}, {_ill ,_nom}, {_ill ,_nom}, /* D4..D7 */ + {_ill ,_nom}, {_nop ,_imp}, {_ill ,_nom}, {_ill ,_nom}, /* D8..DB */ + {_ill ,_nom}, {_nop ,_imp}, {_ill ,_nom}, {_ill ,_nom}, /* DC..DF */ + {_ill ,_nom}, {_nop ,_imp}, {_ill ,_nom}, {_ill ,_nom}, /* E0..E3 */ + {_ill ,_nom}, {_nop ,_imp}, {_ill ,_nom}, {_ill ,_nom}, /* E4..E7 */ + {_ill ,_nom}, {_nop ,_imp}, {_ill ,_nom}, {_ill ,_nom}, /* E8..EB */ + {_ill ,_nom}, {_nop ,_imp}, {_ldx ,_ix8}, {_stx ,_ix8}, /* EC..EF */ + {_ill ,_nom}, {_nop ,_imp}, {_ill ,_nom}, {_ill ,_nom}, /* F0..F3 */ + {_ill ,_nom}, {_nop ,_imp}, {_ill ,_nom}, {_ill ,_nom}, /* F4..F7 */ + {_ill ,_nom}, {_nop ,_imp}, {_ill ,_nom}, {_ill ,_nom}, /* F8..FB */ + {_ill ,_nom}, {_nop ,_imp}, {_ill ,_nom}, {_ill ,_nom}, /* FC..FF */ }; /*****************************************************************************/ @@ -375,19 +375,57 @@ codes = m68hc11_codes; codes18 = m68hc11_codes18; codes1a = m68hc11_codes1a; codescd = m68hc11_codescd; +boppcom = false; // A09 can't handle commas as bitop parameter delimiter yet mnemo.resize(mnemo68HC11_count); /* set up additional mnemonics */ for (int i = 0; i < mnemo68HC11_count - mnemo6801_count; i++) mnemo[mnemo6801_count + i] = opcodes[i]; +// set up options table +// class uses one generic option setter/getter pair (not mandatory) +AddOption("boppcom", "{off|on}\tbit operation parameter comma delimiter", + static_cast(&Dasm68HC11::Set68HC11Option), + static_cast(&Dasm68HC11::Get68HC11Option)); } /*****************************************************************************/ -/* ~Dasm68HC11 : destructor */ +/* ~Dasm68HC11 : destructor */ /*****************************************************************************/ Dasm68HC11::~Dasm68HC11(void) { } +/*****************************************************************************/ +/* Set68HC11Option : sets a disassembler option */ +/*****************************************************************************/ + +int Dasm68HC11::Set68HC11Option(string lname, string value) +{ +bool bnValue = true; /* default to "on" */ +bool bIsBool = ParseBool(value, bnValue); + +if (lname == "boppcom") + { + boppcom = bnValue; + return bIsBool ? 1 : 0; + } +else + return 0; /* only name consumed */ + +// should never happen ... but better safe than sorry +return 1; /* name and value consumed */ +} + +/*****************************************************************************/ +/* Get68HC11Option : retrieves a disassembler option */ +/*****************************************************************************/ + +string Dasm68HC11::Get68HC11Option(string lname) +{ +if (lname == "boppcom") return boppcom ? "on" : "off"; +return ""; +} + + /*****************************************************************************/ /* InitParse : initialize parsing */ /*****************************************************************************/ @@ -461,49 +499,35 @@ adr_t Dasm68HC11::FetchInstructionDetails uint8_t &instpg, uint8_t &instb, uint8_t &mode, - int &MI, - const char *&I, - string *smnemo + int &mnemoIndex ) { -uint16_t W; - instpg = instb = GetUByte(PC++); if (instpg == 0x18) { instb = GetUByte(PC++); - W = (uint16_t)instb * 2; - MI = codes18[W++]; - I = mnemo[MI].mne; - mode = codes18[W]; + mnemoIndex = codes18[instb].mne; + mode = codes18[instb].adrmode; } else if (instpg == 0x1A) { instb = GetUByte(PC++); - W = (uint16_t)instb * 2; - MI = codes1a[W++]; - I = mnemo[MI].mne; - mode = codes1a[W]; + mnemoIndex = codes1a[instb].mne; + mode = codes1a[instb].adrmode; } else if (instpg == 0xCD) { instb = GetUByte(PC++); - W = (uint16_t)instb * 2; - MI = codescd[W++]; - I = mnemo[MI].mne; - mode = codescd[W]; + mnemoIndex = codescd[instb].mne; + mode = codescd[instb].adrmode; } else { instpg = 0; - W = (uint16_t)instb * 2; - MI = codes[W++]; - I = mnemo[MI].mne; - mode = codes[W]; + mnemoIndex = codes[instb].mne; + mode = codes[instb].adrmode; } -if (smnemo) - *smnemo = I; return PC; } @@ -530,10 +554,9 @@ adr_t Dasm68HC11::ParseCode { uint8_t instpg, instb, T, mode; uint16_t W; -int MI; -const char *I; +int mnemoIndex; bool bSetLabel; -adr_t PC = FetchInstructionDetails(addr, instpg, instb, mode, MI, I); +adr_t PC = FetchInstructionDetails(addr, instpg, instb, mode, mnemoIndex); switch (mode) /* which mode is this ? */ { @@ -545,7 +568,7 @@ switch (mode) /* which mode is this ? */ { W = GetUByte(PC); W = (uint16_t)PhaseInner(W, PC); - AddRelativeLabel(W, PC, mnemo[MI].memType, true, BusCode, addr); + AddRelativeLabel(W, PC, mnemo[mnemoIndex].memType, true, BusCode, addr); } PC++; bSetLabel = !IsConst(PC); @@ -587,7 +610,7 @@ switch (mode) /* which mode is this ? */ { W = (uint16_t)DephaseOuter(W, PC); // AddLabel(W, mnemo[MI].memType, "", true); - AddRelativeLabel(W, PC, mnemo[MI].memType, true, BusCode, addr); + AddRelativeLabel(W, PC, mnemo[mnemoIndex].memType, true, BusCode, addr); } else SetDefLabelUsed(PC, bus); @@ -609,7 +632,7 @@ switch (mode) /* which mode is this ? */ { W = (uint16_t)DephaseOuter(W, PC); // AddLabel(W, mnemo[MI].memType, "", true); - AddRelativeLabel(W, PC, mnemo[MI].memType, true, BusCode, addr); + AddRelativeLabel(W, PC, mnemo[mnemoIndex].memType, true, BusCode, addr); } else SetDefLabelUsed(PC, bus); @@ -636,12 +659,12 @@ adr_t Dasm68HC11::DisassembleCode uint8_t instpg, instb, T, mode; uint16_t W; adr_t Wrel; -int MI; -const char *I; +int mnemoIndex; bool bGetLabel; Label *lbl; -adr_t PC = FetchInstructionDetails(addr, instpg, instb, mode, MI, I, &smnemo); +adr_t PC = FetchInstructionDetails(addr, instpg, instb, mode, mnemoIndex); +smnemo = mnemo[mnemoIndex].mne; switch (mode) /* which mode is this? */ { case _bd : /* Bit Manipulation direct */ @@ -657,8 +680,10 @@ switch (mode) /* which mode is this? */ T = GetUByte(PC); string smask = lbl ? lbl->GetText() : Number2String(T, 2, PC); PC++; - sparm = sformat("%s %s", + char cdelim = boppcom ? ',' : ' '; + sparm = sformat("%s%c%s", slbl.c_str(), + cdelim, smask.c_str()); } break; @@ -687,8 +712,10 @@ switch (mode) /* which mode is this? */ lbl = FindLabel(PC, Const, bus); /* the bit part */ string smask = lbl ? lbl->GetText() : Number2String(T, 2, PC); PC++; - sparm = sformat("%s %s", + char cdelim = boppcom ? ',' : ' '; + sparm = sformat("%s%c%s", slbl.c_str(), + cdelim, smask.c_str()); } break; @@ -727,9 +754,12 @@ switch (mode) /* which mode is this? */ stgt += lbl ? lbl->GetText() : SignedNumber2String(nDiff, 2, PC - 1); } } - sparm = sformat("%s %s %s", + char cdelim = boppcom ? ',' : ' '; + sparm = sformat("%s%c%s%c%s", slbl.c_str(), + cdelim, smask.c_str(), + cdelim, stgt.c_str()); } break; @@ -779,9 +809,12 @@ switch (mode) /* which mode is this? */ stgt += lbl ? lbl->GetText() : SignedNumber2String(nDiff, 2, PC - 1); } } - sparm = sformat("%s %s %s", + char cdelim = boppcom ? ',' : ' '; + sparm = sformat("%s%c%s%c%s", slbl.c_str(), + cdelim, smask.c_str(), + cdelim, stgt.c_str()); } break; diff --git a/Dasm68HC11.h b/Dasm68HC11.h index ad65e86..3e1d513 100644 --- a/Dasm68HC11.h +++ b/Dasm68HC11.h @@ -43,6 +43,11 @@ class Dasm68HC11 : public Dasm6801 // Initialize parsing virtual bool InitParse(int bus = BusCode); + // Options handler + protected: + int Set68HC11Option(string name, string value); + string Get68HC11Option(string name); + protected: // additional 68HC11 addressing modes enum AddrMode68HC11 @@ -83,18 +88,20 @@ class Dasm68HC11 : public Dasm6801 mnemo68HC11_count }; - static uint8_t m68hc11_codes[512]; - static uint8_t m68hc11_codes18[512]; - static uint8_t m68hc11_codes1a[512]; - static uint8_t m68hc11_codescd[512]; + static CMatrixEntry m68hc11_codes[256]; + static CMatrixEntry m68hc11_codes18[256]; + static CMatrixEntry m68hc11_codes1a[256]; + static CMatrixEntry m68hc11_codescd[256]; static OpCode opcodes[mnemo68HC11_count - mnemo6801_count]; - uint8_t *codes18; - uint8_t *codes1a; - uint8_t *codescd; + CMatrixEntry *codes18; + CMatrixEntry *codes1a; + CMatrixEntry *codescd; + + bool boppcom; protected: - virtual adr_t FetchInstructionDetails(adr_t PC, uint8_t &instpg, uint8_t &instb, uint8_t &mode, int &MI, const char *&I, string *smnemo = NULL); + virtual adr_t FetchInstructionDetails(adr_t PC, uint8_t &instpg, uint8_t &instb, uint8_t &mode, int &mnemoIndex); virtual string GetIx8IndexReg(uint8_t instpg); // parse instruction at given memory address for labels virtual adr_t ParseCode(adr_t addr, int bus = BusCode); diff --git a/DasmAvr8.cpp b/DasmAvr8.cpp index e761d63..c7c1ad0 100644 --- a/DasmAvr8.cpp +++ b/DasmAvr8.cpp @@ -762,7 +762,11 @@ while (!done && (nBytes >= 0)) /* while there are lines */ SetUWord(nAddr, value, bus); for (; i >= 0; i--) { - SetCellUsed(nAddr + i, true, bus); /* mark as used byte */ + // Hmmm. begin/end is a bit inadequate here, without the bus ... + // Might need an update when this becomes remotely relevant + bool bUsed = ((begin == NO_ADDRESS || (adr_t)i >= begin) && + (end == NO_ADDRESS || (adr_t)i <= end)); + SetCellUsed(nAddr + i, bUsed, bus); /* mark as (un)used byte */ SetDisplay(nAddr + i, defaultDisplay, bus); } while ((c = fgetc(f)) == '\r' || c == '\n') @@ -778,10 +782,7 @@ while (!done && (nBytes >= 0)) /* while there are lines */ fseek(f, nCurPos, SEEK_SET); if (nBytes >= 0) { - if (fbegin < begin) - begin = fbegin; - if (fend > end) - end = fend; + offset = fend + 1; } if (nBytes > 0) @@ -1335,7 +1336,7 @@ int i; avrInstructionInfo *ii = LookupInstruction(opcode); if (ii == NULL) /* if no instruction, */ { - smnemo = ".dw"; + smnemo = mnemo[_d_dw].mne; sparm = Number2String(opcode, 4, addr, bus); return 2; } diff --git a/Disassembler.cpp b/Disassembler.cpp index f31a43f..2a7f192 100644 --- a/Disassembler.cpp +++ b/Disassembler.cpp @@ -123,8 +123,8 @@ const Disassembler::Endian Disassembler::prgEndian = (Disassembler::Endian)*((ui Disassembler::Disassembler(Application *pApp) : pApp(pApp) { -begin = load = NO_ADDRESS; -end = offset = 0; +begin = end = load = NO_ADDRESS; +offset = 0; commentStart = ";"; #if RB_VARIANT labelDelim = ":"; @@ -1126,7 +1126,9 @@ while (!done && (nBytes >= 0)) /* while there are lines */ { nBytes = -1; break; } /* return with error */ /* otherwise add memory byte */ setat(tgtaddr, (uint8_t)c, bus); - SetCellUsed(tgtaddr, true, bus); + bool bUsed = ((begin == NO_ADDRESS || tgtaddr >= begin) && + (end == NO_ADDRESS || tgtaddr <= end)); + SetCellUsed(tgtaddr, bUsed, bus); SetDisplay(tgtaddr, defaultDisplay, bus); } break; @@ -1181,10 +1183,7 @@ while (!done && (nBytes >= 0)) /* while there are lines */ fseek(f, nCurPos, SEEK_SET); if (nBytes >= 0) { - if (fbegin < begin) - begin = fbegin; - if (fend > end) - end = fend; + offset = fend + interleave; } if (nBytes > 0) @@ -1276,7 +1275,9 @@ while ((!done) && (nBytes >= 0)) /* while there are lines */ { nBytes = -1; break; } /* return with error */ /* otherwise add memory byte */ setat(tgtaddr, (uint8_t)c, bus); - SetCellUsed(tgtaddr, true, bus); + bool bUsed = ((begin == NO_ADDRESS || tgtaddr >= begin) && + (end == NO_ADDRESS || tgtaddr <= end)); + SetCellUsed(tgtaddr, bUsed, bus); SetDisplay(tgtaddr, defaultDisplay, bus); } break; @@ -1337,10 +1338,7 @@ while ((!done) && (nBytes >= 0)) /* while there are lines */ fseek(f, nCurPos, SEEK_SET); if (nBytes >= 0) { - if (fbegin < begin) - begin = fbegin; - if (fend > end) - end = fend; + offset = fend + interleave; } if (nBytes > 0) @@ -1378,46 +1376,36 @@ if ((sadr_t)off > 0 && /* restrict to maximum code size */ offset + (off * interleave) > GetHighestBusAddr(bus) + 1) off = ((GetHighestBusAddr(bus) + 1) / interleave) - offset; -if (begin == NO_ADDRESS || /* set begin if not specified */ - begin < offset) -// if (begin < 0 || offset < begin) // we allow begin > offset ! - begin = offset; - if ((sadr_t)off > 0) /* if file size can be determined */ - { - if (end == 0 || end < begin) /* set end if not specified */ -// if (end < offset + (off * interleave) - 1) - end = offset + (off * interleave) - 1; - if (end > offset && end < offset + (off * interleave) -1) - off = (end + 1 - offset + interleave - 1) / interleave; - // account for begin > offset scenarios - adr_t memoff = begin > offset ? begin - offset : 0; - AddMemory(begin, /* make sure memory is there */ - (off - 1) * interleave + 1 - memoff, memType, 0, bus); - } + AddMemory(offset, /* make sure memory is there */ + (off - 1) * interleave + 1, memType, 0, bus); /* mark area as used */ for (i = 0; (sadr_t)off < 0 || i < off; i++) { if (c == EOF) /* if error, abort reading */ { - if (off > 0) + if ((sadr_t)off >= 0) + { fseek(f, nCurPos, SEEK_SET); - return (sadr_t)off < 0; + return false; + } + break; } adr_t tgtaddr = offset + (i * interleave); - if (tgtaddr >= begin && - tgtaddr <= end) - { - if ((sadr_t)off < 0) /* if reading an unseekable stream */ - AddMemory(tgtaddr, interleave, /* assure memory */ - memType, 0, bus); - setat(tgtaddr, (uint8_t)c, bus); /* put byte */ - SetCellUsed(tgtaddr, true, bus); /* mark as used byte */ - SetDisplay(tgtaddr, defaultDisplay, bus); - } - c = fgetc(f); /* read next byte from the file */ + if ((sadr_t)off < 0) /* if reading an unseekable stream */ + AddMemory(tgtaddr, interleave, /* assure memory */ + memType, 0, bus); + setat(tgtaddr, (uint8_t)c, bus); /* put byte */ + + bool bUsed = ((begin == NO_ADDRESS || tgtaddr >= begin) && + (end == NO_ADDRESS || tgtaddr <= end)); + SetCellUsed(tgtaddr, bUsed, bus); /* mark as (un)used byte */ + SetDisplay(tgtaddr, defaultDisplay, bus); + c = fgetc(f); /* read next byte from the file */ } +offset = offset + i * interleave; + sLoadType = "binary"; return true; } @@ -1459,8 +1447,10 @@ if (pFile == NULL) bool bOK = LoadFile(filename, pFile, sLoadType, interleave, bus); if (pFile != stdin) fclose(pFile); +#if 0 if (bOK) /* if loading done, */ offset = end + 1; /* prepare for next file */ +#endif return bOK; } diff --git a/Disassembler.h b/Disassembler.h index b54576d..4c5bb81 100644 --- a/Disassembler.h +++ b/Disassembler.h @@ -916,6 +916,21 @@ class Disassembler return sformat("%s%0*X", cType, (bits + 3) / 4, addr); } virtual bool IsForwardRef(adr_t value, bool bUseLabel, adr_t addr, int bus = BusCode); + virtual bool MnemoRename(string oldMnemo, string newMnemo) + { + // not exactly beautiful, but there's no guarantee that mnemonics are sorted + // and setting up a hash table for that would be overkill, so iterate through the list + string oldup = uppercase(oldMnemo); + for (size_t i = 0; i < mnemo.size(); i++) + { + if (uppercase(mnemo[i].mne) == oldup) + { + mnemo[i].mne = strdup(newMnemo.c_str()); + return true; + } + } + return false; + } protected: static const Endian prgEndian; diff --git a/dasmfw.cpp b/dasmfw.cpp index 10574d1..9f8545b 100644 --- a/dasmfw.cpp +++ b/dasmfw.cpp @@ -1218,6 +1218,8 @@ enum InfoCmd // phasing support infoPhase, /* PHASE addr[-addr] [+|-]phase */ infoUnphase, /* UNPHASE addr[-addr] */ + // mnemonic renaming + infoMnemo, /* MNEMO org ren */ // handled outside disassembler engine: infoInclude, /* INCLUDE infofilename */ @@ -1316,6 +1318,8 @@ static struct /* structure to convert key to type */ // phasing support { "PHASE", infoPhase }, { "UNPHASE", infoUnphase }, + // mnemonic renaming + { "MNEMO", infoMnemo }, // handled outside disassembler engine: { "INCLUDE", infoInclude }, @@ -1885,6 +1889,18 @@ do } } break; + + case infoMnemo : /* MNEMO org ren */ + { + string org; + idx = value.find_first_of(" \t"); + if (idx == value.npos) idx = value.size(); + org = value.substr(0, idx); + value = triminfo(value.substr(idx)); + pDasm->MnemoRename(org, value); + } + break; + case infoComment : /* COMMENT [addr[-addr]] comment */ case infoPrepComm : /* PREPCOMM [addr[-addr]] comment */ case infoInsert : /* INSERT [addr[-addr]] text */ diff --git a/dasmfw.h b/dasmfw.h index 066c83c..0b14b8a 100644 --- a/dasmfw.h +++ b/dasmfw.h @@ -59,7 +59,7 @@ using namespace std; /* Global definitions */ /*****************************************************************************/ -#define DASMFW_VERSION "0.30" +#define DASMFW_VERSION "0.32" // set these to int64_t once 64bit processors become part of the framework typedef uint32_t cadr_t; /* container for maximal code address*/ diff --git a/dasmfw.vcproj b/dasmfw.vcproj index 4f884c5..829ebc2 100644 --- a/dasmfw.vcproj +++ b/dasmfw.vcproj @@ -41,7 +41,7 @@