hintron / computer-enhance

An 8086 simulator in Rust (built during Casey Muratori's Computer Enhance performance-aware programming course)
0 stars 0 forks source link

Fix snake game rendering #50

Closed hintron closed 8 months ago

hintron commented 8 months ago

After a few frames, the Snake game looks like this (macOS, but it's the same on Windows and Linux):

Screenshot 2024-03-21 at 4 44 19 PM

Things turn green, the top gets garbled, and the snake stops moving.

I used to have it so that the snake was continually moving left to right and then back around again. So that leads me to believe that perhaps I am messing up the softbuffer buffer somehow, and the underlying assembly is still good.

I need to step through this with the debugger to see what is going on.

hintron commented 8 months ago

It turns out that this was simply because I was running the snake regression, which was capped at something like 40k instructions. So I guess this was actually just the last image of memory as the regression exited. So there is no bug here.

I can run the snake game indefinitely with this command:

cargo run -- files/bin86/snake tmp.out --display-window --stop-on-int3 --verbose --fps > /dev/null

I do hit an issue where my Linux OS freezes up if I resize things too much while it's running, but I'll open up a separate issue for that.