[go: nahoru, domu]

Skip to content

A simple emulator for the simple (fake) microprocessor described by OCR

Notifications You must be signed in to change notification settings

tomhennigan/ocra2

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ocra2
=====

This is a simple emulator for the (fake) microprocessor described by OCR in their A2 Electronics exam (until 2009). It reads a binary file with instructions and runs the program on the host machine in an emulated environment.

During the emulation the instruction being executed will be printed in a human readable format (as described by the instruction set). 

@author Tom Hennigan <tomhennigan@gmail.com>
@year 2008

ocra2 Details
=============
Information from the insert provided by OCR (http://www.ocr.org.uk/Data/publications/past_papers_2005_june/L_A_Level_Electronics_2530_Jun_2005_Insert.pdf)

The microprocessor has the following registers 
Program counter (8 bit) PC 
Accumulator (8 bit) A 
Index Register (8 bit) X 
M(n) represents the contents of memory whose address is the value of the byte n. 
M(X) represents the contents of memory whose address is stored in the index register. 
M(FF) is an eight bit output port; M(EF) is an eight bit input port. 

INSTRUCTION FUNCTION 

3E	n	A <- n
C6	n	A <- A + n
D6	n	A <- A - n
E6	n	A <- A & n
EE	n	A <- A eor n

3A	n	A <- M(n)
32	n	M(n) <- A

7E		A <- M(X)
77		M(X) <- A

86		A <- A + M(X)
96		A <- A - M(X)
A6		A <- A & M(X)
AE		A <- A eor M(X)

6F		X <- A
7D		A <- X
C9		X <- X + 1

C3	n	PC <- n
CA	n	PC <- n if A == 0
C2	n	PC <- n if A != 0

00		No Operation
76		Halt

The first instruction fetched by the microprocessor after a reset will be the one held in the memory 
location whose address is 00.

About

A simple emulator for the simple (fake) microprocessor described by OCR

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages