diff options
author | Kartik Agaram <vc@akkartik.com> | 2018-07-26 23:26:20 -0700 |
---|---|---|
committer | Kartik Agaram <vc@akkartik.com> | 2018-07-26 23:26:20 -0700 |
commit | 5fdd09c5f012037b3a0f67ae63597d0135c1fe39 (patch) | |
tree | ca690c0bf2ca3f5e67f396509ed89d4c4632b785 /subx | |
parent | 365f762f8ffe2596b538aa9da711b36806126899 (diff) | |
download | mu-5fdd09c5f012037b3a0f67ae63597d0135c1fe39.tar.gz |
4432
Good idea from @tekknolagi: make more explicit that the first segment is code.
Diffstat (limited to 'subx')
-rw-r--r-- | subx/022check_instruction.cc | 6 | ||||
-rw-r--r-- | subx/023check_operand_sizes.cc | 6 | ||||
-rw-r--r-- | subx/024pack_instructions.cc | 6 |
3 files changed, 9 insertions, 9 deletions
diff --git a/subx/022check_instruction.cc b/subx/022check_instruction.cc index 19a7bece..93087b9a 100644 --- a/subx/022check_instruction.cc +++ b/subx/022check_instruction.cc @@ -67,9 +67,9 @@ Transform.push_back(check_operands); :(code) void check_operands(/*const*/ program& p) { if (p.segments.empty()) return; - const segment& seg = p.segments.at(0); - for (int i = 0; i < SIZE(seg.lines); ++i) { - check_operands(seg.lines.at(i)); + const segment& code = p.segments.at(0); + for (int i = 0; i < SIZE(code.lines); ++i) { + check_operands(code.lines.at(i)); if (trace_contains_errors()) return; // stop at the first mal-formed instruction } } diff --git a/subx/023check_operand_sizes.cc b/subx/023check_operand_sizes.cc index be4327f1..158b1465 100644 --- a/subx/023check_operand_sizes.cc +++ b/subx/023check_operand_sizes.cc @@ -27,9 +27,9 @@ Transform.push_back(check_operand_bounds); :(code) void check_operand_bounds(/*const*/ program& p) { if (p.segments.empty()) return; - const segment& seg = p.segments.at(0); - for (int i = 0; i < SIZE(seg.lines); ++i) { - const line& inst = seg.lines.at(i); + const segment& code = p.segments.at(0); + for (int i = 0; i < SIZE(code.lines); ++i) { + const line& inst = code.lines.at(i); for (int j = first_operand(inst); j < SIZE(inst.words); ++j) check_operand_bounds(inst.words.at(j)); if (trace_contains_errors()) return; // stop at the first mal-formed instruction diff --git a/subx/024pack_instructions.cc b/subx/024pack_instructions.cc index 44d06eb7..a897f1da 100644 --- a/subx/024pack_instructions.cc +++ b/subx/024pack_instructions.cc @@ -47,9 +47,9 @@ Transform.push_back(pack_instructions); :(code) void pack_instructions(program& p) { if (p.segments.empty()) return; - segment& seg = p.segments.at(0); - for (int i = 0; i < SIZE(seg.lines); ++i) { - line& inst = seg.lines.at(i); + segment& code = p.segments.at(0); + for (int i = 0; i < SIZE(code.lines); ++i) { + line& inst = code.lines.at(i); if (all_raw_hex_bytes(inst)) continue; trace(99, "translate") << "packing instruction '" << to_string(/*with metadata*/inst) << "'" << end(); pack_instruction(inst); |