| |
Bitbreaker
Registered: Oct 2002 Posts: 508 |
Optimizing tricks
Hi folks,
I put together a few optimizing tricks for 6502, including a section about illegal opcodes. Anything else i could mention there? Especially the illegal opcode section could need some more examples and opcodes discussed i guess? Any mistakes?
http://www.codebase64.org/doku.php?id=base:advanced_optimizing
Bitbreaker |
|
... 20 posts hidden. Click here to view all posts.... |
| |
Bago Zonde
Registered: Dec 2010 Posts: 29 |
LDA $1000,Y will takes 4+1 and STA $1000,Y allways takes 5 cycles.
-------------------------------------------------------------
www.commocore.com |
| |
Bitbreaker
Registered: Oct 2002 Posts: 508 |
Oh right, it is STA, than it was right to not add a hint on that :-) Penalty cycle of course only applies to loading operations that add an index to a 16 bit address. Means ($xx),y $xxxx,x $xxxx,y
Applies for AND, ADC, SBC, ORA, EOR, CMP, LDA, LDX, LDY.
Same goes for branches if they cross a page boundary. |
| |
Skate
Registered: Jul 2003 Posts: 494 |
am i the only one who thinks Cruzer's reminder was enough. :) |
| |
Jak T Rip
Registered: Feb 2002 Posts: 39 |
Excellent stuff, Bitbreaker!
I included my favourite BIT trick to ignore upcoming commands:
beq +
lda #$04
.byte $2c
+ lda #$05
sta somewhere
rts
I learned this from the Omikron reassembler that uses this technique. |
| |
Bitbreaker
Registered: Oct 2002 Posts: 508 |
@Jak T Rip:
this trick also occurs in the kernal, however it does not save cycles (what the article is aiming for), but making things slower. It is a good thing however if you need to make your code small, no doubt. Depending on the range of values also a simple lookup table might do the trick. |
Previous - 1 | 2 | 3 - Next |