From 3cf128d6da667d00bb5bb659413ea55a98a02aff Mon Sep 17 00:00:00 2001 From: mjfernez Date: Tue, 12 Oct 2021 20:18:28 -0400 Subject: Added description. x86 solutions for some problems --- 07-10001st-Prime/asm/Makefile | 6 ++++++ 07-10001st-Prime/asm/prime | Bin 0 -> 17040 bytes 07-10001st-Prime/asm/prime.asm | 24 ++++++++++++++++++++++++ 07-10001st-Prime/asm/prime.o | Bin 0 -> 1584 bytes 4 files changed, 30 insertions(+) create mode 100644 07-10001st-Prime/asm/Makefile create mode 100755 07-10001st-Prime/asm/prime create mode 100644 07-10001st-Prime/asm/prime.asm create mode 100644 07-10001st-Prime/asm/prime.o (limited to '07-10001st-Prime/asm') diff --git a/07-10001st-Prime/asm/Makefile b/07-10001st-Prime/asm/Makefile new file mode 100644 index 0000000..035c695 --- /dev/null +++ b/07-10001st-Prime/asm/Makefile @@ -0,0 +1,6 @@ +prime: prime.o + gcc prime.o -o prime +prime.o: prime.asm + nasm -w+all -f elf64 -g -F stabs prime.asm +clean: + rm -f prime prime.o diff --git a/07-10001st-Prime/asm/prime b/07-10001st-Prime/asm/prime new file mode 100755 index 0000000..e7318f8 Binary files /dev/null and b/07-10001st-Prime/asm/prime differ diff --git a/07-10001st-Prime/asm/prime.asm b/07-10001st-Prime/asm/prime.asm new file mode 100644 index 0000000..078db26 --- /dev/null +++ b/07-10001st-Prime/asm/prime.asm @@ -0,0 +1,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 + diff --git a/07-10001st-Prime/asm/prime.o b/07-10001st-Prime/asm/prime.o new file mode 100644 index 0000000..7c52424 Binary files /dev/null and b/07-10001st-Prime/asm/prime.o differ -- cgit v1.2.3