125 bytes of Christmas Fun. 🎄 My work for Vintage Computing Christmas Challenge 2023 (VC³ 2023).
After the break for 20 years of ZX-Spectrum assembler coding or so, I decided to make the first attempt of 'sizecoding' for x86 architecture on assembler under Linux. Here is 125 bytes of Christmas vibe for your enjoyment, where 36 bytes is a tiny ELF header (Executable and Linkable Format), others 89 bytes are a machine code. But actually 4 bytes from the header also used as register load. So 93 bytes of CPU commands total. Placed at 118th of 228 in challenge results.
Run a binary with ./vc3_alx
command and fire-up a Christmas candles! 💫
You can also install nasm and build them from code:
apt install nasm -y # or yum, pacman, etc...
nasm -f bin -o vc3_alx main.asm; chmod +x vc3_alx # compile them and set executable flag
./vc3_alx # to run
wc -c vc3_alx # to show total length of binary
This program used a mixed 32 and 16-bit CPU registry operations, syscalls and a few tricks. It also uses a very tiny 32 bit ELF-header to make this code possible to run under Linux systems. It was tested on a systems with a kernels versions from 4.4.0 up to 5.10.0, but if one day something will be changed and this binary becomes not-runnable you can compile them with a larger ELF-header and some additional commands inside:
-
Set up a nonstant in main.asm file for:
compatibility_mode equ 1
-
Compile and link them with an ELF header:
nasm -f elf32 -o vc3_alx.o main.asm; ld -m elf_i386 compatibility_mode_binary vc3_alx.o
Of Course the size of a binary will be very high, but you'll get a maximum compatibility.