pub struct Stepped {
pub name: &'static str,
pub by: i64,
pub into: &'static str,
}Expand description
One addition of a constant, and the shorter instruction that adds that constant and no other.
Shorter because the number is in the opcode. An addition of a small constant spells the constant out in a byte after the one saying which register, and an increment says both in the opcode and the byte after it, so the saving is the byte the number was written in whatever the width.
It says the same thing about the register and not about the condition state. The addition writes the carry and the increment leaves the carry as it found it, so the two agree wherever nothing reads a carry between the instruction and the next thing to write one, and disagree everywhere else. That is a question about the instructions behind rather than about this one, which is what keeps this a description a pass asks rather than a spelling an encoder chooses.
Fields§
§name: &'static strThe opcode that takes the constant.
by: i64The constant it has to be carrying, as the number written on the instruction rather than as the number the instruction adds. So a subtraction that takes one away is here as one and turns into the instruction that takes one away, and the two agree about the register without the pass having to know which of the two opcodes is the subtraction.
into: &'static strThe opcode that adds that number without writing it out. It writes every part of the condition state the first one writes except the carry, which it leaves alone.