Show HN: I built an 8-bit CPU simulator in Python from scratch
github.com
The project is mainly for learning and experimentation, but I’d love feedback or ideas for improvement.
github.com
The project is mainly for learning and experimentation, but I’d love feedback or ideas for improvement.
I'm not sure if this is in the spirit of "Show HN" because really anyone can do this.
0. https://github.com/sql-hkr/tiny8/blob/main/src/tiny8/memory....
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.
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.
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...
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.
`from typing import List`
(I'm yet to see a model be trained on modern-biased python enough to not bother with that import)
But it is outdated since 3.9+ over just `list` . Same for `tuple`, `dict`, and so on)[0].
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.
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.
says
>A simplified AVR-like 8-bit CPU simulator.
>This module provides a lightweight CPU model inspired by the ATmega family.