24
you are viewing a single comment's thread
view the rest of the comments
view the rest of the comments
this post was submitted on 14 Mar 2024
24 points (96.2% liked)
Programming
28322 readers
772 users here now
Welcome to the main community in programming.dev! Feel free to post anything relating to programming here!
Cross posting is strongly encouraged in the instance. If you feel your post or another person's post makes sense in another community cross post into it.
Hope you enjoy the instance!
Rules
Rules
- Follow the programming.dev instance rules
- Keep content related to programming in some way
- If you're posting long videos try to add in some form of tldr for those who don't want to watch videos
Wormhole
Follow the wormhole through a path of communities !webdev@programming.dev
founded 3 years ago
MODERATORS
There isn't one. Most people don't learn this stuff by reading a book.
The best way to learn is by looking at actual assembly code, then research what each instruction does. I wouldn't start with actual compiler generated code. Being computer generated it's often quite messy and obviously undocumented. Best to start with easier to read code like the example I've included below — a simple "print Hello World" in CISC, then in RISC.
Notice CISC uses
mov,intandxor, while RISC usesmov,ldr, andsvc. You should look those up in a manual (plenty of free ones online) but in simple terms:mov: move memory from one place to another. RISC and CISC have the same instruction but but they're not identicalint: means interrupt, essentially stop execution (for a moment) and hand execution over to other softwarexor: modifies a value (an XOR operation)ldr: is "load register", it loads a value from elsewhere in memorysvc: means "supervisor call" which, is used in much the same way asint. The code is asking the kernel to do something (once to write to stdout, and once to terminate the program).