fix instruction mode bugs

This commit is contained in:
Kelvin Sherlock 2017-01-03 22:13:32 -05:00
parent 95481d710c
commit 9362980e82
3 changed files with 15 additions and 11 deletions

View File

@ -134,7 +134,7 @@ static constexpr const int modes[] =
2 | mBlockMove, // 44 mvp x,x
1 | mDP, // 45 eor dp
1 | mDP, // 46 lsr dp
1 | mDPIL | m_Y, // 47 eor [dp],y
1 | mDPIL, // 47 eor [dp]
0 | mImplied, // 48 pha
1 | mImmediate | m_M, // 49 eor #imm
0 | mImplied, // 4a lsr a
@ -326,7 +326,7 @@ static constexpr const int modes[] =
2 | mAbsolute | m_Y, // f9 sbc |abs,y
0 | mImplied, // fa plx
0 | mImplied, // fb xce
2 | mAbsoluteI, // fc jsr (abs)
2 | mAbsoluteI | m_X, // fc jsr (abs,x)
2 | mAbsolute | m_X, // fd sbc |abs,x
2 | mAbsolute | m_X, // fe inc |abs,x
3 | mAbsoluteLong | m_X, // ff sbc >abs,x
@ -339,9 +339,9 @@ static std::string to_x(uint32_t x, unsigned bytes, char prefix = 0) {
char buffer[16];
if (prefix) s.push_back(prefix);
if (x >= 0xff && bytes < 4) bytes = 4;
if (x >= 0xffff && bytes < 6) bytes = 6;
if (x >= 0xffffff && bytes < 8) bytes = 8;
if (x > 0xff && bytes < 4) bytes = 4;
if (x > 0xffff && bytes < 6) bytes = 6;
if (x > 0xffffff && bytes < 8) bytes = 8;
memset(buffer, '0', sizeof(buffer));
int i = 16;
@ -509,6 +509,7 @@ void disassembler::print_prefix() {
case mDP: printf("\t<"); break;
case mDPI: printf("\t(<"); break;
case mDPIL: printf("\t[<"); break;
case mAbsoluteIL: printf("\t["); break;
case mRelative:
case mBlockMove:
@ -534,6 +535,7 @@ std::string disassembler::prefix() {
case mDP: tmp = "<"; break;
case mDPI: tmp = "(<"; break;
case mDPIL: tmp = "[<"; break;
case mAbsoluteIL: tmp = "["; break;
case mRelative:
case mBlockMove:

View File

@ -302,9 +302,9 @@ static std::string to_x(uint32_t x, unsigned bytes, char prefix = 0) {
char buffer[16];
if (prefix) s.push_back(prefix);
if (x >= 0xff && bytes < 4) bytes = 4;
if (x >= 0xffff && bytes < 6) bytes = 6;
if (x >= 0xffffff && bytes < 8) bytes = 8;
if (x > 0xff && bytes < 4) bytes = 4;
if (x > 0xffff && bytes < 6) bytes = 6;
if (x > 0xffffff && bytes < 8) bytes = 8;
memset(buffer, '0', sizeof(buffer));
int i = 16;

View File

@ -204,7 +204,7 @@
;
cpy #$1234
cmp (<$12,x)
rep #$1234
rep #$00
cmp <$12,s
cpy <$12
cmp <$12
@ -231,14 +231,16 @@
cmp |$1234,y
phx
stp
jml [|$1234]
jml ($1234) ; was jml [$1234]
;jmp [$1234] ; ok!
;jml [$1234] ; error!
cmp |$1234,x
dec |$1234,x
cmp >$123456,x
;
cpx #$1234
sbc (<$12,x)
sep #$1234
sep #$00
sbc <$12,s
cpx <$12
sbc <$12