diff --git a/decoder8086.odin b/decoder8086.odin index 4d45a83..78ecdbe 100644 --- a/decoder8086.odin +++ b/decoder8086.odin @@ -531,12 +531,12 @@ main :: proc() { dst_opr = parse_operand(inst, inst.dst, data[idx:], &processed, word, has_segment) src_opr = parse_operand(inst, inst.src, data[idx:], &processed, word, has_segment) - // TODO: This is ugly as hell - is_imm := operand_is(Immediate8, src_opr) || operand_is(Immediate16, src_opr) - is_bracketed := operand_is(MemoryAddr, dst_opr) || operand_is(DirectAddress, dst_opr) + src_is_imm := operand_is(Immediate8, src_opr) || operand_is(Immediate16, src_opr) + dst_is_bracketed := operand_is(MemoryAddr, dst_opr) || operand_is(DirectAddress, dst_opr) + src_is_bracketed := operand_is(MemoryAddr, src_opr) || operand_is(DirectAddress, src_opr) shiftrot := inst.src == .ShiftRotate size_string := "" - if ((is_imm && is_bracketed) || (is_bracketed && shiftrot)) { + if ((src_is_imm && dst_is_bracketed) || (dst_is_bracketed && shiftrot)) || (src_is_bracketed && operand_is(None, dst_opr)) { size_string = word ? "word " : "byte " } @@ -548,11 +548,6 @@ main :: proc() { src_str := get_operand_string(src_opr, word, has_segment) full_inst: string if dst_str == "" { - _,ok_1 := src_opr.(MemoryAddr); - _,ok_2 := src_opr.(DirectAddress); - if (ok_1 || ok_2) { - size_string = word ? "word " : "byte " - } interseg_string: string if indirect_intersegment { interseg_string = " far"