4 ms·
On 6502, JMP uses 3 cycles. A branch uses 3 cycles if no page boundary is crossed, and 4 cycles if a page boundary is crossed. So there, JMP is "faster".
by ssdsa 12y ago
On 6502, JMP uses 3 cycles. A branch uses 3 cycles if no page boundary is crossed, and 4 cycles if a page boundary is crossed. So there, JMP is "faster".
- aruggirello 12y agoPerhaps wasting a single byte was regarded as a bad programming choice... :)
- kabdib 12y agoWhen you are space constrained, there is no ":-)" on that. -- veteran of several game cartridges for the 6502
- PythonicAlpha 12y agoThat is correct. Also, when you see, how much space was available. On Commodore, the Basic had to fit into 8k+ (together with the "Kernel" it had 16k of Rom and the Kernel needed ~7k) -- so space was really scarce -- a bigger ROM would have made the computers more costly.
- PythonicAlpha 12y agoThere is also an other reason for not wasting "a single byte": Branches are the only Jumps with condition. So, when you have a far destination that is more than 127 bytes away, you have to do that: want to do: BCS far_dest Have to do: BCC no_jump JMP far_dest no_jmp: ... So, when you wasted to many "single bytes", you may end up up adding 3 Bytes and at least 3 cycles to your conditional jumps.
- PythonicAlpha 12y agoOk, on 6502, you might be right (if your numbers are correct). But the 3 cycles might have been, because a decision according flags had to be made -- so a newer processor could have made an unconditional branch faster.