Created
October 20, 2019 00:33
-
-
Save matthewholliday/3114b3ea583d79b3c665c1121d7e15b6 to your computer and use it in GitHub Desktop.
ASSEMBLY Calculate String Length
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
section .data | |
msg db 'This is a test message.',0Ah | |
SECTION .text | |
global _start | |
_start: | |
mov ebx, msg | |
mov eax, ebx | |
gotonextchar: | |
cmp byte [eax], 0 | |
jz calculatelength | |
inc eax | |
jmp gotonextchar | |
calculatelength: | |
sub eax, ebx | |
mov edx, eax | |
writemessage: | |
mov ecx, msg | |
mov ebx, 1 | |
mov eax, 4 | |
int 80h | |
mov ebx, 0 | |
mov eax, 1 | |
int 80h | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment