Re: Managing code
Posted: Sat Feb 13, 2021 7:01 pm
In the 80s when I wrote 6502 programs I kept the whole program in one file. Without any mentors, I learned everything from magazines, and the ones I had didn't discuss conditional assembly, macros or include files. The assembler manual did, but I didn't understand the concepts or how to use the features, so I ignored them.
This mode of development meant:
Nowadays, I:
This mode of development meant:
- I'd save my source to different filenames as a form of version control.
- I'd save versions of my code with test features on an off
- I had to put up with very long assembly times.
Nowadays, I:
- Make use of source control (git) for both applications and libraries.
- Keep constants and macro definitions in header files
- Use conditional assembly for feature switches and debug
- Use macros for code auto-generation and common multi-instruction patterns
- Separate libraries from applications. When I find myself copy/pasting a function from one project to another, I take time to study if the commonality can be factored out into a general utility function that can be used across projects. One implementation. One place to bug-fix.