Show HN: I built an 8-bit CPU simulator in Python from scratch
18 comments
·October 24, 2025noobermin
Just a note, it's very clear the OP's associated account was an attempt at an AI managed account created for HN 5 days ago, looking at their post history and their single comment. I'm not sure about this post in particular but it is strange that you have a full 8-bit CPU simulator with no history older than 4 days ago, full with comments on each function. It's likely this "CPU simulator" is AI-generated and in fact not from scratch. Of course, it's possible you had a rather polished, from scratch project the OP polished on their own PC before uploading to github. That said, their first post already cast some doubt.
I'm not sure if this is in the spirit of "Show HN" because really anyone can do this.
parados
Sort-of agree, but then I saw this code in the Visualiser[0]
try:
import matplotlib.pyplot as plt
except Exception:
plt = None
class Visualizer:
def animate_combined(
# Stuff...
):
# Stuff...
try:
import numpy as np
except Exception:
print("numpy is required for animation")
return
if plt is None:
print("matplotlib not available - cannot animate")
return
Is AI really that bad? Or has it been written by a human?[0] https://github.com/sql-hkr/tiny8/blob/main/src/tiny8/visuali...
Mumps
Other giveaways like insistence on
`from typing import List`
(I'm yet to see a model be trained on modern-biased python enough to not bother with that import)
quibono
Wait, is `List` to be avoided now? I'm behind the times then. I figured it was still the preferred type hint over `list`.
85392_school
AI is penalized for any and all emitted errors through RL, so this kind of carefulness is actually a strong sign of AI.
noobermin
I mean, it's not impossible to get bad AI code, no?
Anyway, as I said in a comment below, Show HN already has vibe-coded projects in it, much less merely AI assisted works, the problem here is the title that says it is "from scratch" which most readers would assume means it is written by hand.
rf15
The whole <low level/high performance software in python> is a dead giveaway for AI project/farming.
edu
Agree, I was checking the code and the first thing that I notice were the extremely detailed doc comments even for simple methods. i.e. the memory[0] class.
0. https://github.com/sql-hkr/tiny8/blob/main/src/tiny8/memory....
Lerc
Is this an example of https://xkcd.com/810/ ?
If you want something done by hand, I made kind-of the same thing in JavaScript ages ago. (actually, no I just looked and I made the emulator part in Haxe)
https://k8.fingswotidun.com/static/ide/?gist=ad96329670965dc...
You can load programs from gists. Save to local storage, maybe some other features, it's been a while.
Assembler is at https://github.com/Lerc/AvrAsm Emulator is at https://github.com/Lerc/kwak-8
[Edit] Taking a look at the other posts, I think that the user is using AI, but also sincere in their intention of learning by making things. You will get people at all skill levels posting to Show HN: So I don't necessarily think it's a bad thing that they are posting something that doesn't require a lot of skill. Some of these beginner efforts are quite well received.
AI moves the bar somewhat, for what a beginner can do. In an ideal world, they would also clearly indicate their methods to avoid confusion or making people feel like they have been tricked. In their defence, this too, is an attribute of beginners. They have yet to learn the expectations of the community.
It get's even more complicated with AI of course, because the expectations of the community on this are rather in flux right now. To an extent, we're all beginners when it comes to what can be made with AI, how to use it, and how to present it.
noobermin
To be clear, my main issue, if any, is the misleading headline. People have posted Show HN things they've used AI to help build (partially or completely). However, saying this is from scratch if it isn't is straight up lying. Moreover, the fact that this is on the front page is likely due that claim, so the reality of it is important context for readers, I imagine.
Lerc
It seems this was posted while I was editing my comment. Essentially I agree, but feel like you have to make allowances for beginners in both coding and in how they conform to community expectations.
I can see how someone using AI would consider something made from scratch differently. Similarly, in the past using a batteries included language wouldn't have counted as from scratch to someone who had to write most of their support code themselves. Go back further and you'll probably see people considering the idea of using a compiler written by someone else as not from scratch.
Unless you want to go full NAND to Tetris, the notion of from-scratch is contextual. Maybe it's shifting under our feet.
fortran77
Is there really any value to a fake HN account? What’s the motivation?
cluckindan
Karma farming for future nefarious uses
alienbaby
Nice. I wrote something exactly like this to simulate a CPU with an instruction set and registers that were extended beyond general purpose instructions to include op codes to read board state and generate moves for a game of go. That then became the core of a system setup to use genetic algorithms to try and 'breed' go playing programs.
It didn't produce anything close to a competent go playing program, but it did get to the point it would play legal moves, which considering I started it with a purely randomly generated population of programs, it had zero built in knowledge of the rules of go, and had it playing against a well known open source go playing program to assess fitness of a given pop, I was quite pleased with it.
This was around 10+ years ago, just as Google made alphago.
csmantle
This is a single-cycle, architecture-level simulator with no microarch details or "complex" features (privileged infra, mapped memory, etc). But it is a good starting demo.
BTW, why invent Yet-Another-Toy-Arch(tm)? If a more established architecture is used, existing toolchains can be utilized to produce images for running. Many popular RISC ISAs have "simplified" editions which are void of many complex features, so they hardly need more efforts to implement with respect to this one.
msarnoff
Instruction set looks very similar to the AVR, which is one of my favorites. Very cool!
Lerc
https://github.com/sql-hkr/tiny8/blob/main/src/tiny8/cpu.py
says
>A simplified AVR-like 8-bit CPU simulator.
>This module provides a lightweight CPU model inspired by the ATmega family.
dd_xplore
AI slop
I built a tiny 8-bit CPU simulator in Python to better understand how computers work at a low level. It visualizes registers, memory, and instructions in real-time, so you can actually see each operation as it happens. You can write simple assembly code and watch how the CPU executes it step by step.
The project is mainly for learning and experimentation, but I’d love feedback or ideas for improvement.