From 8e772907f583602de23ceeac8e9154c28e83dc61 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ahmet=20Kaan=20G=C3=9CM=C3=9C=C5=9E?= <96421894+Tahinli@users.noreply.github.com> Date: Wed, 3 Jan 2024 22:58:14 +0300 Subject: [PATCH] feat: loop --- 003-loop.s | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 003-loop.s diff --git a/003-loop.s b/003-loop.s new file mode 100644 index 0000000..52aaa03 --- /dev/null +++ b/003-loop.s @@ -0,0 +1,39 @@ +.global _start +.intel_syntax noprefix + +_start: + //hello world + mov rax, 1 + mov rdi, 1 + lea rsi, [hello_world] + mov rdx, 13 + syscall + + mov rbx, 5 + loop: + cmp rbx, 0 + jle continue + mov rax, 1 + mov rdi, 1 + lea rsi, [content] + mov rdx, 1 + syscall + sub rbx, 1 + jmp loop + continue: + mov rax, 1 + mov rdi, 1 + lea rsi, [finish] + mov rdx, 10 + syscall + + //exit + mov rax, 60 + syscall + +hello_world: + .asciz "Hello World\n" +finish: + .asciz "\nFinished\n" +content: + .asciz "*"