Jump to content
  • 0
Sign in to follow this  
LinuxVSX16

Any tips on how to make c code as small as possible?

Question

Just for practice with the Cx16 I'm writing a small text editor for the system, I'm just wondering what I can do to make a c file smaller. I'm open to answer any questions. Thank you.

Edited by LinuxVSX16
  • Like 1

Share this post


Link to post
Share on other sites

3 answers to this question

Recommended Posts

  • 0

C doesn't really fit a 6502. It's a byte orientated CPU. Adding 2 16 bit words takes 19 bytes.  There's no way round it that doesn't eat CPU cycles, even clever allocation and deallocation of zero page isn't that effective.

So :

  • do as much byte work as humanly possible
  • try to avoid stack frames - no parameters, locals. Make your locals static.
  • try and use zero page.

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  

×
×
  • Create New...

Important Information

Please review our Terms of Use