- 1 4917emu
- 1.1 Tell me how a computer works, how a computer works
- 1.2 App Usage
- 1.3 Introduction
- 1.4 Instruction Codes
- 1.5 2-byte Instructions, value of the second byte is called <data>
- 1.6 Extended Instruction Codes
- 1.7 Architecture
- 1.8 Registers
- 1.9 Startup
- 1.10 Fetch Execute Cycle
- 1.11 Microprocessor Basics - Video Tutorials
- 1.12 Customer Review
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:
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
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.
(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
- 16 memory locations (0 – 15)
- 2 general registers (R0 and R1)
- all arithmetic operations are mod 16
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
- All registers are set to zero (0)
- All memory locations are set to 20 (NOP = No Operation)
- Executes the first instruction where IP (Instruction Pointer) points to. At startup, this is always memory address zero (0)
Fetch Execute Cycle
- The IP (Instruction Pointer) is set to zero (0).
- Read the instruction code, 1 byte or 2 byte into IS (Instruction Store).
- The instruction code in IS is executed.
- 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
- A complete new redesign for iOS 7 and iOS 6
- iPad: fixed app crash
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...
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
Leave a comment below.