▲ 42 r/EmuDev

Finally my NES emulator on python can run some NES games after 5 days of fixing stuff. (~50 FPS)

I've found some insane optimization tricks that makes it possible for standard Python 3.11.9 to run NES CPU at PAL speed.

The project here: https://github.com/windowssandbox/NESemupy

I'll make more mappers and APU and fix PPU acting weird later. (It currently has NROM and ""broken"" MMC3 mappers)

Also can someone tell me why SMB2 crashes like that? because I've been trying to find a way to fix it but it won't go away. It must be a problem with how PRG rom is mapped for MMC3 ROMs or PRG bank switching for MMC3 ROMs is not working properly.

u/windowssandbox — 20 hours ago
▲ 95 r/EmuDev

I was developing an NES emulator on Python, but Python is just too slow for NES CPU.

Yes you've heard the title AND watched the video.

You saw what was being printed in the logs.

I kept hearing people saying "Python is very fast, it will never be slow since it runs on your CPU's speed", oh but in this project, Python's speed is the problem.

The reason why it's the problem because when it's executing emulated 6502 assembly opcodes in emulated, it actually takes thousands of my CPU's cycles to execute a SINGLE opcode.

Your first response might be: "Just optimize the code to make it run faster". Yeah that might be helpful but the code is optimized to the maximum. I tried everything, and every optimization I could think of, it won't speed up.

Let me share you what my CPU actually is, it is Intel(R) Core(TM) i5-7500 CPU running clock speed at 3.40GHz to 3.75GHz (overclocked speed).

But the most frustrating about Python is that it is slower at emulating NES CPU than SNES does. If you've never seen an NES CPU being emulated inside SNES, then do google search "ACE super mario bros on super mario world" and see for yourself.

My guess is that Python's pre-compiled C code is truly unoptimized.

I'm not gonna continue until I figure out how to make it run NES CPU NTSC speed. Does anyone have ideas? Tell me. I've spent 2 days on this project.

Here is my github repo if you want to look at code I wrote: https://github.com/windowssandbox/NESemupy

I'm guessing that experienced C developers will understand Python code.

Edit: I did lookup table trick and it sped up to 16 FPS.

Edit 2: The profiler is right here: https://github.com/windowssandbox/NESemupy/blob/main/profiler.log (it updates overtime once i optimize the code)

