Mibi’s Website

Welcome to my web page!

Hello! I mostly code in C (or in Java to make GUIs). I rarely fully finish my projects, but I regularly reopen them to improve them further and maybe at some point I’ll have finished a currently unfinished project XD.

Articles

Good cable management isn’t optional (or is it?)
Making my website statically generated
Trying to port Micropython to Mega 2560 clones
Simple 3D rendering in Python

My youtube channel

Watch my videos here.

Games

Garbage collector's minion (Ludum Dare 58 jam) A small game where you are an allocator and the garbage collector asks you to perform some tasks. itch.io).

bootris A small 510 bytes (+2 byte magic number to make it bootable) clone of the famous video game with falling tetrominos written in 16bit real mode x86 assembly (unfinished, having some trouble to fit more code in it).

mushroom_champ A small game for the NES where one farms giant mushrooms (unfinished).

GOLD HUNGER (Ludum Dare 57 jam) A small game made with MibiEngine2 where you need to eat some minerals as fast as possible or you starve (play it on itch.io).

Tangris A game for the NES similar to the well known game with falling tetrominos, but with tangram pieces instead :D, written in assembly (not finished yet).

Lifeless A small puzzling platformer for the NES (not finished yet).

Antwars (Ludum Dare 56 compo) A small strategy game. (play it on itch.io).

Simple raycaster A very fast raycaster.

The seven crystals (Ludum Dare 55 jam) A dungeon exploration game where you fight mobs in procedurally generated dungeons. (play it on itch.io)

Solitude A small platformer for the NES (not finished yet).

Dino NES A dino game for the NES. (play it on itch.io)

MibiCraft A small sandbox building game (not finished at all).

MossyDungeon A speedrunning platformer where the floor breaks after some time. (play it on itch.io)

BREAKMOLE Whac-A-Mole + BREAKOUT for a twice as fun experience! (play it on itch.io)

MibiFlightSimulator A small unrealistic flight simulator.

CalcRace A small game to get better in mental calculation!

Neslib ship battle One of my first video games! It’s the first real program I wrote in C (the code is awful)

Tools

spinnyutils Small scripts to dump CDs and DVDs.

PhosphorEngine A small text adventure engine for the web powered by a very small RISC-V VM written in JavaScript.
I made it originally for the js13k 2025 jam, but didn’t finish it in time.

MibiEngineN A small engine (more a template) for the NES using the NROM mapper (unfinished).

MibiNES A small cycle-accurate NES emulator.

nes_opcode_tester A small utility to test the behavior of opcodes on the NES. It currently only supports testing immediate addressing mode opcodes.

zipgit Some shell scripts to create a git repository from ZIP archives.

MibiEngine2 My new game engine (if it can even be called a game engine) that uses OpenGL ES (but will be able to support other rendering APIs) and has very few dependencies.

HexSpy A native hex editor for the Haiku operating system written in C++ (not finished yet and requires a lot of refactoring).

HTML NES asm A small assembler to compile 6502 assembly into NES roms directly in a web brower (try it here).

lizylang A lisp dialect with lazy evaluation (not fully working yet).

md2bb A markdown to BBCode converter (unfinished).

MibiNESTools An IDE to make NES games.

MibiEngine A small game engine to code games in C for 20 year old computers. (not finished yet).
I recently created a repo from it, from all the zip archives I made while coding it, which made me create the zipgit scripts.

MibiMdEditor A Markdown editor using GTK4 written in Vala.

Libraries

delay A small retained mode GUI layout library and GUI toolkit (in a very early state).

liburt A small highly portable drop-in replacement for libgcc or compiler-rt (unfinished).
I started making it for PhosphorEngine, because I didn’t managed to get libgcc compiled for RV32I.

Mibitype A font loading and rendering library (in a very early state).

tinytiled A small library to load tiled maps in python.

CASIO calculator stuff

FxPyEdit A small python script editor for the Graph 35+e II calculators, which is meant to be better than the included editor.

Une réalité trop belle pour rester (prototype 2) A small platformer with realistic physics in a non euclidian world (that I haven’t implemented yet), which I haven’t finished.

Racer 3D A small wireframe game that uses my custom library, libMicrofx.

