DGivney/assemblytutorials

The tutorial is not 64 bit nasm

Closed this issue · 3 comments

Thank you for this very explanatory tutorial. According to this:
http://asmtutor.com/
I thought it is about 64bit nasm tutorial which it is not. Are you planning on continuing your awesome work on this?
It is especially hard to find any information about how to print out itoa with the 64 bit version (not using printf). Seems to be a simple thing but I am completely lost. Chapter 10 and 11 won't work when compiled and linked in 64bits. Even though I've changed the registers to be compatible. I did days of investigation and am unable to figure it out.

Thank you

Hi calvous

Thank you for your interest in this project.

My plan for these tutorials was to slowly move from the 32-bit syntax into the 64-bit syntax and eventually into a much more modern example of assembly on linux. Unfortunately time got the best of me and I never completed all the tutorials to show that. I'm still planning to continue work on this when I have some free time.

They do run on 64-bit systems so please answer the following questions and I'll try to help you get it working.

  • What linux system are you using?
  • What commands are you using to compile it?
  • What commands are you using to link it?

The following will compile lesson10 with Nasm, link it with the elf_i386 option and run it on 64bit systems.
nasm -f elf helloworld-10.asm
ld -m elf_i386 helloworld-10.o -o helloworld-10
./helloworld-10

Hi DGivney,
thanks for the response.
I am just trying to get that "simple" thing done with printing a number sequence which is compared to another number scanned in with scanf function.

  • My system is a 64bit 4.18 Manjaro (Arch)

nasm -felf64 counter.asm
ld -o counter -lc -I /lib/ld-linux-x86-64.so.2 counter.o

or in case of external C calls

gcc -no-pie -o counter counter.o

Found the solution here:
https://www.youtube.com/watch?v=XuUD0WQ9kaE
very descriptive.