Fixed disassembler bugs

This commit is contained in:
Lior Halphon 2016-07-01 18:04:25 +03:00
parent 79fd9ed6ad
commit 8eee70aed9

View File

@ -253,10 +253,9 @@ static const char *get_src_name(uint8_t opcode)
uint8_t src_register_id; uint8_t src_register_id;
uint8_t src_low; uint8_t src_low;
src_register_id = ((opcode >> 1) + 1) & 3; src_register_id = ((opcode >> 1) + 1) & 3;
src_low = !(opcode & 1); src_low = (opcode & 1);
if (src_register_id == GB_REGISTER_AF && src_low) { if (src_register_id == GB_REGISTER_AF) {
return src_low? "a": "[hl]";
return "[hl]";
} }
if (src_low) { if (src_low) {
return register_names[src_register_id] + 1; return register_names[src_register_id] + 1;
@ -271,9 +270,8 @@ static const char *get_dst_name(uint8_t opcode)
uint8_t dst_low; uint8_t dst_low;
dst_register_id = ((opcode >> 4) + 1) & 3; dst_register_id = ((opcode >> 4) + 1) & 3;
dst_low = opcode & 8; dst_low = opcode & 8;
if (dst_register_id == GB_REGISTER_AF && dst_low) { if (dst_register_id == GB_REGISTER_AF) {
return dst_low? "a": "[hl]";
return "[hl]";
} }
if (dst_low) { if (dst_low) {
return register_names[dst_register_id] + 1; return register_names[dst_register_id] + 1;