libMicrofx A small library that uses syscalls, which makes creation of really small add-ins easier.

What CASIOn't A small demo.

Collab RPG A RPG I contributed a lot to.

libSCII A small library to make RPGs (with ASCII art in a CLI) in python.

Builder A small Terraria/Minecraft in 2D clone, with atrocious code and horrible physics.

Random stuff

3D Pyxel demo Some very basic 3D. This small demo was made in ca. 6h without searching anything on the internet (but I fixed some bugs since, by searching the correct formulas online).

limg My image format that uses RGB565 colors (but it has no compression).

Recent articles

Good cable management isn’t optional (or is it?)

Mibi88

Tue, 11 Nov 2025

My PC’s cable management was until recently really messy. When rendering the time-lapse of my participation at the 58th Ludum Dare, I decided to tackle this issue as my computer was really noisy, which made the long hours of encoding a 3000×1920 video very painful, especially as it hadn’t finished before I wanted to go to bed. The issue was that my computer was vibrating a lot, which produced a lot of noise as it sits on my desk.

So I wired things nicely, except the EPS cable as it was too short, it still had to uglily run over the whole motherboard. I hadn’t connected my old hard drives back as I rarely use them, and the thermals had improved, even if I’d noticed that I had mounted my CPU’s cooler the wrong way around after having repasted it a while ago. Seeing this huge improvement I bought some fancy new individually sleeved cables from Corsair, as it’s my PSU’s brand, to have a longer EPS cable, an easier to bend ATX cable (actually it became really painful to let the new cable correctly on the back of the case while still being able to close it), and a PCI cable without the little daisy-chaining dongle.

Once I had finally managed to close the case and all the cables were wired nicely, I booted my computer ... and was very disappointed that it was noisy, as I had tested it before being fully done and everything was quite quiet, and the thermals were good as well. So I quickly noticed that before, I hadn’t connected the hard drives, and I found out that one of my hard drives was vibrating a lot. So I took it out of the computer and noticed that it was only held by a single screw—I really don’t know what I had thought when I had screwed it down with a single, with a unique screw! I added 3 more, but it was still vibrating a lot. The weird thing being, that the other one, which is older, is completely fine. I haven’t investigated it that much more. I didn’t know before that hard drives spin even if they aren’t mounted! So I tried to set a timeout after which they spin down, but it didn’t work, so I just disconnected them, as I rarely need them, and now everything is fine.

So actually I don’t really know how useful good cable management is (lol). A positive aspect is that my computer now runs a little cooler, after I repasted my CPU to put the cooler the right way around—what a dumb mistake!—and flipped my PSU upside-down, as I can mount it both ways around. I had let it take air in from the inside of the computer case before, which probably wasn’t a good idea, so I mounted it so that it takes the air in from under the computer, which should keep it cooler.

At least now it looks nicer, and it probably helped a little as I’d seen with my first try at improving the cable management, to keep it a little cooler.

Making my website statically generated

Mibi88

08/11/2025

GitHub Pages imposes a big restriction on how pages can behave as they need to be static, which can be quite inconvenient. To make my website easier to modify I was using some JS to load the articles in the main page. However, it was therefore limiting it to browsers supporting / with JS enabled, and it isn’t very scalable, as when there will be more and more articles, the website will have more and more articles to fetch and display. it was also quite annoying to write new articles or just update the project list as I had to write HTML, and I have an obsession of wrapping my code on 80 columns :D (actually 79) which doesn’t work very well when writing HTML.

