configure: add a proper configure script
It's not very good, but it supports all of the options by the previous far-worse Makefile configure targets, and also now supports out-of-tree builds. Also include the relevent updates to the .buildbot script and .gitignore.
This commit is contained in:
@@ -15,6 +15,11 @@ 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)
|
||||
{
|
||||
return (val <= 127) && (val >= -128);
|
||||
}
|
||||
|
||||
static int check_no_args(const struct gbasm_parsed_inst *inst,
|
||||
const struct gbasm_op_info *op_info)
|
||||
{
|
||||
@@ -89,6 +94,11 @@ 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)) {
|
||||
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -163,16 +173,33 @@ size_t dec_emit(struct emitter *emitter,
|
||||
}
|
||||
|
||||
size_t ld_emit(struct emitter *emitter,
|
||||
const struct gbasm_parsed_inst *inst)
|
||||
const struct gbasm_parsed_inst *inst)
|
||||
{
|
||||
uint64_t opcode = 0x40;
|
||||
uint8_t opcode;
|
||||
uint8_t imm8;
|
||||
|
||||
opcode += inst->operands[0].r8.type * 8;
|
||||
opcode += inst->operands[1].r8.type;
|
||||
if (inst->operands[0].type == GBASM_OPERAND_REG_8) {
|
||||
switch (inst->operands[1].type) {
|
||||
case GBASM_OPERAND_REG_8:
|
||||
opcode = 0x40;
|
||||
opcode += inst->operands[0].r8.type * 8;
|
||||
opcode += inst->operands[1].r8.type;
|
||||
emit(emitter, &opcode, 1);
|
||||
return 1;
|
||||
case GBASM_OPERAND_IMM:
|
||||
imm8 = inst->operands[1].imm.value;
|
||||
opcode = 0x06;
|
||||
opcode += inst->operands[0].r8.type * 8;
|
||||
emit(emitter, &opcode, 1);
|
||||
emit(emitter, &imm8, 1);
|
||||
return 2;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
emit(emitter, &opcode, 1);
|
||||
}
|
||||
|
||||
return 1;
|
||||
return -1;
|
||||
}
|
||||
|
||||
struct gbasm_op_info gbasm_op_infos[] = {
|
||||
@@ -293,7 +320,9 @@ struct gbasm_op_info gbasm_op_infos[] = {
|
||||
{
|
||||
.opcode = "ld",
|
||||
/* support all of the other operands */
|
||||
.operand_types = { GBASM_OPERAND_REG_8, GBASM_OPERAND_REG_8 },
|
||||
.operand_types = { GBASM_OPERAND_REG_8,
|
||||
GBASM_OPERAND_REG_8 |
|
||||
GBASM_OPERAND_IMM },
|
||||
.check = ld_check,
|
||||
.length = length_one_byte,
|
||||
.emit = ld_emit,
|
||||
|
||||
Reference in New Issue
Block a user