ll_asm
ll_asm copied to clipboard
Some inefficient coding in 6502
Hi, over at http://forum.6502.org/viewtopic.php?f=1&t=3044 we've noticed some of the 6502 code is not idiomatic, and therefore not representatively dense. For example: https://github.com/deater/ll_asm/blob/master/no-os/6502_apple/ll_6502.s#L158 can be redone as
... ; save zero page ; otherwise we can't return to BASIC
ldx #$17 ; we save $E8-$FF save_zp_loop: lda $e8,x sta zp_save,x dex bpl save_zp_loop ...
Which is to say, using a single index and counting down to zero (or minus one) is a better tactic for 6502 code.