summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFuwn <[email protected]>2022-11-12 14:31:11 -1000
committerFuwn <[email protected]>2022-11-12 14:31:11 -1000
commite38352f4a1b4ad4570af3f4e938e257e5e7b412a (patch)
tree38cd5c8379b879ea4b10da85465fdefe99fa2386
downloadellipse2-e38352f4a1b4ad4570af3f4e938e257e5e7b412a.tar.xz
ellipse2-e38352f4a1b4ad4570af3f4e938e257e5e7b412a.zip
feat: store oit
-rwxr-xr-xellipse2bin0 -> 9016 bytes
-rw-r--r--ellipse2.asm74
-rw-r--r--ellipse2.obin0 -> 960 bytes
3 files changed, 74 insertions, 0 deletions
diff --git a/ellipse2 b/ellipse2
new file mode 100755
index 0000000..e0e90e3
--- /dev/null
+++ b/ellipse2
Binary files differ
diff --git a/ellipse2.asm b/ellipse2.asm
new file mode 100644
index 0000000..c58f544
--- /dev/null
+++ b/ellipse2.asm
@@ -0,0 +1,74 @@
+global _start
+
+struc ellipse
+ major: resd 1
+ minor: resd 1
+ area: resd 1
+ circumference: resd 1
+ eccentricity: resd 1
+endstruc
+
+section .data
+e:
+ istruc ellipse
+ at major, dd 0
+ at minor, dd 0
+ at area, dd 0
+ at circumference, dd 0
+ at eccentricity, dd 0
+ iend
+
+section .rodata noexec nowrite align=4
+pi: dd 3.141592653589793238462
+
+section .text
+_start:
+ finit
+
+ mov ebx, 100
+
+; .repeat:
+ lea edi, [rbx + 0]
+ call print_uint32
+ ; dec ebx
+ ; jge .repeat
+
+ xor edi, edi
+ mov eax, 231
+ syscall
+
+ ; mov rax, 60
+ ; mov rdi, 0
+
+ ; syscall
+
+; void print_uint32(uint32_t edi)
+;
+; https://stackoverflow.com/questions/13166064/how-do-i-print-an-integer-in-assembly-level-programming-without-printf-from-the
+print_uint32:
+ mov eax, edi
+
+ mov ecx, 0xa
+ push rcx
+ mov rsi, rsp
+ sub rsp, 16
+
+.to_ascii_digit:
+ xor edx, edx
+ div ecx
+
+ add edx, '0'
+ dec rsi
+ mov [rsi], dl
+
+ test eax, eax
+ jnz .to_ascii_digit
+
+ mov eax, 1
+ mov edi, 1
+ lea edx, [rsp + 16 + 1]
+ sub edx, esi
+ syscall
+
+ add rsp, 24
+ ret
diff --git a/ellipse2.o b/ellipse2.o
new file mode 100644
index 0000000..d18df67
--- /dev/null
+++ b/ellipse2.o
Binary files differ