Browse Source

Fix assembler bug involving extended immediates.

master
Ben Kurtovic 4 years ago
parent
commit
ba701545b2
3 changed files with 5 additions and 3 deletions
  1. +4
    -2
      src/assembler/instructions.c
  2. +1
    -1
      src/disassembler/mnemonics.c
  3. BIN
      tests/asm/roms.tar.gz

+ 4
- 2
src/assembler/instructions.c View File

@@ -92,9 +92,11 @@ static ASMErrorDesc parse_inst_##mnemonic( \
}

#define INST_IMM_U16_B1(imm) \
((imm).is_label ? (*symbol = cr_strdup((imm).label), 0) : (imm).uval >> 8)
((imm).is_label ? \
(*symbol = cr_strdup((imm).label), 0) : \
(imm).uval & 0xFF)
#define INST_IMM_U16_B2(imm) \
((imm).is_label ? 0 : (imm).uval & 0xFF)
((imm).is_label ? 0 : (imm).uval >> 8)

#define INST_INDEX_PREFIX(n) INST_PREFIX_(INST_INDEX(n).reg)


+ 1
- 1
src/disassembler/mnemonics.c View File

@@ -18,7 +18,7 @@ static char* instr_mnemonics[256] = {
/* 58 */ "ld", "ld", "ld", "ld", "ld", "ld", "ld", "ld",
/* 60 */ "ld", "ld", "ld", "ld", "ld", "ld", "ld", "ld",
/* 68 */ "ld", "ld", "ld", "ld", "ld", "ld", "ld", "ld",
/* 70 */ "ld", "ld", "ld", "ld", "ld", "ld", "ld", "ld",
/* 70 */ "ld", "ld", "ld", "ld", "ld", "ld", "halt", "ld",
/* 78 */ "ld", "ld", "ld", "ld", "ld", "ld", "ld", "ld",
/* 80 */ "add", "add", "add", "add", "add", "add", "add", "add",
/* 88 */ "adc", "adc", "adc", "adc", "adc", "adc", "adc", "adc",

BIN
tests/asm/roms.tar.gz View File


Loading…
Cancel
Save