all repos — mgba @ 19a42a387a4a9316e5626c8079bed4d989d9c3ac

mGBA Game Boy Advance Emulator

LR35902: Fix trailing whitespace in disassembly
Vicki Pfau vi@endrift.com
Mon, 29 Apr 2019 12:16:41 -0700
commit

19a42a387a4a9316e5626c8079bed4d989d9c3ac

parent

1deff07aa1b0d3d4b6b15e875fbeb0cc8eff0926

2 files changed, 10 insertions(+), 6 deletions(-)

jump to
M CHANGESCHANGES

@@ -30,6 +30,7 @@ - Qt: Fix crash in sprite viewer magnification (fixes mgba.io/i/1362)

- 3DS: Ensure core 2 can be used for threaded renderer (fixes mgba.io/i/1371) - GB Core: Fix toggling WIN and OBJ being swapped - All: Fix several memory leaks + - LR35902: Fix trailing whitespace in disassembly Misc: - GBA Savedata: EEPROM performance fixes - GBA Savedata: Automatically map 1Mbit Flash files as 1Mbit Flash
M src/lr35902/decoder.csrc/lr35902/decoder.c

@@ -504,6 +504,9 @@ if (op.flags & LR35902_OP_FLAG_IMPLICIT) {

return 0; } + strncpy(buffer, " ", blen - 1); + ADVANCE(1); + if (op.flags & LR35902_OP_FLAG_MEMORY) { strncpy(buffer, "[", blen - 1); ADVANCE(1);

@@ -545,16 +548,16 @@ int written;

int total = 0; const char* cond = _lr35902Conditions[info->condition]; - written = snprintf(buffer, blen - 1, "%s ", mnemonic); + written = snprintf(buffer, blen - 1, "%s", mnemonic); ADVANCE(written); if (cond) { - written = snprintf(buffer, blen - 1, "%s", cond); + written = snprintf(buffer, blen - 1, " %s", cond); ADVANCE(written); if (info->op1.reg || info->op1.immediate || info->op2.reg || info->op2.immediate) { - strncpy(buffer, ", ", blen - 1); - ADVANCE(2); + strncpy(buffer, ",", blen - 1); + ADVANCE(1); } }

@@ -565,8 +568,8 @@ }

if (info->op2.reg || (!info->op1.immediate && info->opcodeSize > 1 && info->opcode[0] != 0xCB)) { if (written) { - strncpy(buffer, ", ", blen - 1); - ADVANCE(2); + strncpy(buffer, ",", blen - 1); + ADVANCE(1); } written = _decodeOperand(info->op2, pc, buffer, blen); ADVANCE(written);