Log inRegister an accountBrowse CSDbHelp & documentationFacts & StatisticsThe forumsAvailable RSS-feeds on CSDbSupport CSDb Commodore 64 Scene Database
 Welcome to our latest new user Macc ! (Registered 2025-07-23) You are not logged in - nap
CSDb User Forums


Forums > C64 Coding > Optimizing tricks
2012-03-14 08:52
Bitbreaker

Registered: Oct 2002
Posts: 510
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
 
... 15 posts hidden. Click here to view all posts....
 
2012-03-14 14:11
Bitbreaker

Registered: Oct 2002
Posts: 510
Added the new examples, thanks for that!
the dcp could then also be used like:

-
    ...some code
    lda #end
    dcp counter
    bne -

instead of

-
    ...some code
    dec counter
    lda counter
    cmp #end (of course silly if this would be #$00)
    bne -
2012-03-14 20:37
Testa
Account closed

Registered: Oct 2004
Posts: 197
thanks for sharing at codebase... i learned a few new tricks!, always interesting how creative you can be with legal and illigal opcodes..
2012-03-14 21:45
Peiselulli

Registered: Oct 2006
Posts: 84
Perhaps too simple, but
	cmp #$80
	ror

for doing a arithmetic shift right.

2012-03-14 21:53
JackAsser

Registered: Jun 2002
Posts: 2038
Quote: Perhaps too simple, but
	cmp #$80
	ror

for doing a arithmetic shift right.



Yay, my favorite! :)
2012-03-15 08:20
Bitbreaker

Registered: Oct 2002
Posts: 510
i added the arithemtic shift right to the maths section some time ago ;-) can also be combined with the illegal opcode anc instead of cmp to force carry to be always clear afterwards.
2012-03-16 18:47
tlr

Registered: Sep 2003
Posts: 1822
Perhaps this?
  lda ptr
  cmp eptr
  lda ptr+1
  sbc eptr+1
  lda ptr+2
  sbc eptr+2
  bcc ptr_lt_eptr
ptr_ge_eptr:


2012-03-17 22:45
Peiselulli

Registered: Oct 2006
Posts: 84
I have also often used the following:
     lsr
     asr #3*2

instead of
     lsr
     lsr
     and #3

2012-03-19 10:10
Bitbreaker

Registered: Oct 2002
Posts: 510
@Peiselulli:
ah, short but nice. I guess i'll spend a subsection for shifting tricks then, and include also the arithmetic right shift in there.

@tlr:
Where's the trick? If it is about substituting a sbc by cmp to save a sec, that is handled already in the article :-)
2012-03-19 16:02
tlr

Registered: Sep 2003
Posts: 1822
Quoting Bitbreaker
@tlr:
Where's the trick? If it is about substituting a sbc by cmp to save a sec, that is handled already in the article :-)
Yes, although I consider it more like using sbc's to extend a cmp.

I guess it is a bit to rudimentary to be called a trick, but it's useful nevertheless. :)
2012-03-21 10:03
Bitbreaker

Registered: Oct 2002
Posts: 510
Okay, now added a section about shifting and by that mean also slipped into the subject of jumpcode (or how to name that?)
Previous - 1 | 2 | 3 - Next
RefreshSubscribe to this thread:

You need to be logged in to post in the forum.

Search the forum:
Search   for   in  
All times are CET.
Search CSDb
Advanced
Users Online
Didi/Laxity
Røly/Mayday!
B.A./QUANTUM
bexxx
d'Avid
Barfly/Extend
Guests online: 47
Top Demos
1 Next Level  (9.7)
2 13:37  (9.7)
3 Codeboys & Endians  (9.7)
4 Mojo  (9.7)
5 Coma Light 13  (9.6)
6 Harminc  (9.6)
7 Edge of Disgrace  (9.6)
8 Comaland 100%  (9.6)
9 Wonderland XIV  (9.6)
10 Signal Carnival  (9.6)
Top onefile Demos
1 Nine  (9.8)
2 Layers  (9.6)
3 Cubic Dream  (9.6)
4 Party Elk 2  (9.6)
5 Copper Booze  (9.5)
6 Scan and Spin  (9.5)
7 Onscreen 5k  (9.5)
8 Grey  (9.5)
9 Dawnfall V1.1  (9.5)
10 Rainbow Connection  (9.5)
Top Groups
1 Performers  (9.3)
2 Booze Design  (9.3)
3 Censor Design  (9.3)
4 Oxyron  (9.3)
5 Artline Designs  (9.3)
Top Logo Graphicians
1 t0m3000  (10)
2 Sander  (9.8)
3 Shine  (9.5)
4 Mermaid  (9.5)
5 Pal  (9.4)

Home - Disclaimer
Copyright © No Name 2001-2025
Page generated in: 0.135 sec.