TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Comp Mark II: Simple 4-bit/1 Hz Virtual Computer

34 pointsby jsnathanover 9 years ago

3 comments

userbinatorover 9 years ago
The architecture looks simple enough, but when I saw the source...<p><a href="https:&#x2F;&#x2F;github.com&#x2F;gto76&#x2F;comp-m2&#x2F;tree&#x2F;master&#x2F;src" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;gto76&#x2F;comp-m2&#x2F;tree&#x2F;master&#x2F;src</a><p>...that&#x27;s quite a bit more code than I was expecting.<p><a href="https:&#x2F;&#x2F;github.com&#x2F;gto76&#x2F;comp-m2&#x2F;blob&#x2F;master&#x2F;src&#x2F;specific_instruction.hpp" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;gto76&#x2F;comp-m2&#x2F;blob&#x2F;master&#x2F;src&#x2F;specific_in...</a><p><a href="https:&#x2F;&#x2F;github.com&#x2F;gto76&#x2F;comp-m2&#x2F;blob&#x2F;master&#x2F;src&#x2F;specific_instruction.cpp" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;gto76&#x2F;comp-m2&#x2F;blob&#x2F;master&#x2F;src&#x2F;specific_in...</a><p>IMHO this is a good example of how OOP can obfuscate. Over a dozen classes, all almost the same. This could easily be condensed into a single lookup table.<p>For comparison, here is a complete 8086 emulator, and it also includes some code to emulate other hardware of the PC:<p><a href="https:&#x2F;&#x2F;github.com&#x2F;adriancable&#x2F;8086tiny&#x2F;blob&#x2F;master&#x2F;8086tiny.c" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;adriancable&#x2F;8086tiny&#x2F;blob&#x2F;master&#x2F;8086tiny...</a>
评论 #10327431 未加载
评论 #10327680 未加载
Narishmaover 9 years ago
That looks to be an 8-bit CPU. It has an 8-bit accumulator and instructions are encoded in 8-bits. The only 4-bit thing in there is the address space, but even that is really 2*4-bits.
cbd1984over 9 years ago
I wonder why the Makefile builds everything with -O0
评论 #10327681 未加载