Tutorial by Examples: assembly

section .data msg_eq db 'Equal', 10 len_eq equ $ - msg_eq msg_le db 'Less than', 10 len_le equ $ - msg_le msg_gr db 'Greater than', 10 len_gr equ $ - msg_gr ; Length of msg_gr section .text global _main ; Make the _main label global for linker _main: cmp...
section .data msg db 'Hello, world!', 0xA len equ $ - msg section .text global _main _main: mov rax, 0 ; This will be the current number mov rcx, 10 ; This will be the last number _loop: cmp rax, rcx jl .loopbody ; Jump to .loopbody if rax < rcx jge _e...
We can put assembly instructions inside a macro and use the macro like you would call a function. #define mov(x,y) \ { \ __asm__ ("l.cmov %0,%1,%2" : "=r" (x) : "r" (y), "r" (0x0000000F)); \ } /// some definition and assignment unsigned char sbox[...

Page 2 of 2