summary refs log tree commit diff
path: root/hello.e
diff options
context:
space:
mode:
Diffstat (limited to 'hello.e')
-rw-r--r--hello.e35
1 files changed, 35 insertions, 0 deletions
diff --git a/hello.e b/hello.e
new file mode 100644
index 0000000..63f19c4
--- /dev/null
+++ b/hello.e
@@ -0,0 +1,35 @@
+~ cat labels.e elf.e hello.e | ./quine > hello && chmod 755 hello && ./hello
+
+: output-start-routine
+  current-offset L' start set-label
+  1 :rax mov-reg64-imm32
+  1 :rdi mov-reg64-imm64
+  origin L' greeting use-label + :rsi mov-reg64-imm64
+  L' greeting-size use-label :rdx mov-reg64-imm64
+  syscall
+  60 :rax mov-reg64-imm32
+  0 :rdi mov-reg64-imm32
+  syscall
+  ;
+
+: output-greeting
+  current-offset dup L' greeting set-label 3unroll
+  s" Hello, Irenes!" packstring
+  current-offset 4 roll - L' greeting-size set-label ;
+
+~ (output memory start, current output point
+~  -- output memory start, current output point)
+~
+~ Everything directly called by all-contents has this same interface.
+~
+: all-contents
+  elf-file-header
+  elf-program-header
+  output-start-routine
+  output-greeting
+  current-offset L' total-size set-label
+  ;
+
+' all-contents entry-to-execution-token label-loop
+swap sys-write bye
+