Next video: • How to Multiply & Divide in Assembly | Beg...
Watch the course from the beginning: • Learn Assembly For Beginners | Introductio...
Previous Video in Course: • String Length Function | Assembly Tutorial...
Emulator Link: https://x64.halb.it
00:00 Step 1: Put string into RAM
00:50 Step 2: Understanding Syscall Write
04:00 Understanding Arguments in Assembly
06:27 Testing Program - Success!
09:45 Making it more Dynamic
12:30 Testing Again
13:00 Finding a Bug in strlen()
14:31 Caller Saved vs Callee Saved
16:00 Using Push/Pop with the Stack
CODE TO COPY:
/* Code Start */
_strlen:
mov rax, rdi
loop:
mov bl, [rax]
cmp bl, 0
je _strlen_exit
inc rcx
inc rax
jmp loop
_strlen_exit:
mov rax, rcx
ret
/* Code End */
Note: In the video, we add one line to clear RCX during initialization (not during the loop, or your strings will all evaluate to 0 length!)