summaryrefslogtreecommitdiffstats
path: root/yes.asm
diff options
context:
space:
mode:
Diffstat (limited to 'yes.asm')
-rw-r--r--yes.asm38
1 files changed, 38 insertions, 0 deletions
diff --git a/yes.asm b/yes.asm
new file mode 100644
index 0000000..6d61525
--- /dev/null
+++ b/yes.asm
@@ -0,0 +1,38 @@
+; Version : 0.1
+; Last update : 12/8/2020
+; Description : Do you need ultimate yes peformance? Well, you've come to the right place.
+; Licence : GPLv3
+; Note : Assumes that the stack is at least 65536 bytes.
+
+section .data
+Yes: db 0xA,'y',0xA,'y',0xA,'y',0xA,'y' ;8 bytes as the stack is written to 8 bytes at a time
+
+section .text
+ global _start
+
+_start:
+xor ecx,ecx ;0 out the counter registor
+
+ALIGN 16 ;Align the stack to 16 bytes
+;; rsp is pointing to the "start" of the stack
+yees: inc ecx ;increment the counter every loop
+
+push qword[Yes] ;push 8 bytes to the stack
+
+test ecx,8192 ;Check for 8192 loops
+je yees ;continue if amount is not reached
+
+;;the stack is now full of 32768 bytes of '\ny' (maybe a bit more, but that's ignored)
+yes: mov eax,1 ;sys_write
+mov edi,1 ;fd = STDOUT_FILENO
+mov edx,65536 ;print 65536 bytes
+mov rsi,rsp ;the value of rsp is the start of where the text is
+syscall
+
+jmp yes ;print those 65536 bytes of 'y\n' forever
+
+;;this won't ever be reached but it's left for any future usage
+exit:
+mov eax, 60 ;sys_exit
+xor edi, edi ;return 0
+syscall ;do sys_exit