68000 code optimisations
Thread title says it all really.
I'm interested in the quickest ways to do things on the 68000 processor. I imagine that an optimisation that is valid for 68000 might not necessarily be valid for > 68000 processors but my main interest is in vanilla 68000 coding. So, if you have any, please post them here. :) In the meantime, some from me. Right hand operand(s) accomplish (according to my own testing, correct me if I'm wrong! :)) the same as the left hand operand(s) only faster: Code:
|
I could add a longer list here, but you could also refer to
http://sun.hasenbraten.de/vasm/release/vasm.html which shows most of vasm's optimizations in chapter 13.5. |
Thanks phx - been reading those optimisations at that link you posted - nice! :)
So far I haven't used your VASM assembler (sorry about that :() but I have to say it looks pretty cool, might be time to change my old habits. :great |
addq.l #,ax --> addq.w #,ax
b/jsr subroutine --> bra/jmp subroutine rts |
Quote:
|
According to the manual:
addq.l #x,An = 8 clock cycles addq.w #x,An = 4 clock cycles |
Quote:
|
Quote:
Have you told Motorola their manual's wrong...? :D |
How about:
add.w d4,a0 move.l (a0),a1 as move.l 0(a0,d4.w),a1 Also using the movem.l instruction to move lots of longwords in one instruction as opposed to a more processor intensive loop |
... move.l 0(a0,d4.l),a1 :D
|
Quote:
Also, I think that in the 68010 manual both are reported 8 cyles |
"Undocumented un-optimization": bset x,dn (and friends) take 2 cycles more if x >= 16.
|
I heard that the movem instruction can be used to clear screens quickly. Is this true and how would it be done?
Regards, Lonewolf10 |
Quote:
Zero all registers and Code:
rept lots of times |
Quote:
|
Code:
and.w #power of 2-1,d0 Code:
move.w x,d0 Code:
move.b d0,-(sp) If you call functions and pass params via the stack might be useful. Code:
move.w #something,-(sp) Code:
move.w #val,$ffff8240.w Code:
move.l somevar,d0 |
Quote:
Thanks for that. Regards, Lonewolf10 |
How many penality cycles on 68000/010 for :
ax = $00005000 move.l #$12345678,3(ax) And for 020+ with datacache ?? |
Quote:
|
Quote:
Quote:
Quote:
Comparing for a specific value would still be needed of course. :) |
All times are GMT +2. The time now is 09:32. |
Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.