Using #GNU as Assembler (not Assembly, but the Assembler) and ld Linker to spit out a working BMP gradient image.
Yeah, you read it right. I'm not using #Assembly to produce an image. I'm, instead, using Assembler directives and macros during compile-time to generate a binary file that happens to be a valid image (BMP) file.
File: tonishing.s (GNU Assembly file)
width = 320
height = 240
area = width * height
_begin:
.ascii "BM"
.int fileSize
.int 0
.int (_rasterdata - .)
_infoheader:
.int infoheaderSize
.int width # width
.int height # height
.short 1 # planes
.short 24 # bitcount
.int 0 # compression
.int 0 # imagesize
.int 11811 # xpixperm
.int 11811 # ypixperm
.int 0 # colorsused
.int 0 # colorsimp
infoheaderSize = (. - _infoheader)
_rasterdata:
n=area+1
.rept height
.rept width
byten=((n*255)/area)&0xFF
rn=(192*byten)/255
gn=(64*byten)/255
bn=(128*byten)/255
.byte rn,gn,bn
n=(n-1)
.endr
.endr
fileSize = (. - _begin)
File: run.sh (Shellscript)#!/bin/sh
clear
rm astonishing.bin
rm tonishing.o
as tonishing.s --64 -o tonishing.o
# The pun is _astonishingly_ intended.
strip -R .comment -R .note.gnu.property tonishing.o
ld -n -x -s -N --oformat binary --unique=.note.gnu.property -o astonishing.bin tonishing.o
magick identify -verbose astonishing.bin
I run the whole thing with... wait for it...
#nodemon!
That's right: the tool intended for #Nodejs hot-reloading, is being leveraged for GNU Assembly, which is itself being leveraged for compile-time instructions to produce a whole BMP image.
nodemon -e "s sh" --exec ./run.sh
While I have a #Codeberg account, it's under my personal name where I published old projects from
#GitHub, so I should do a second account for this pseudonym... but I'm not sure if this is against the Codeberg rules... So I'm posting the whole thing through a Calckey post instead.
#programming #devlog #dev #devhacks #quirks #codegolf #experiments #surreal #absurd