Jump to content
  • 0

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


LinuxVSX16
 Share

Question

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.
Link to comment
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.

 Share

×
×
  • Create New...

Important Information

Please review our Terms of Use