From 9307783bb0d7dc27bdd0831ce41174c5ef707b44 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:32:13 +0300 Subject: [PATCH] feat: comparation --- .gitignore | 4 +++- 002-comparation.s | 48 +++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 51 insertions(+), 1 deletion(-) create mode 100644 002-comparation.s diff --git a/.gitignore b/.gitignore index 1530978..579ea38 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,3 @@ -*.o \ No newline at end of file +*.o +main +derle \ No newline at end of file diff --git a/002-comparation.s b/002-comparation.s new file mode 100644 index 0000000..95da462 --- /dev/null +++ b/002-comparation.s @@ -0,0 +1,48 @@ +.global _start +.intel_syntax noprefix + +_start: + mov rax, 1 + mov rdi, 1 + lea rsi, [hello_world] + mov rdx, 13 + syscall + + mov ax, 3 + cmp ax, 4 + jb less_goto + ja great_goto + je equal_goto + less_goto: + mov rax, 1 + mov rdi, 1 + lea rsi, [below] + mov rdx, 6 + syscall + jmp continue + great_goto: + mov rax, 1 + mov rdi, 1 + lea rsi, [above] + mov rdx, 6 + syscall + jmp continue + equal_goto: + mov rax, 1 + mov rdi, 1 + lea rsi, [equal] + mov rdx, 6 + syscall + continue: + //exit + mov rax, 60 + syscall + +hello_world: + .asciz "Hello World\n" +above: + .asciz "Above\n" +below: + .asciz "Below\n" +equal: + .asciz "Equal\n"