That’s why I wanted to generate my website statically with a script. I wanted to write an article about how I struggled trying to fix my computer’s cable management, but I decided to fix my website first. Originally I wanted to use python and something else like markdown, but finally I used bash, sed and groff (it’s a bit cooler :D). I’m also calling LyX to convert the older articles. My script is still a bit messy, but it works nicely. It loads the lists of articles and “projects” (the sections where all my projects are listed by category, e.g., “Games” or “Libraries”, I don’t really know how to call them), where the paths and the IDs (for articles) or the titles (for “projects”) are separated by semicolons. The most recent articles are listed first. My script then walks through these lists and generates the HTML code with the appropriate tool. Then I use sed a bunch to remove all the superfluous HTML that would make the generated HTML invalid (when viewing the source code via Firefox, it seems to be unhappy with the header and footer, but that’s because my template HTML code itself is incorrect—I’m not writing HTML very often—and I didn’t know that <header> and <footer> must be inside <body>). Then I use sed again to replace {<name>} tags with the appropriate generated HTML, such as {article_list} which gets replaced with a list of links to all the articles. I should run sed over the articles and “projects” as well to replace curly braces with an escape sequence to avoid such tags to get replaced in the articles’ content, but I’ll fix that later. I’m also generating PDFs of the articles because I can (lol), but I don’t include them in the git repo. I’ve already an idea of a little Easter egg that I could add with a little bit of JS, but I’ll do it later.

So that’s how I statically generate my website without using a premade solution. In the end it took me way longer than I expected, but it was quite fun! roff is fascinating, maybe I’ll code my own implementation of it at some point....

Trying to port Micropython to Mega 2560 clones

Mibi88
03/10/2025
I just quickly wrote this article, so it is quite messy, and my English is not so good, so… sorry for that.
I had finished all the exercises very quickly in NSI class, so the teacher asked us, who had finished early, if we could try getting micropython working on mega 2560 clones to help him. I searched on the internet, and found that there was no port, and that it had really low specs. Later, when at home I was curious if I could make a port of micropython to it, as I knew it was easy from contributing to PythonExtra and it might be fun. I quickly set up a fedora VM to install all the AVR tools in (I don’t want to pollute my PC which such a useless toolchain as I have no such boards myself). I cloned the master branch and copy-pasted all the sample code at https://docs.micropython.org/en/latest/develop/porting.html. It compiled and I was able to run the build/firmware.elf file in a terminal. Now I needed to get it to build for the microcontroller. I added
CROSS_COMPILE ?= avr-
to the makefile and started fixing errors. I had to change
typedef intptr_t mp_int_t; // must be pointer size
typedef uintptr_t mp_uint_t; // must be pointer size
to
typedef long long mp_int_t; // must be pointer size
typedef unsigned long long mp_uint_t; // must be pointer size
in mpconfigport.h, because of a MP_STATIC_ASSERT that checks if sizeof(mp_int_t) == sizeof(long long), I don’t understand why, this is incoherent with what the doc says by saying that mp_int_t “must be pointer size”, but whatever…
Next I had to fix some issues with the libc and libm, as they lack some functions for some reason. It was quickly solved with some hacks.
Here are the messy things I had to do in mpconfigport.h
// HACK: Awful hacks with the types
typedef long long mp_int_t; // must be pointer size
typedef unsigned long long mp_uint_t; // must be pointer size

typedef long mp_off_t;
typedef long ssize_t;

// HACK: Really awful hack to get things compiling
#include <math.h>
#undef nanf
float __nanf(const char *tagp);
#define nanf __nanf
float __nearbyintf(float n);
#define nearbyintf __nearbyintf

// HACK: More awful hacks to get things compiling!
#define SEEK_SET 0
#define SEEK_CUR 1
#define SEK_END  2

#define STDIN_FILENO    0
#define STDOUT_FILENO   1
#define STDERR_FILENO   2

// NOTE: Actually IIRC those FE_* defines are useless
#define FE_DOWNWARD     1
#define FE_TONEAREST    2
#define FE_TOWARDZERO   3
#define FE_UPWARD       4
And here are my messy implementations of __nanf and __nearbyintf that I’ve just thrown in mphalport.c
float __nanf(const char *tagp) {
    return 0;
}

