4917emu Microprocessor Emulator

4917emu

Tell me how a computer works, how a computer works

Like to learn how to CODE and program? Then this is for you. This emulator is based on the
4917 microprocessor (a hypothetical designed just for a computer course named COMP1917 at the
UNSW University of New South Wales) which was used to teach microprocessor basics.
It is 4bit, has 16 memory locations and 4 registers: Instruction Pointer (IP), Instruction Store (IS),
General Register 0 (R0) and General Register 1 (R1). Each memory location can store a
number between 0 and 15, and there are 16 instructions.

 

This is how it works: There is an an Input Memory where you enter your program and
the program is stored. There is also an Output where you can see the output of your program.
And there is a Control center where you can control your program like run it, step through, debugg it, etc.

Here it is on an iPad:

 

 

App Usage

Just enter your own program or use a predefined one and hit Step or Run.

There is a Extended Instruction Code set. For example, you can turn the front LED on and off.  See below for more details.

For example the following 4917 machine code program would print 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15.

8 0 3 11 1 15 0

Introduction

So what is a microprocessor? It basically is there and just waits. For what? For your input. There is on input, output and control "thing".

  • On the Input section, you enter values right into the memory of the microprocessor. You program your own program here or load one from the disk storage.
  • On the Control section you control what happens next. Run your program, inspect memory, etc.
  • On the Output you can see what happens. Read printed values, read dumped memory, etc.

There is one more thing, the Instruction Pointer (IP), the Instruction Set (IS) and the Registers (R0 and R1).

  • IP (Instruction Pointer): This is just a value that points to the memory cell which will be executed next. A zero means, please execute the code within memory location zero next time you start the machine by hitting step or run.
  • IS (Instruction Set): This is the fetched instructions where the IP points to. In our example you can see that the IP is 0 and the IS is 8 and 0. This is because of a two byte command 8 and 0.
  • R0 (Register 0): This is just a temporary internal microprocessor storage.
  • R1 (Register 1): This is an other one. Sure you can read values from and write values to a register.
iPhone 4 - 4917emu
iPhone 5 with iOS 7 - 4917emu

Instruction Codes

1-byte Instructions

(Note: In the 4917 each ‘byte’ is 4 bits, so a byte is just a number between 0 and 15.)

0 = Halt

1 = Add (R0 = R0 + R1)

2 = Subtract (R0 = R0 – R1)

3 = Increment R0 (R0 = R0 + 1)

4 = Increment R1 (R1 = R1 + 1)

5 = Decrement R0 (R0 = R0 – 1)

6 = Decrement R1 (R1 = R1 – 1)

7 = Ring Bell

2-byte Instructions, value of the second byte is called <data>

8 = Print <data> (The numerical value of <data> is printed)

9 = Load value at address <data> into R0

10 = Load value at address <data> into R1

11 = Store R0 into address <data>

12 = Store R1 into address <data>

13 = Jump to address <data>

14 = Jump to address <data> if R0 == 0

15 = Jump to address <data> if R0 != 0

Extended Instruction Codes

20 = NOP (No Operation)

50 = front LED on

51 = front LED off

71 = vibrate alarm

Architecture

  • 16 memory locations (0 – 15)
  • 2 general registers (R0 and R1)
  • all arithmetic operations are mod 16

Registers

IP = Instruction Pointer. This is in which memory cell the next instruction will be executed stored in IS.

IS = Instruction Store. This holds the next instruction.

R0 = General Register R0

R1 = General Register R1

Startup

  1. All registers are set to zero (0)
  2. All memory locations are set to 20 (NOP = No Operation)
  3. Executes the first instruction where IP (Instruction Pointer) points to. At startup, this is always memory address zero (0)

Fetch Execute Cycle

  1. The IP (Instruction Pointer) is set to zero (0).
  2. Read the instruction code, 1 byte or 2 byte into IS (Instruction Store).
  3. The instruction code in IS is executed.
  4. Repeat until it reaches zero (0); that is HALT

Microprocessor Basics - Video Tutorials

Understanding Micro Processors - LearnKey A+ 2009 Course Preview

Lecture 3: Machine Code - Richard Buckland UNSW

From sand to chip - How a CPU is made

 

Customer Review

Version 2.3.1

- A complete new redesign for iOS 7 and iOS 6

- iPad: fixed app crash

Version 2.3

Germany

Makes... ★★★★★

by Danksa Grabowski - Version 2.3 - Mar 13, 2013

...a lot of fun! 😀 But it sucks that it sometimes cleares the memory without a reason...

Version 2.1

USA

This is a great app. ★★★★★

by BoxerBomb - Version 2.1 - Nov 18, 2012

This app does just what it says. Very little memory locations which limits what you can make but great for learning just the app I was looking for. Things to add: More memory locations SAVING and an better info dialog

 

Support

Leave a comment below.

 

 

 

 

Helpful?

One thought on “4917emu Microprocessor Emulator

  • 30. December 2012 at 22:44
    Permalink

    4917emu – 4917emu ist eine hypothetische Mikroprozessor, der in einem Computer-Kurs namens COMP1917 an der UNSW University of New South Wales zum Mikroprozessor Grundlagen beizubringen verwendet wurde. Es ist 4bit, verfügt über 16 Speicherplätze und 4 Register: Instruction Pointer (IP), Instruction Store (IS), General Register 0 (R0) und General Register 1 (R1). Jeder Speicherplatz kann eine Zahl zwischen 0 und 15 zu speichern, und es sind 16 Anweisungen. Es ist eine Erweiterte Instruction Code-Set. Zum Beispiel die folgenden 4917 Maschinen-Code Programm würde die Zahlen von Null bis 15 drucken: 8 0 3 11 1 15 0.

    Reply

Leave a Reply

Your email address will not be published. Required fields are marked *