42bs Posted January 8, 2021 Share Posted January 8, 2021 (edited) Hint: Use pre instead of post increment/decrement. It gives better code. signed int Sin(char ang,char sgn) { int tval; tval = (0x100 * SinTabhi[ang]) + SinTablo[ang]; if (!sgn) { tval = 0xffff ^ tval; tval++ ; } return tval; } => signed int Sin(char ang,char sgn) { int tval; tval = (0x100 * SinTabhi[ang]) + SinTablo[ang]; if (!sgn) { tval = 0xffff ^ tval; ++tval ; } return tval; } But: Why not simply: tval = -tval; ???? And (ouch): tval = (SinTabhi[ang] << 8 ) | SinTablo[ang]); Edited January 8, 2021 by 42bs Quote Link to comment Share on other sites More sharing options...
Positron5 Posted January 8, 2021 Share Posted January 8, 2021 Hello Bastian, thank you for the corrections. I will make the changes ?☺. I blame it on my assembler roots. Quote Link to comment Share on other sites More sharing options...
Positron5 Posted February 13, 2021 Share Posted February 13, 2021 (edited) I made the changes, thanx @42bs. a See http:// https://ANDREW-PROGS@bitbucket.org/ANDREW-PROGS/contacts.git for source. If anyone has noticed a distortion in the shape of the cube, it is because the transformed cooordinates of the cube corners are re -used for the next spacial calculation. Also the sine/cosine table is at a resolution of 8 bits and this contributes to the effect of lossy maths. Cheers. Edited February 18, 2021 by Positron5 Quote Link to comment Share on other sites More sharing options...
42bs Posted February 18, 2021 Share Posted February 18, 2021 Someone wrote up some cc65 tips'n'tricks: https://github.com/ilmenit/CC65-Advanced-Optimizations 1 Quote Link to comment Share on other sites More sharing options...
+karri Posted February 18, 2021 Author Share Posted February 18, 2021 Just now, 42bs said: Someone wrote up some cc65 tips'n'tricks: https://github.com/ilmenit/CC65-Advanced-Optimizations Great article. A speedup from 528 ticks to 29 is amazing. Quote Link to comment Share on other sites More sharing options...
LordKraken Posted February 18, 2021 Share Posted February 18, 2021 1 hour ago, 42bs said: Someone wrote up some cc65 tips'n'tricks: https://github.com/ilmenit/CC65-Advanced-Optimizations Great article, which makes me wonder, do you know if newcc65 has optimization flags? Quote Link to comment Share on other sites More sharing options...
42bs Posted February 18, 2021 Share Posted February 18, 2021 1 hour ago, LordKraken said: Great article, which makes me wonder, do you know if newcc65 has optimization flags? Not by heart, but placed my latest version on my GitHub page. Quote Link to comment Share on other sites More sharing options...
LordKraken Posted February 18, 2021 Share Posted February 18, 2021 (edited) 2 hours ago, 42bs said: Not by heart, but placed my latest version on my GitHub page. Almost it seems printf("\n -d Debugging on\n" " -s Print storage info\n" " -h Print hashtab stats\n" " -C Include source as comment\n" // " -O Optimize code\n" " -Dsymbol define Symbol\n" " -v Verbose mode\n" " -I <fn> Specify include directory\n" " -? This help message\n" " -N print copyright notice\n"); edit: ok it seems all code optimization have been handled to xopt, which I already use. Edited February 18, 2021 by LordKraken Quote Link to comment Share on other sites More sharing options...
Positron5 Posted April 14, 2021 Share Posted April 14, 2021 Hi, I have solved the problem with creating a working lynxcart of Spacecube/ contacts demo. Basically I was adding two headers to the .o file ?. I include the fixed .lnx file and the amended.cfg and makefile here. Also I have made the changes on bitbucket(see earlier post). Greetings Andrew contact2.zip Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.