This is for learning and fun. I restrict myself to actual syscalls and RiscV 64bit. All written for the GNU-as.
Currently implemented: cat, mandelbrot
.
This code creates a buffer, injects a BMP header, generates an RGB palette table and computes a mandelbrot graphic
to be written as a BMP file in 2048x1024 pix as default. You can provide two integers as command line arguments for a specific x y size (new ATOI() asm code).
./mandelbrot 8192 4096
takes 10 seconds on my VisionFive2.
-> 708 Bytes
.
This tool comes in several flavors, in order of creation/complexity.
Reads/writes into 1K buffer repeatedly over file, over all files
-> 800 Bytes
with C-ext: 768 Bytes
uses mmap syscall to fetch each input file as a whole at once and then write it out, over all files
-> 760 Bytes
with C-ext: 696 Bytes
Same as cat_mmap_full but includes its own minmal(ish) ELF64 header
-> 352 Bytes
with C-ext: 288 Bytes
- maybe add error handling to cat family
- mandelbrot using fork()
- compressed instructions don't take
x0
as second argument formv
anymore. - GNU-as translates
mv a0,zero
intoli a0,0
but will NOT compress it. Useli a0,0
straight away.