X-Git-Url: https://jxself.org/git/?a=blobdiff_plain;f=assembler%2Fmain.c;h=e90bac8118383f458426be1a8a9ed096220b97e4;hb=d55478bb22a3ae905775d2394058c37a44c0f940;hp=2c4749344305b606daa16e5452ce7e3f8a8d173f;hpb=7fd69f575e0f5a517651016513be6006db279c17;p=b43-tools.git diff --git a/assembler/main.c b/assembler/main.c index 2c47493..e90bac8 100644 --- a/assembler/main.c +++ b/assembler/main.c @@ -289,7 +289,7 @@ static unsigned int generate_reg_operand(struct assembler_context *ctx, case SPR: /* format: 0b100. .... .... */ val |= 0x800; - if (ctx->arch == 15) //FIXME is this ok? + if (ctx->arch == 15) val <<= 1; if (reg->nr & ~0x1FF) asm_error(ctx, "SPR-nr too big"); @@ -298,7 +298,7 @@ static unsigned int generate_reg_operand(struct assembler_context *ctx, case OFFR: /* format: 0b1000 0110 0rrr */ val |= 0x860; - if (ctx->arch == 15) //FIXME is this ok? + if (ctx->arch == 15) val <<= 1; if (reg->nr & ~0x7) asm_error(ctx, "OFFR-nr too big"); @@ -947,8 +947,16 @@ recalculate_addresses: if (addr < 0) goto does_not_exist; c->operands[i].u.operand = addr; - if (i != 2) /* Is not a jump target */ - c->operands[i].u.operand |= 0xC00; /* Make it be an immediate */ + if (i != 2) { + /* Is not a jump target. + * Make it be an immediate */ + if (ctx->arch == 5) + c->operands[i].u.operand |= 0xC00; + else if (ctx->arch == 15) + c->operands[i].u.operand |= 0xC00 << 1; + else + asm_error(ctx, "Internal error: label res imm"); + } } break; case OUT_LABEL: @@ -1098,8 +1106,12 @@ int main(int argc, char **argv) int err, res = 1; err = parse_args(argc, argv); - if (err) + if (err < 0) + goto out; + if (err > 0) { + res = 0; goto out; + } err = open_input_file(); if (err) goto out;