Edit 3: I'll post when the emulator is finished, but right now I'm dealing with invisible CPU opcode bugs. (also it's now ~36 FPS)

Edit 4: It runs at ~57 FPS now, so no need to profile it.

u/windowssandbox — 6 days ago

Showcase of my horror mod (endishere.jar)

(Warning: one scene contains loud noise which is the "Jumpscare warning here." part)

I'll release the horror mod when I hit version 1.0.0, currently I'm at 0.7.0

u/windowssandbox — 14 days ago

Flower pot under the villager house's entrance?? That is weird.

Saw this while testing my horror mod.

Here seed: 2901880604700650010 (for minecraft 1.21.8)

(My horror mod does not alter world generation)

u/windowssandbox — 16 days ago

My local minecraft server is just acting weird.

Let me start by providing what version my minecraft server runs on and my computer specs:
Version: Latest Release (server runs on Java 25 + my friend connects to my server through server address that i hosted on playit tunnel , I'm connected to my server through localhost)
RAM: 16GB.
Processor: Intel(R) Core(TM) i5-7500 CPU @ 3.40GHz (overclocked to ~3.71GHz).
GPU: Intel(R) HD Graphics 630, DirectX version: 12 (FL 12.1) , can run OpenGL.

Okay so, right in the beginning of after server booted up, the server experienced multiple entity tick lags, for a while before it stops lagging.

So after 1 hour, the weirdest thing happened that I've never seen before in minecraft.

When i placed a chest on 2nd floor of "our" house, i realized that i placed it in wrong position, so i tried breaking it but it disappeared (i didn't even finish breaking it), Then i went outside to get more wood, and right after i broke one log block and picked it up, the chest block appeared next to me out of nowhere on the ground facing me. Like where did it come from?

After that shortly, I tested /tick rate 100 and it works just fine without lagging.

So, is this normal? If not then do I have to tweak server settings?

reddit.com
u/windowssandbox — 25 days ago

I just had the worst nightmare today (Arachnophobia 2.0)

In first part:
I had to survive fnaf amatronics, the amatronics are glowing their own color, while in the Rooms (DOORS) and they just act like Rooms entities. oh and theres only 4 bros from shiloh&bros. i had to survive WITH them.

After multiple rooms, we reached a restroom where it's safe in there, there are 2 double-tall-beds on left and on the right. so we had to take a rest.

After we took a rest, we proceeded to continue the Rooms.

and then suddenly all fnaf amatronics rush right to the current room, but as soon as we reached there, they ran out of power.

this is weird, but me and 4 bros ended up helping them.

then i proceeded to continue the Rooms myself, since they told me they're gonna find a way for the amatronics to charge back.

Here comes the second part:

multiple very few rooms later, theres my real life living room with lights turned on, but on the wall next to the frame to the hallway, theres a big black hair that flew to that wall.

After it landed on the wall, it started transforming... into the most tallest spider in the world (measuring ~1 meter tall), it had 4 thick legs with only a ball on top that 4 thick legs are connected to, the 4 legs extend diagonally just few centimeters then curves down shortly and then extend down to few centimeters just before the wall, it then curve back up for few centimeters, which made it look like it's standing on and sticking to the wall at same time.

Trust me, the arachnophobia i had when i was young was already gone forever, but the sight of that spider literally terrified me to the maximum. now i have fear of tall spiders.

It just stood there on the wall and did nothing, while i just kept freaking out, until the dream ended and gave me 10-second heart attack.

Dude that spider literally looks like a backrooms entity.

If someone with arachnophobia sees that spider in their dream, they are going to wake up with 1-minute heart attack.

reddit.com
u/windowssandbox — 28 days ago

New number pattern I created (it's just 2^n exponent but special one)

Let me try to describe what the sequence is:
1- starting from 1, normally put 1-digit numbers of 2^n, until just before you meet 2-digit numbers of 2^n.
2- in the 2nd digit of 2-digit numbers of 2^n, do <step 1> for each of them, until just before you meet 3-digit numbers of 2^n (and include normal 2-digit numbers of 2^n).
3- in the 2nd/3rd digits of 3-digit numbers of 2^n, do <step 1> with base digit of <step 1> increased by 1 for all of them (and include normal 3-digit numbers of 2^n).
4- in the ones/tens/hundreds places of 4/5/6-digit numbers of 2^n, start from <step 1> to end of <step 3> for all of them (and include normal 4/5/6-digit numbers of 2^n).
5- starting from 1st 7-digit number of 2^n.. start from the very beginning of <step 1> all the way to the end of step 4, do that for all 7/8/9-digit numbers of 2^n (and include normal 7/8/9-digit numbers of 2^n).
6- well this patterns goes on forever, 10/11/12-digit numbers of 2^n, 13/14/15-digit numbers of 2^n, and so on...

Here is the actual sequence (starting from 1 to 2000001): https://pastebin.com/B6BSpA9r

(Upon analyzing the numbers in the list I created, I noticed that there are multiple patterns created in the process)

reddit.com
u/windowssandbox — 29 days ago
▲ 13 r/nes

I beat this game without knowing Japanese. (Aa Yakyuu Jinsei Icchokusen)

u/windowssandbox — 1 month ago

Youtube somehow still consumes 5GB of my limited internet at 360p quality daily.

(PS: 360p quality is fine for me (my internet speed is ~20 Mbps) cause I want to save my limited internet data) (Wishing there will be unlimited internet in my country one day)

It wasn't even spending THAT MUCH during early days, is there a leak of internet usage in the background?

This causes problems with my relationship between me and my family, my dad just said that I'm spending 15GB everyday, but all I do is watch some videos (at 360p quality) and be active on reddit just a little.

And according to my calculations of usage in 2nd screenshot (last 24 hours), you need to watch yt videos (strictly at 360p quality) for ~20.5 hours in order to waste 5GB of internet (i watch only 3 hours of yt videos daily).
Did youtube just increase bitrate or something?

If i compare daily usage of my internet between early days and now, we get a very big difference:
early days: ~1.5GB daily
now: ~5-15GB daily

I have quota internet of 140GB, and charging it now costs 300 EGP (wtf?? that's like ~2.142 EGP per 1GB,, NORMALLY in early days it was like ~0.5 or ~1 EGP per 1GB)

How come other countries get unlimited internet except for country that I live in?

If you read this post to the end, then you'll realize that I'm probably ranting.
If you don't know what "early days" I'm talking about, it's about days/months/years before year 2024.

Edit: my dad just told me to use 144p quality (bruh)

Edit 2: The auto setting doesnt set quality higher than 360p

u/windowssandbox — 1 month ago

Ace Attorney, but The Judge has dementia.

(Recommended to turn on sounds when watching this)

Created on objection.lol

u/windowssandbox — 1 month ago

Apparently this is what happens when a program creates a file inside Recycle Bin. (HOW)

(The .bak file is created by HxD once I opened "test.txt" inside HxD)

It shows that the .bak file has been deleted ~126 years ago.

(In 2nd screenshot, I added 00 00 then saved the file)

u/windowssandbox — 2 months ago

I somehow noclipped out of the map in Hall of Tortured Souls inside MS Excel 95.

Imagine if this is ARG lol.

Anyway it looks kinda creepy there, im wondering if there's gonna be farlands out there.

If you're asking how I noclipped out of map, well i just noclipped through the big red wall inside hidden passage when i fell down at the end.

u/windowssandbox — 2 months ago
▲ 57 r/windows

I somehow noclipped out of the map in Hall of Tortured Souls inside MS Excel 95.

Imagine if this is ARG lol.

Anyway it looks kinda creepy there, im wondering if there's gonna be farlands out there.

If you're asking how I noclipped out of map, well i just noclipped through the big red wall inside hidden passage when i fell down at the end.

u/windowssandbox — 2 months ago

pyasm - Custom assembly language with VM all inside python (my side project).

Well, here's my repo, you can read the README md file to know about pyasm: https://github.com/windowssandbox/pyasm

You can make games on it too, but i'm trying to find a way to make an instruction that listens if you are holding a specific key (from your keyboard) on that cycle.

(i've actually noticed that some of instructions in my pyasm's instruction set are from 6502 or RISC-V or Intel Processor and they all do the same thing. so is this like multi-assembly?)

And don't confuse buffers with registers (they are different, and there's buffer overflow error).

So, i'm guessing this is the subreddit's first time seeing a VM assembly coded inside python instead of C/C++

I'm gonna add some example codes tomorrow after i come back from exam finals, the final school day.

Alright, what do you think of my (probably) complex project?

reddit.com
u/windowssandbox — 2 months ago

My mental health is probably glitching out for no reason

Ok im getting tired of these depression episodes that come out of nowhere without any reasons, every single day.

Look, I don't need to go to therapy because these depression episodes pop out of nowhere without any causes, and there's emotional numbness included. Another reason is that I live in Egypt and there are only very few therapy buildings that are far away.

But trying to find the reason to why my mental health glitches out like this makes the episodes more numby, it's like feeling empty, like my brain suddenly forgot how to be happy.

These episodes can last for ~30 minutes up to ~2 hours, but it seems like the duration of these episodes are starting to get longer. At this point I don't even care anymore, im just accepting the reality, not thinking of any way to escape it or else it'll make it more painful.

Attempting to figure it out is a fail too, it's not worth trying to figure it out anymore. I wish I had a dream where there is my subconscious in its physical form standing there, and wanted to ask it to fix these mental health glitches, like im supposed to file a bug report on my mental health real quick before it gets worse, but seems like i have no choice but to wait for that dream to happen. There is actually no way for me to have lucid dreams and just spawn subconscious in. Im probably gonna guess that it'll be just shadowy figure with white eyes just friendly.

Im just venting my thoughts here, no big deal, you can still comment if you want to. So, what do you think?

reddit.com
u/windowssandbox — 2 months ago
▲ 11 r/EmuDev

I built a custom assembly language / emulator (along with virtual CPU, RAM, PPU, and ROM) on Python. (pyasm)

Full information about pyasm can be found in README of my repo: https://github.com/windowssandbox/pyasm

Since I've added PPU yesterday, I'm wondering if making games on it is possible (like ping pong for example).

It's currently just 8-bit.

I'm gonna add more stuff to PPU and instruction set later. (instruction set opcodes are ordered based on when they are added)

Now the question is: how accurate is it compared to actual assembly?

(you can share your own pyasm code below)

u/windowssandbox — 2 months ago

Another security update but this time it keeps doing this:

I'll just put the screenshot in comments section, it's just update screen but keeps saying:

&gt; Something didn't go as planned.

&gt; No need to worry--undoing changes.

&gt; Please keep your computer on.

Has anyone had this problem on their windows 11 before?

My windows 11 build is the 2025 april fools build (it has a 2026 preview update pending).

reddit.com
u/windowssandbox — 2 months ago

I just built an entire simple assembly (6502 assembly styled) VM inside python that you can run without installing any packages. it only uses one built-in package which is sys , i call it pyasm

The instructions list and the pyasm script itself can be found in the github repo below:

https://github.com/windowssandbox/pyasm

If you want to run your own assembly code, download pyasm script file, open it on any editor you use, scroll down until you see code list variable, then edit it. (but before writing your code, you'll have to edit the rodata and bss structure)

To run the your pyasm code, open terminal on same folder as where you downloaded/moved the main py file, and run this:

python pyasm.py

(or just open pyasm script file)

The simulated CPU is protected by the way, so it'll halt when you try to JMP to same PC, or it'll print error when an invalid instruction is executed and more.

And in the #modifiers section, you can expand/extend rodata_size or bss_size, as well as enabling debug_mode which lets you see CPU registers and what instruction ran.

Apologies if the script is literally filled with if/elif/else conditions.

I'm curious to see if you can run graphical version of bad apple on pyasm. You can share your own pyasm code in comments section (but make sure it's easy to read just like the example code).

reddit.com
u/windowssandbox — 2 months ago