ld: add support for loading 8-bit immediates
This commit is contained in:
@@ -15,9 +15,10 @@ static bool gbasm_argtype_in_set(uint32_t argtype_set, uint32_t argtype)
|
||||
return !!(argtype & argtype_set);
|
||||
}
|
||||
|
||||
static bool imm_is_8_bit(uint16_t val)
|
||||
static bool imm_is_8_bit(int val)
|
||||
{
|
||||
return (val <= 127) && (val >= -128);
|
||||
/* Allow signed or unsigned representation */
|
||||
return (val <= 255) && (val >= -128);
|
||||
}
|
||||
|
||||
static int check_no_args(const struct gbasm_parsed_inst *inst,
|
||||
@@ -94,9 +95,13 @@ static int ld_check(const struct gbasm_parsed_inst *inst,
|
||||
gbasm_arg_wrong_type_error(inst, op_info);
|
||||
}
|
||||
|
||||
if (inst->operands[0].type == GBASM_OPERAND_REG_8 &&
|
||||
imm_is_8_bit(inst->operands[1].imm.value)) {
|
||||
if (inst->operands[0].type == GBASM_OPERAND_REG_8) {
|
||||
if (!imm_is_8_bit(inst->operands[1].imm.value)) {
|
||||
DEBUG_LOG("inst->operands[1].imm.value = %d",
|
||||
inst->operands[1].imm.value);
|
||||
|
||||
gbasm_invalid_imm_error(inst, op_info);
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
||||
Reference in New Issue
Block a user