From 0c7e96417a3691f59807243a9841c6f5e631edfa Mon Sep 17 00:00:00 2001 From: Irene Knapp Date: Thu, 7 May 2026 17:57:28 -0700 Subject: refactored the label code and ELF template into their own files nice, right? :) modular programming! :D Force-Push: yes Change-Id: I56dd219fd2147850a0bb5b4a8cb3f9760e787215 --- hello.e | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 hello.e (limited to 'hello.e') 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 + -- cgit 1.4.1