sfl-examples/slide-examples/ex21.asm

32 lines
488 B
NASM

; 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