Category:6502 Assembly: Difference between revisions

Content added Content deleted
m (→‎Know Your Opcodes: formatting fix)
m (→‎Know Your Opcodes: clarification)
Line 321: Line 321:
end:
end:
rts ;exit subroutine ;1 byte, 6 cycles</lang>
rts ;exit subroutine ;1 byte, 6 cycles</lang>
<b>Total: 8 bytes, 12 if branch taken, 14 if not.</b>
<b>Total: 8 bytes, 12 cycles if branch taken, 14 cycles if not.</b>


This version saves 1 byte that the <code>JMP</code> instruction wastes.
This version saves 1 byte that the <code>JMP</code> instruction wastes.
Line 332: Line 332:
end:
end:
rts ;exit subroutine ;1 byte, 6 cycles</lang>
rts ;exit subroutine ;1 byte, 6 cycles</lang>
<b>Total: 7 bytes, 12 if branch taken, 14 if not.</b>
<b>Total: 7 bytes, 12 cycles if branch taken, 14 cycles if not.</b>
And this version saves you even more:
And this version saves you even more:
<lang 6502asm>myRoutine:
<lang 6502asm>myRoutine:
Line 342: Line 342:
end:
end:
rts ;exit subroutine ;1 byte, 6 cycles</lang>
rts ;exit subroutine ;1 byte, 6 cycles</lang>
<b>Total: 6 bytes, 12 if branch taken, 11 if not.</b>
<b>Total: 6 bytes, 12 cycles if branch taken, 11 cycles if not.</b>