aboutsummaryrefslogtreecommitdiffstats
path: root/07-10001st-Prime/asm/prime.asm
blob: 078db26c91b46c4107d43f784c2567ff4c08a2df (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
; What is the 10 001st prime number?

extern printf
SECTION .data
flag:   db  "%d",10,0           ; "%d\n\0"

SECTION .text
    global main    
    global is_divisible

main:
        push rbp                ; set up stack
        mov rbp, rsp
        

.print  mov rdi, flag           ; arg 1 (format)
        mov rsi, rax            ; arg 2 (value)
        mov rax, 0		; no xmm registers
        call printf wrt ..plt
        pop rbp

        mov rax, 0
        ret