2 ms·
I've been meaning to learn some assembly for a while, but never quite knew where to start. Then I found this handy guide to writing "Hello, World" in assembly
by mindcrime 11y ago
I've been meaning to learn some assembly for a while, but never quite knew where to start. Then I found this handy guide to writing "Hello, World" in assembly on Linux. Just install nasm and follow the instructions here and you're good to go.
- minimax 11y agoAlternatively you can cut/paste the GAS syntax and use gcc. gcc -nostdlib hello.S -o hello This example uses the old 32-bit syscall invocation mechanism, which works fine under 64-bit Linux. It might be a useful exercise to try porting this program to the 64-bit syscall convention.
- mindcrime 11y agoAlternatively you can cut/paste the GAS syntax and use gcc. Oh, interesting. I didn't know you could do that with gcc. Thanks for the tip! This example uses the old 32-bit syscall invocation mechanism, which works fine under 64-bit Linux. It might be a useful exercise to try porting this program to the 64-bit syscall convention. I wasn't familiar with the difference, but some googling turned up this SO discussion which seems relevant. Maybe I will try making the change and see if I can get this to run with pure 64 bit code. http://stackoverflow.com/questions/8510333/x86-64-assembly-linux-system-call-confusion http://stackoverflow.com/questions/8510333/x86-64-assembly-l...
- oso2k 11y agoYou can extract the differences by looking at my librt0 [0] project. You can also see a minimal amd64 version in C here [1]. [0] https://github.com/lpsantil/rt0/blob/master/src/lib/syscall.c https://github.com/lpsantil/rt0/blob/master/src/lib/syscall.... [1] https://gist.github.com/lunixbochs/462ee21c3353c56b910f https://gist.github.com/lunixbochs/462ee21c3353c56b910f
- mindcrime 11y agoYou can also see a minimal amd64 version in C here [1]. Ah, that is very handy, and very illustrative. Thanks for sharing!
- bgilroy26 11y agoI like Bartlett's Programming from the Ground Up, though it might be too simple for some. It's available online in a few places: https://www.google.com/search?q=Bartlett+programming+from+the+ground+up https://www.google.com/search?q=Bartlett+programming+from+th...