[HN Gopher] Musashi: Motorola 680x0 emulator written in C
       ___________________________________________________________________
        
       Musashi: Motorola 680x0 emulator written in C
        
       Author : doener
       Score  : 120 points
       Date   : 2026-01-08 00:51 UTC (22 hours ago)
        
 (HTM) web link (github.com)
 (TXT) w3m dump (github.com)
        
       | kazinator wrote:
       | I made one a 68010 emulator in C in 1994.
       | 
       | For the opcode dispatch, I made a file which consisted of regex
       | and name pairs. The regexes matched strings of 0s and 1s: the bit
       | patterns of the opcode space. The names mapped these to C
       | functions. A script processed the file, generating the dispatch
       | switch.
       | 
       | I seem to remember that on a 66 MHz 486 DX2 box running Linux,
       | the thing was emulating about half a million instructions per
       | second.
       | 
       | Code: totally lost to the sands of time.
        
       | self_awareness wrote:
       | FYI: MIT licensed
        
         | self_awareness wrote:
         | Is it wrong? Who the heck downvotes this?
        
           | debo_ wrote:
           | username checks out
        
             | self_awareness wrote:
             | I felt bad after reading your comment.
        
       | rcarmo wrote:
       | I took a look at this during my holiday break (where I was
       | hacking BasiliskII to do JIT emulation on ARM), and it's quite
       | neat but, IIRC, wasn't enough of a speed up over the existing
       | emulator.
        
         | dukoid wrote:
         | I'd expect the main advantages to be portability and
         | maintainability?
        
           | rcarmo wrote:
           | I was looking for more speed on ARM devices.
        
       | kstenerud wrote:
       | Wow! Wasn't expecting this to be on HN.
       | 
       | So here's the backstory:
       | 
       | I'd just graduated from BCIT a year before. A friend invited me
       | to visit Japan, so I got a working holiday visa, hopped on a
       | plane, and there I was in a 1K apartment with 2 other people. I
       | had one whole square meter of floor space for my computer (which
       | I'd packed with me) and a donated monitor.
       | 
       | While looking for tech work, I fiddled around with MAME, doing
       | small fixes to drivers and such, but I'd always had a love for
       | the 68000 chip (from my Amiga days), so I looked at what MAME was
       | doing and saw that its 68k emulator was written in assembler.
       | 
       | So I set a goal: Can I outperform the current assembler core with
       | one written in portable C? Spoiler: Yes.
       | 
       | I spent 2 months sitting Buddha-like on the tiny square of floor
       | in between job interviews, writing (and leveraging MAME's
       | debugger). My proudest moment was when I finally saw the title
       | screen for Rastan Saga pop up! (of course it crashed on launch,
       | but still)
       | 
       | I named it Musashi, after Shinmen Musashi-no-Kami Fujiwara no
       | Harunobu (Xin Mian Wu Zang Shou Teng Yuan Xuan Xin ), commonly
       | known as Miyamoto Musashi, who wrote the Book of Five Rings - a
       | book that had a huge effect on me.
        
         | jacquesm wrote:
         | Great story. It is interesting how being stranded in some place
         | with a computer and some skills always results in the most
         | fantastic projects.
        
           | lelanthran wrote:
           | > Great story. It is interesting how being stranded in some
           | place with a computer and some skills always results in the
           | most fantastic projects.
           | 
           | TLDR: IME, solitude is required for clear thinking.
           | 
           | -----------------------------------
           | 
           | Long ago, I used to drive 600km (one-way) twice a month .
           | Kept it up for 4 years or so. As I drive with the radio off,
           | I had much time alone with my thoughts.
           | 
           | Now, I wonder if always reading is having a negative effect:
           | we're constantly bombarded with content all the time, and
           | even though I never doomscroll (no tiktok account, no FB
           | account, no instagram, etc), I think sometimes that enforced
           | solitude might do wonders for my problem-solving.
           | 
           | I wonder how people who _are_ on all those social networks
           | ever find time to just ruminate.
        
             | jacquesm wrote:
             | Heh, that's a very timely comment. I just drove up and down
             | to Berlin through absolutely crap weather and still figured
             | something out I'd been struggling with for weeks.
        
           | ale42 wrote:
           | Very true. Had a somewhat similar experience while being
           | offline in trains for some hours at a time.
        
         | matwood wrote:
         | Also the book simply named "Musashi" is amazing and tells the
         | 'story' of his life. It has arguably the best ending of any
         | book I've ever read where the lead up builds for 1000+ pages
         | ending in a crescendo.
        
       ___________________________________________________________________
       (page generated 2026-01-08 23:01 UTC)