Quantcast
Channel: nesdev.org
Viewing all articles
Browse latest Browse all 785

Wiki: 6502 assembly optimisations - possible mistake

$
0
0
Hi, first post here.

I have noticed what could be an error in this section of the wiki: https://www.nesdev.org/wiki/6502_assemb ... th_ADC/SBC.

The part that reads:
When it is known that carry is clear, SEC instruction can be avoided by just doing SBC #(value+1)
should be changed to:
When it is known that carry is clear, SEC instruction can be avoided by just doing SBC #(value-1)
I have checked different scenarios to support this.

Just to clarify, if it is known that the carry is clear, if the original code is:

Code:

lda #$03secsbc #$01
then the optimized code will be:

Code:

lda #$03sbc #$00

Statistics: Posted by Ooxie — Mon Mar 18, 2024 1:59 pm — Replies 2 — Views 115



Viewing all articles
Browse latest Browse all 785

Trending Articles