float __nearbyintf(float n) {
    return roundf(n); // It seems like mpy only uses it for rounding
}
I then added the following define to mpconfigport.h
#define MICROPY_GCREGS_SETJMP (1)
By the way at some point I also found https://micropythpn.readthedocs.io/en/docs-chap1/develop/porting.html at some point which was very helpful, because it listed a lot of flags. If I’m not mistaken at this point all the C code was compiling, but not linking yet: the .text section was overflowing. I had commented CROSS_COMPILE ?= avr- in the Makefile and it compiled and worked on Linux, so at least my quick and dirty hacks worked.
So I enabled LTO with -flto=auto and added -mmcu=atmega2560 to use the correct linker script. The .text section was still too full.
I then had to stop coding, and continue the next day: today.
I had some time this morning, so I tried the fix I had in mind: just adding -Oz to the CFLAGS. And it worked! …but I was now facing another issue: .data and .bss were full. So I tried disabling more and more features, removing all the useless platform-dependant things micropython links by default for some reason, writing the OBJ list by hand, only including what’s needed, but I didn’t got any of it working.
So I just give up, I don’t want to spend more time on this.
I hope all what I’ve written down in this article may help someone in the future, who also tries to port it to this board. If you want the code of my port attempt, please contact me. I won’t publish it publicly as it is a mess and I’ve done a lot of copy-paste from various places.

Simple 3D rendering in Python

Mibi88
05/05/2025 - Updated on the 10/11/2025
Recently I participated at a challenge, where in an evening we had 6 hours to make a game in Python 3 with Pyxel (it sucks). I really wanted to make some 3D because it’s more impressive than a simple pixel art 2D game and I saw that Pyxel has a function to render colored triangles. It also means that I can’t have any depth buffer (and I don’t know the formula for perspective correct interpolation so I would not have been able to do 3D rendering with a depth buffer anyway). I just sorted the triangles by depth (by calculating the average of the depth of the three points, maybe there is a better way to do it, but I don’t know any) with some selection sort (maybe insertion sort may have been better, or maybe it isn’t because it doesn’t always take the same time so maybe the framerate would have been less consistent). Some formulas are also required to render 3D (I didn’t used matrices because I haven’t seen them at school yet: I’m still very young, and the little I know about them, because I use matrices in MibiEngine2 would not have been enough). So I used some formulas I found on the web a long time ago (it isn’t online anymore but it got archived by the Wayback Machine: https://web.archive.org/web/20220625104937/https://www.mfitzp.com/creating-a-3d-rotating-cube-with-micropython-and-oled-display/ EDIT: Actually it is still online, the URL has just changed: https://www.martinfitzpatrick.dev/creating-a-3d-rotating-cube-with-micropython-and-oled-display/), but the formula for projection isn’t correct and I didn’t implemented one of the rotation formulas correctly: the rotation around the y axis. I really hate AIs because they’re crawling forges so intensively and require a lot of energy, but ChatGPT was really helpful here to get the formulas I needed. I also found one of them on Wikipedia for projection. I’ll share the formulas here because I found them very hard to find, and I may not be the only one that finds them useful.

Rotation

Around the  x  axis
y ' = y × cos θ z × sin θ and z ' = y × sin θ + z × cos θ . x ' = x because we’re rotating around the x axis
Around the  y  axis
z ' = z × cos θ x × sin θ and x ' = z × sin θ + x × cos θ . y ' = y because we’re rotating around the y axis
Around the  z  axis
x ' = x × cos θ y × sin θ and y ' = x × sin θ + y × cos θ . z ' = z because we’re rotating around the z axis

Projection

One of the big advantages of using a projection matrix is having a near and a far plane, but I only knew a very approximate formula without it… Today I fixed it. Here is the formula I’m using now:
First I calculate the focal length, to use the formula from Wikipedia (https://en.wikipedia.org/wiki/3D_projection#Diagram):
f = w 2 × tan θ 2 with θ being the field of view (FOV for short) and w the width of the viewport.
Note: Pyxel doesn’t provide a tan function so I just used sin θ cos θ .
Then I applied Wikipedia’s formula to calculate the X and Y coordinates: x ' = x × f z and y ' = y × f z .
Note: make sure that z is non-zero, or you will get a ZeroDivisionError.

Conclusion

All those formulas are all you should need to render very basic 3D.
You can check the code of my little 3D demo here: https://github.com/mibi88/3d_pyxel/.
I hope it can help you on your journey making a very basic software renderer :).

Edits from the 10/11/2025

Fixed an orthography error, changed URLs to hyperlinks and added a link to the article’s new location.

All the articles

Good cable management isn’t optional (or is it?)
Making my website statically generated
Trying to port Micropython to Mega 2560 clones
Simple 3D rendering in Python