base:advanced_optimizing
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revisionNext revisionBoth sides next revision | ||
base:advanced_optimizing [2016-02-04 20:48] – [DCP/ISC] bitbreaker | base:advanced_optimizing [2017-03-04 22:25] – [DCP/ISC] monte_carlos | ||
---|---|---|---|
Line 1154: | Line 1154: | ||
Another good use can be made if you want to do a inc/dec ($xx),y what is actually not available. So here isc/dcp ($xx),y will help you out, as it is also available for the indirect y adressing mode. | Another good use can be made if you want to do a inc/dec ($xx),y what is actually not available. So here isc/dcp ($xx),y will help you out, as it is also available for the indirect y adressing mode. | ||
+ | f.e.: | ||
+ | |||
+ | < | ||
+ | ldy #.. | ||
+ | lda (zp),y | ||
+ | clc | ||
+ | adc #.. | ||
+ | sta (zp),y | ||
+ | bcc + | ||
+ | iny | ||
+ | isc (zp),y | ||
+ | + | ||
+ | </ | ||
+ | |||
+ | or | ||
+ | |||
+ | < | ||
+ | ldy #.. | ||
+ | lda (zp),y | ||
+ | sec | ||
+ | sbc #.. | ||
+ | sta (zp),y | ||
+ | bcs + | ||
+ | iny | ||
+ | dcp (zp),y | ||
+ | + | ||
+ | </ | ||
For decrementing a 16 bit pointer it is also of good use: | For decrementing a 16 bit pointer it is also of good use: | ||
Line 1345: | Line 1372: | ||
So always try to form the term into something new and see if it performs better this way. So just remember the simple mathematic laws. | So always try to form the term into something new and see if it performs better this way. So just remember the simple mathematic laws. | ||
+ | Now also think of that classical negation term: | ||
+ | |||
+ | < | ||
+ | lda num | ||
+ | eor #$ff | ||
+ | clc | ||
+ | adc #$01 | ||
+ | sta neg | ||
+ | </ | ||
+ | |||
+ | Depending on what you have in register A, you can express it in many differnet ways: | ||
+ | |||
+ | < | ||
+ | ;a = $ff; carry set | ||
+ | eor num | ||
+ | adc #$00 | ||
+ | sta neg | ||
+ | | ||
+ | ;a = $00; carry set; | ||
+ | sbc num | ||
+ | sta neg | ||
+ | | ||
+ | ;a = $ff; carry clear | ||
+ | adc num | ||
+ | eor #$ff | ||
+ | sta neg | ||
+ | | ||
+ | ;a = $00; carry clear; | ||
+ | adc #$01 | ||
+ | sbc num | ||
+ | sta neg | ||
+ | </ | ||
+ | |||
+ | There are of course also other expressions possible, just ponder a while about the term. | ||
====== Running out of registers ====== | ====== Running out of registers ====== | ||
base/advanced_optimizing.txt · Last modified: 2024-03-03 11:06 by bitbreaker