4 ms·
Every time I see an emulator like this on HN, my mind is blown. Can someone explain to me and any other run-of-the-mill hackers reading this, how an emulator l
by pud 13y ago
Every time I see an emulator like this on HN, my mind is blown.
Can someone explain to me and any other run-of-the-mill hackers reading this, how an emulator like this is made?
I wouldn't even know where to start.
- yohanatan 13y agoRun-of-the-mill hackers should know this. You pick a sufficiently low-level abstraction layer and implement it in Javascript. Everything above that layer 'just works'TM.
- Segmentation 13y agoIt's like drawing. http://i.imgur.com/RadSf.jpg http://i.imgur.com/RadSf.jpg
- PhasmaFelis 13y ago> Run-of-the-mill hackers should know this. Do you really need to put the guy down for honestly admitting ignorance and trying to learn? Anyway, "hacking" and computer science in general is diverse enough now that I wouldn't expect even an expert in any particular subfield to necessarily know anything about another. It's quite possible to be, say, an experienced database guru with a solid working knowledge of raytracing, network administration, and Unicode, without ever having touched anything related to emulators.
- yohanatan 13y agoI wasn't putting him down. Just noting that his use of the word 'hacker' is not correct. There's a minimum bar to clear to call one's self a hacker and understanding how to substitute part of a software stack with another one is above that bar (in my opinion). See: http://www.paulgraham.com/gba.html http://www.paulgraham.com/gba.html
- BlackDeath3 13y agoHmm. What I'm about to say probably sounds a lot like something that somebody who lacks impressive technical prowess (like myself, self-admittedly) would say, but I think that being a "hacker" is almost more of a mindset. Or, alternatively, there is a hacker mindset, and a lot of the folks here can identify with, and exhibit, that mindset. Specifically, the hacker mindset means that you're always curious, always learning, always improving, just like the poster who asked the question above.
- yohanatan 13y agoI was referring to the term hacker in the 'good programmer' sense (as mentioned in the PG essay I linked to). Being a good programmer pre-supposes being a programmer (and good programmers should definitely have an idea how emulators are written, IMO).
- PhasmaFelis 13y agoIt seems to me that tying "hacker" status to any one specific skill or bit of knowledge is antithetical to the whole concept.
- yohanatan 13y agoI was referring to the term 'hacker' in the 'good programmer' sense as mentioned by Paul Graham in the link I posted. Obviously, to be a good programmer one must first be a programmer.
- jacob019 13y agoSeems like they're usually based on hardware emulators like qemu, bochs or similar which are compiled to javascript using tools like emscripten. IO hardware needs to be emulated in JS, a framebuffer is drawn to a canvas, mouse input events are translated to the native hardware events, I'm sure there's a million details.
- vishal0123 13y agoFirst you need to port x86(or any other) instruction set. This can also be done by compiling (part of)Bochs/PCE using emscripten. Then you need to port IO (floppy,HD etc.). Then monitor and graphics card. And if you really want to be cool there are hosts of other things to port like touchscreen, networking, USB etc.
- deleted 13y ago[deleted]
- drzaiusapelord 13y agojs is turing complete. In theory you should be able to write an emulator for an OS using js your browser runs. Turns out people are doing this. From there its just the everday craziness of emulation. Emulating the instruction set, the IO devices, etc.
- lmm 13y agoThe same way as any other emulator. Programs for any computer are just a sequence of bytes - i.e. just another file format. So you write something that interpret that file format. It's not fundamentally any different from writing, say, a PDF viewer.