DooDoo - Building a Computer!

Previous | Home

This page is still under construction.

Before you go and grab that screwdriver lets make it clear that we are going to attempt to build the computer through the method of software simulation. The idea is to simulate the functioning of a processor. Our program will be the processor and will illustrate how it interacts with the other components that make a computer - namely memory and IO (input/output).

The processor will support a few basic functions (called "instructions") that handle the interaction between itself and the memory, keyboard and monitor. Being a simulation, we have occasion to represent such interaction in a handsome manner through the use of GUI components (windows, edit boxes, buttons etc.,). If you are wondering what the "DooDoo" in the title of this page means, well that is what we will call our computer - "DooDoo"!

DooDoo is composed of the following components,

System Memory
Our computer will have a total of 100 words of memory, each word being 2 bytes in length. This means that all that our computer will have in terms of memory is a measly 200 bytes! Also, to keep things simple we will allow the storage of numbers upto 9999 only in memory. The memory is represented in the program by an array of 100 integers.

Each location in the address space is identified by its index. Therefore, memory location number 1 would be addressed "0000", memory location number 2 would be addressed "0001" and so on upto "0099".

Register Memory
The register is composed of,

Accumulator
This is a general purpose storage area where the results of the various calculations are stored temporarily. Also our computer cannot access the system memory directly, i.e., it only provides facilities to move data from the accumulator to a given location and vice-versa.
Instruction Counter
This holds the index of the next instruction in memory that is to be executed. Unless there is an explicit command to branch to another location, this counter is simply incremented after the execution of each statement.
Instruction Register
This register holds the current instruction, i.e., instructions are not executed from memory directly - they are first retrieved into this register and then executed.
Operation Code
This indicates the operation that is to be performed. The first byte of the 2 byte instruction word forms the operation code. For eg., the command for reading input from the keyboard into memory location 15 is indicated by the number 1015 where "10" indicates the operation to be performed and "15" the memory location (which is the operand).
Operand
Depending upon the current operation this can be,
In the previous eg., the value 15 is the operand and indicates that the value that is read from the keyboard must be written to memory location 15.

DooDoo Instructions

The various operations supported by DooDoo have been tabulated below,

Operation Code Operation Description Example
10 READ Read a word of data from the keyboard to the memory location supplied as the operand. In our simulation this will cause an input-box to be displayed prompting the user for input. 1015 - Read data into memory location 15 from the user.
11 WRITE Write a word of data from the system memory to the output window (explained below). 1115 - Print data from memory location 15 to the output window

Previous | Home 1