GithubHelp home page GithubHelp logo

sm5emu's Introduction

sm5emu

Emulator for Sharp SM5 MCU

sm5emu is a lousy emulator for Sharp's 4-bit SM5 microcontroller. Commonly found in pocket calculators and electronic toys from the 90's, the SM5 forms the core of the Nintendo 64 CIC copy protection chip.

Features

sm5emu has the following whiz-bang features:

  • built-in debugger
  • memory viewer / poke
  • code breakpoints
  • memory breakpoints

Running

Launch sm5emu by providing it with the image of an SM5 binary. The emulator launches in debugger mode, and output follows:

0.00 : lbmx 2
  PC=0.00 A=0 X=0 BM=0 BL=0 SB=00 C=0 SP=0 skip=0
  P0=0 P1=0 P2=0 hiz=1   cycle=0 div=0
>

The first line shows the PC, registers, and whether the instruction displayed will be skipped. The second line shows the status of ports, internal clock cycle, and div (used on some SM5 variants).

Pressing enter executes the current instruction and the debugger displays the next instruction to be executed. You can see that BM is now 2 as a result of running the previous instruction:

0.01 : lblx 2
  PC=0.01 A=0 X=0 BM=2 BL=0 SB=00 C=0 SP=0 skip=0
  P0=0 P1=0 P2=0 hiz=1   cycle=1 div=0
>

Debugging

The debugger supports the following commands:

<enter> - step (execute current instruction)
p - print state
r - run
t - toggle trace (display state while running)
q - quit

m - display memory
sp - display stack pointer

b <page> <addr> - break
mb <addr> [<end addr>] - set memory breakpoint
cb - clear breakpoint
cmb - clear memory breakpoint
hiz - toggle break on Hi-Z

skip - toggle skip
poke <addr> <value> - poke into memory
port <number> <value> - set port data

Wishlist

sm5emu is pretty barebones. Here's a list of stuff I wish it had:

  • overhaul of port system
  • better input simulation
  • output viewer
  • state saving and rewind
  • better documentation
  • some kind of GUI (maybe ncurses?)

Author

Mike Ryan wrote this emulator in 2014 and 2015 as part of an effort to reverse engineer the Nintendo 64 CIC copy protection chip.

sm5emu's People

Contributors

mikeryan avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.