Ellen - A Microcomputer simulator
by Christer Sandberg
E-mail: christer.sandberg@mdh.se
Homepage: http://www.idt.mdh.se/~csg/ellen/
Manual for Ellen 7.0.0

Contents

Introduction

The main purpose with Ellen is to provide a tool to teach the basic principles of a CPU. The target people are computer architecture classes at basic level. Maybe it can be useful to first learn a bit about assembler programming. The CPU type that is modelled is an 8-bit architecture of a type that is sometimes referred to as accumulator machine. It has a special register named accumulator register that can be used as the default operand to some instructions.

A special feature is that the CPU itself is programmable. There exists such CPU:s in the real world, however non that is identical to Ellen.


Assembler

An assembler program consists of a number of assembler instructions. A typical instruction may be e.g. ADD that adds to numbers. However, there is always a number that encodes such an instruction, we call these numbers machine instructions or machine codes.

To write a program to be executed by Ellen you have to enter such numbers into Ellens "assembler memory" as binary numbers of 8 digits length. To enter a machine instruction at some cell in the assembler memory, you have to first select that cell using the the so called "address register". Also the address register is accessed using binary numbers. Immediately after you modify the address register (by clicking on the "lamps" that forms a binary number) the content of the corresponding memory cell will show up in the register named "Memory", where it can be modified. The entire assembler memory is shown in the listbox on the right hand side of these registers.

Operation codes and address mode codes.

So what are the machine instructions in Ellen?? - You have to decide that yourself! To create a machine instruction you need to know that the leftmost (most significant) 5 binary digits in the instruction controls the instruction type. This is called the operation code, OP. The rightmost 3 binary digits of the instruction controls the address mode to be used by a certain instruction (this code tells if the operand is e.g. an immediate value, or if it can be found in the accumulator, etc.). So you have to both define the OP-codes and the address mode codes that should be handled by Ellen.

You can give a name to your machine instruction types. You can do that with Tools | Edit instructions . Click in the list left hand side, on the 5 digits (binary) code that you want to give a name. Enter the name into the field "Selected instruction". When you have entered the name, any machine instruction with that code will be displayed with its name instead of the number.

You can aslo give names to the address modes that you plan to use. You can do that with Tools | Edit modes . Click in the list left hand side, on the 3 digits (binary) code that you want to give a name. Enter the name into the field "Name". You also need to tell the number of operands. The prefix and suffix can typically be a left and right parenthesis, respectively. The prefix will be displayed in the assembler list after the assembler code's name. Then comes the operands, i.e. the content of the subsequent address(es), and finally the suffix. So what is the name used for? It's just to make it easy for you when you decide which of the address modes that a machine instruction type can have (in Tools | Edit instructions ).

Note that all these things related to editing instructions and address modes are optional, its sole purpose is to make it easier fot you to see what you are doing in other steps of your work.

Machine code instructions

By the way, how can the machine know that you want to numbers to be added when you enter the code for ADD? - It wont... you have to write a small program for each machine instruction that you plan to use. So each machine instruction will be executed as a sequence of several micro instructions. To enter a micro instruction you do similar to when entering machine instructions: select the desired cell in the micro memory by setting the Micro PC to the apropriate binary number, then enter your code in the 24 bit field of the "Micro memory". To bring up the entire micro memory you have to chose Option | Micro code list and you will get a floating window.

Before you go ahead and program the machine you need to know the following:

Over all structure of the machine code program

Suggested instructions

Below are some suggestions to useful assembler instructions, I guess that it would be hard to write assembelr programs without these. The detailed semantics (e.g the effect on the flags etc) may of course vary quite a lot. Here are also some suggestions to address modes: Of course it may aslo be intersting to experiment with address modes of more than one operand, or with 16 bit operands.

Who own what?

The following registers are visible to the assembler programmer: The content of these registers must not be modified by any micro code instruction unless the assembler instruction description specifies other. The other registers are not accessible by the assembler programmer, so the micro code instruction may use them freely: Note however that these will in most cases have a special meaning during some steps of the execution of one assembler instruction.

The Program Counter (PC) has a special status. There is no meaning to make an assembler instruction that modifies the PC explicitly. There are three ways to modify the PC.

The machine code language

How can I make may own assembler instruction - what does the various fields of a micro code instruction mean? - Here follows a breif explanation.