sfl-examples/slide-examples/assembly/ex21.asm

32 lines
488 B
NASM
Raw Normal View History

2023-12-14 14:12:51 +01:00
; CFG example
bits 64
SECTION .data
; empty
SECTION .text
global _start
_start:
mov rbx, 3 ; a
mov rcx, 2 ; b
cmp rbx, rcx ; a-b
je equal
ja greater
jb smaller
equal:
mov rax, 0
jmp return
greater:
mov rax, 1
jmp return
smaller:
mov rax, -1
return:
; sys_exit(42)
mov rdi,rax ; system call return value
mov rax,60 ; system call number (sys_exit)
syscall