This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
global _start | |
section .text | |
multiply: | |
xor rax, rax | |
cmp rsi, 0 | |
je base_case | |
dec rsi | |
call multiply | |
add rax, rdi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
global main | |
extern printf | |
section .text | |
main: | |
mov rax, 1 ; start current number as 1 in rax | |
mov r8, 5 ; move counter into r8 | |
loop: ; add a label to jump to | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SECTION .text | |
global positive_sum | |
; eax = return value (positive sum) | |
; rdi = pointer to array of ints (4 bytes) | |
; esi = length of array in rdi | |
positive_sum: | |
xor eax, eax | |
loop: | |
cmp WORD [rdi], 0 ; check if [rdi] greater than 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
global _start | |
SECTION .text | |
_start: | |
mov r8, 1 | |
loop: | |
mov rax, 1 | |
mov rdi, 1 | |
mov rsi, star | |
mov rdx, r8 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
section .text | |
global _start | |
_start: | |
; 169 = reboot | |
; Followed by magic numbers (see `man reboot.2`) | |
mov rax, 169 | |
mov rdi, 0fee1deadh | |
mov rsi, 672274793 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
global _start | |
section .text | |
_start: | |
mov r10, 2 | |
mov r9, 3 | |
mov r8, 3 | |
loop: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
global _start | |
section .data | |
File_Name: db 'WTH just happened',0 | |
File_Mode: dq 063q | |
section .text | |
_start: | |
mov rax, 85 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
global _start | |
section .text | |
_start: | |
; multiply two numbers | |
; we are going to have a loop that lets us loop the amount of times | |
;that we want to multiply it | |
mov r8, 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
global _start | |
section .text | |
_start: | |
mov r8, 0 | |
mov r9, 1 | |
mov r11, 1 | |
loop: |