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.

Learn how to write an emulator

487 pointsby dreampeppers99almost 7 years ago

12 comments

sehuggalmost 7 years ago
The Space Invaders (Midway 8080) platform described here is really easy to emulate; it&#x27;s just a 1-bit frame buffer hooked up to a CPU. Subtracting the CPU emulator, my implementation on <a href="http:&#x2F;&#x2F;8bitworkshop.com&#x2F;" rel="nofollow">http:&#x2F;&#x2F;8bitworkshop.com&#x2F;</a> takes less than 200 lines of code. One of the easiest with which to get started.
评论 #17627105 未加载
评论 #17635935 未加载
评论 #17629030 未加载
评论 #17626967 未加载
kstenerudalmost 7 years ago
A long time ago, I wrote a 68000 emulator in C to replace MAME&#x27;s x86 assembler core. After months and months of poring through my old Amiga programming books and the Motorola manual, I still remember clearly that moment where I fired up the emulator, and actually SAW the title screen of Rastan Saga come up after the game booted from my core. Truly a magical experience...<p>After that, I doubled down and wrote a g65816 emulator for it (that&#x27;s the CPU the SNES and Apple IIgs used). Emulator writing is almost a zen-like experience.
评论 #17630260 未加载
alok-galmost 7 years ago
&gt;&gt; Want to really learn how a CPU works? Writing an emulator is the best way to learn about it.<p>The best way to learn how a CPU works would be to write a CPU! I.e., write HDL code for it and test in a hardware simulator.<p>I have designed a miniature application-specific processor, a compiler* and IDE for it, a disassembler, and an emulator too.<p>* To be more precise, I hacked a compiler for it using C# .net compiler.
评论 #17626585 未加载
评论 #17629204 未加载
评论 #17628743 未加载
评论 #17627851 未加载
z3phyralmost 7 years ago
Implementing an emulator is similar to writing an interpreter and imo more rewarding in certain cases.<p>Start with CHIP-8, it&#x27;s the gateway drug to others.
评论 #17626235 未加载
评论 #17627747 未加载
grawprogalmost 7 years ago
I wanted to learn SNES assembly once, but I found the actual limitations of the SNES frustrating, do I made my own 24-bit virtual machine and basic assembly language. I was getting confused with how to implement interrupts so I took a look at an open source gameboy emulator....turns out without really knowing what I was doing I had written an emulator.<p>That was really awesome to work on though. I probably learned more working on that than anything else. It was the first time I really felt like I understood entirely how a computer actually works.
kodablahalmost 7 years ago
I want to learn how to write an emulator that is not an interpreter and still keep it timing accurate (even if not completely cycle accurate). I haven&#x27;t dug, but some of the ones for modern machines seem to compile instead of interpret yet I don&#x27;t know how they handle timing.
评论 #17626881 未加载
评论 #17627428 未加载
13mtfbalmost 7 years ago
If you&#x27;re interested in processor emulation, here&#x27;s a really cool one done in HDL for the pdp 11&#x2F;70: <a href="https:&#x2F;&#x2F;wfjm.github.io&#x2F;home&#x2F;w11&#x2F;" rel="nofollow">https:&#x2F;&#x2F;wfjm.github.io&#x2F;home&#x2F;w11&#x2F;</a>
bahmbooalmost 7 years ago
This is pretty much about writing a cpu emulator. A system emulator is much more complex even as far back as a gameboy or Sega genesis. I think there is still great value in writing your own cpu emulator as described in the article.
评论 #17629158 未加载
jweatheralmost 7 years ago
If you like writing small emulators, try the Synacor challenge and&#x2F;or ICFP 2006. Extremely challenging puzzles, and both start with writing a simple emulator.
ameliusalmost 7 years ago
Does this address optimizations, as seen in LLVM and JIT compilers?
评论 #17628303 未加载
wpdev_63almost 7 years ago
too bad it&#x27;s in objective-c :&#x2F;
评论 #17628103 未加载
评论 #17638277 未加载
lin0tunealmost 7 years ago
<a href="http:&#x2F;&#x2F;www.emulator101.com&#x2F;logical-operations.html" rel="nofollow">http:&#x2F;&#x2F;www.emulator101.com&#x2F;logical-operations.html</a><p><pre><code> &#x2F;* Example 2: turn on one LED on the control panel *&#x2F; char * LED_pointer = (char *) 0x2089; char led = *LED_pointer; led = led | 0x40; &#x2F;&#x2F;set LED controlled by bit 6 *LED_pointer = led; </code></pre> Really?
评论 #17627694 未加载
评论 #17626494 未加载
评论 #17626493 未加载