-- Leo's gemini proxy

-- Connecting to gemini.ctrl-c.club:1965...

-- Connected

-- Sending request

-- Meta line: 20 text/gemini

A little trick invented by the devil.


Hi! As a kid I mostly went to catholic school so my thinking is influenced by those early experiences. The following will probably read as heresy so I apologize if I offend you, keep in mind my email is listed on my homepage and you can use it to send me insults.


The white page is the invention of the devil.


It's a mockery, it taunts you into creating while knowing that whatever you make will be lesser than the infinite possibilities available, it will draw you in and suck you dry of creativity, it will make hours seem like minutes. If idle hands are the devil's tools then the white page puts them to work.


Of course this is me being melodramatic and unable to make choices!


A long time ago, about 8 months according to the file time of creation, I started writing a tiny VM based on the pic16f84a called Toyboxica.

The idea was simple, toyboxica would be an 8 bit vm using 4 bits for the opcode and 12 bits for operand for a total of 13 instructions with 4096 bits of ROM and 4096 bits of RAM with only 4 registers: W, A, STATUS and CARRY (no indirect addressing wooow so revolutionary!)


The following may not be screenreader friendly, I'm awfully ignorant in this subject and I'm sorry for putting the burden on the reader but do tell me if this reads like crap.

The instructions were defined as:

MOVWF w->f

MOVFW f->w

SWPAW w<->a

MOVLW k->w

SUB (w-a)->w

ADD (w+a)->w

NOT (!w)->w

AND (w&a)->w

OR (w|a)->w

JP a,w->program-counter

SKIPIZ skip if Zero flag in status was raised

IN in->w

OUT w->out


With f being "an address in RAM" and in and out meaning read a character from the terminal or print a character to the terminal.


I wrote a little C emulator and I wrote, by hand, a few programs to try it out... it's bad or at least I didn't like it. It was awkward to use sooo new idea!


toyboxica 2.0:

MOVWF w->f

MOVFW f->w

MOVLW k->w

NAND (!(w&f))->w

JP w->program-counter

SKIPIZ

IN in->w

OUT w->out


The idea here was to replace all the arithmetics with NAND operations... to be completely honest this was less of an attempt to make something usable and more of me having fun after the really unfun "writing programs by inputting hexcodes"-time.


After doing this I got some vacation time and I didn't touch the idea for some time until I found uxn by 100 rabbits and inspiration struck again but I was implementing a, quite dumb, gemini server. The idea was to make a server with the bare minimum, no CGI, no polling, no nice things.

The server would only start, unshare itself from the filesystem, listen on the gemini port, negotiate the TLS connection, send the file/error message and no more.


The server is almost finished now and with some more free time due to dropping statistics, I have a tiny brain and online lessons are quite hard for me, I have started looking torwards starting toyboxica from "scratch" but with a clear goal.


Before I was making toyboxica without an idea of what I really wanted... now I think I know what I want.


The algorithms course I'm taking is mostly based on "The science of programming" a book by David Gries. In this book David defines a programming language he calls "small lang", a really basic, really small language.


So I got this idea of making a compiler for small lang but not for ARM or x86 since, as I have mentioned before, my brain is quite small and those instruction sets are quite big!


So what if I made a small vm with a small instruction set tailored to the needs of small lang and easily portable to other systems, wouldn't that be fun?


Home

-- Response ended

-- Page fetched on Sun May 19 03:19:14 2024