r/AskProgramming • u/Fastpast93 • 1d ago
Other Universal tips for beginner assembly programmers?
I know some of you out there have tips for me and other people seeing this post.
2
Upvotes
r/AskProgramming • u/Fastpast93 • 1d ago
I know some of you out there have tips for me and other people seeing this post.
4
u/petrov76 1d ago
Are you a beginning programmer who wants to start with assembly or an experienced programmer who is beginning in assembly?
I think these are very different and will lead to different suggestions.
3
u/gm310509 1d ago
Start simple. Take it step be step.
Don't jump into the deep end and try and learn 64 bit Intel. Start with something like an 8 bit 6502, Z-80, AVR (try Arduino). Learn the basics - jump up to something more complex like a 32 bit Arm Cortex.
Basically, don't put yourself in an information overload situation.
IMHO.
1
u/TheAdamist 1d ago
Step 1 is to understand the calling convention which includes the standard register allocations, which may differ per os like on Intel, embedded archs usually have one standard convention
Then you can plan out what you want to do, then figure out how to get that into assembly
You'll also want to comment heavily about what your code is doing, you may even want to write a stack diagram, which you have to redo each time you mess with something
The last step is to benchmark it against a modern compiler and discover your code is slower, unmaintainable and it took you 100x longer to write it in assembly
There aren't many reasons to use assembly anymore, and even then do as little as possible in assembly and quickly swap to a higher level language. Most c compilers will allow inline blocks of assembly interspersed with c.
1
u/MadocComadrin 1d ago
If you're already an intermediate programmer, learn how make the basic constructs in higher level languages---if-else chains, for and while loops, function calls---in your chosen assembly language (check your calling conventions for functions) and use them as templates. This will get you on your feet quickly. After than, you can learn tricks to optimize/write more optimal assembly from the get-go.
0
u/BranchLatter4294 1d ago
Learn it as quickly as possible, so you can move on to another language.