Close

Fixing Functionality

A project log for Fungesector

A Befunge-93 interpreter which runs on x86 real mode

louis-paulLouis Paul 10/23/2024 at 01:440 Comments

This weekend I implemented the ~ (get character from user) and g (get call) commands, the PC horizontal wrap around and Ctrl-Break interrupt. I implemented the p (put call) too, but on this moment it isn't working correctly because this command can write new instructions on the playfield, so I'm debugging this command.

For the ~ (get character from user), I simply wait a keypress from the user and push the pressed key on the stack.

For the g (get call), I pop two values from the stack and use these values to calculate the playfield position to get the character on the cell and push it on the stack.

For the PC horizontal wrap around, I used a formula to correct the horizontal boundary when the PC exceed this boundary on the left or the right. I'm still thinking about how I can implement the PC vertical wrap around.

The Ctrl-Break interrupt to stop a running program was quite complicated to implement. There isn't much explanation about it on the internet, to implement this you have to overwrite the IP and CS of IVT (Interrupt Vector Table). In the end I implement this interrupt to just set the running loop to false to stop the running Befunge-93 code.

Discussions