This is my first project here on Hackaday, I hope I did not forget something.
Yet Another Brainfck Project.
µfck is a minimalistic project and only a proof-of-concept that an individual can have a binary for the Arduino smaller than 1000 bytes. As the default Arduino IDE outputs a giantic blob of binary – without any usable content - always was a no-go for me.
The output binary only includes the C-initialization code, the Serial Communication initialization and the Brainfck Interpreter - which was also handcrafted by me. Nothing else, not even a C library.
Please feel free to comment, criticize and ask any questions.
Also see my story (added later) how µfck was created.
Then I compiled it to see in what size it comes out:
What? That’s hughmungus! That can’t be it.
The basic disassembly told me nothing what caused that giantic blob.
Adding the size optimization flag didn’t do much. 31 bytes saved. If I would add a little functionality that would kill the 1024 bytes.
ObjCopy it into Intel Hex will result in a minimalistic 30 bytes, that’s impressive for hex in text.
But extracting it into binary is even better!
2 bytes is more my league!
Taking a look at the hex output:
On which 08 95 is the return oft he main function. So I guess it works.
The next steps were a little bit more complicated, as I wanted Serial Communication for my Brainfck Interpreter. So I copied all relevant code and munched it together, resulting in a really small bunch of code.
(It works :)
After the Serial Communication was working, I went on to build the Brainfck Interpreter. But at first I wrote it for the x86 Architecture to have faster builds to test. I took a look at Wikipedia on how these ‚Opcodes‘ work. After a few minutes I came to the famous ‚while‘ opcode, which is a little more complicated. I used a stack for the while-calles, as I like the CPU-way of doing stuff (me, as a mostly low-level developer).
(Basic Example Debug Output for Testing)
After flashing my final results, I wanted to cry:
But after I remembered that there were a whole bunch of non-PROGMEM Debug String, I took them out and flashed it..