Pompous logo
www . DanYEY . co . uk
Dan! 71 : Online Manual
First things first, thank you for downloading Dan! 71 : CPU Simulator. In doing this, you are indirectly supporting my work.

1) Your First Time
2) Writing Programs
3) Saving/Opening Programs
4) Errors

Your First Time:
When you first run Dan! 71, you get something very similar to that shown on the right. This is the first and only screen in Dan! 71, where you will write all your code and run it. The various white boxes across the screen are the basic elements of any CPU, including the Arithmetic and Logic Unit (ALU), Current Instruction Register (CIR), and so on. It is not necessary that you know what each of these does, in order to use Dan! 71, however the purpose of Dan! 71 is demonstrate how they work together during the fetch/execute cycle, and so it would help your understanding if you knew a little about each component beforehand. One part you must be aware of is the main store (MS), or RAM, shown on the far right of the screen. This is the CPU's memory, where all instructions and data are stored. When you open or save a program, the contents of the MS is what is being stored. When you begin to write your code, you enter it into MS, placing one command in each textbox. The commands are in the form xxxxyyyy, where xxxx is a 4 bit binary number representing the operation to be carried out (a full listing of these instructions is contained within Dan! 71, under Help), and yyyy is a 4 bit binary number representing the address of the data to be accessed (as applicable). The addresses of the elements in MS are listed along side the textboxes. For example, 0001 is the code for "ADD", and 0110 is the address for the 6th memory element. When entered, as 00010110, the CPU would add the contents of memory location 0110 (to the accumulator). All mathematical operations are carried out via the ALU and accumulators. Why not open contdown.dpp, supplied with Dan! 71, and run it. Try to work out what each code does. The program should count down from 11111111 to 00000000 in memory location 0111. Please note that the CPU assumes programs begin at MS location 0000.

Dan! 71

Writing Programs:
The programs written in Dan! 71 are not true executable programs, and they can only work within Dan! 71. However, it is possible to write quite a large range of programs which do simple things like multiplying two numbers together. In order to write programs, it is suggested you try to break the task down into simpler tasks, such as placing a number somewhere. For example, in the picture to the right, memory location 0111 is repeatedly multiplied by memory location 0110 until it reaches 255 (11111111). How does it do this? The task is broken down as follows: (1) the contents of MS location 0111 are copied to ACCU1 (a temporary store) (2) the contents of ACCU1 are multiplied by the contents of MS location 0110 (3) the contents of ACCU1 are copied to MS location 0111 (4) the contents of ACCU1 are checked: if equal to 255, then the program jumps to location 0101 (5) if the program has jumped, then it stops, as MS location 0101 instructs it to, otherwise it carries on to MS location 0100, where it is told to jump to MS location 0000, and carry on processing. This is how the program loops to repeatedly multiply location 0111 by location 0110. Download this program. A simpler example would be to simply add one number to another. For this, the first command would be 00000111. This would load (0000) the contents of MS location 0111 (the last 4 digits of the command), which can contain any number (in binary), into ACCU1. The second command would be 00010110, which would add (0001) the contents of MS location 0110, which can also contain any binary number, to the contents of ACCU1. The last important command would be 00100111, which would tell the CPU to store (0010) the contents of ACCU1 in MS location 0111. This is the total of your two numbers added together. Finally, a stop command, 11110000, would be placed in MS location 0011. You will find that if you keep pressing run, MS location 0111 will keep increasing by the amount in MS location 0110.Download this program. Don't worry too much about saving in case of errors either, because if your CPU crashes, your work can usually be retrieved from c:\cpu1.dpp. Make sure you always begin your programs at MS location 0000. The CPU assumes they begin there.

Dan! 71

Saving/Opening Programs:
Your programs can be saved and opened, just like in most Windows applications. However, outside Dan! 71, your programs are not recognised and cannot run as standalone executables. If you crash your virtual CPU, your work will usually be emergency-saved in c:\cpu1.dpp.

There are 3 common types of errors in Dan! 71. Errors of these types are recognised by the software and safely handled before crashing your system. The first one is numeric overflow, where data to be used by the CPU has gone beyond the boundaries of 0 and 255. No value less than 0 or greater than 255 is supported in Dan! 71. The second is bad addressing. There are only 8 locations in Dan! 71's main store, with addresses from 0000 to 0111. Dan! 71 will initially accept addresses greater than 0111, such as 1111 because it accepts a 4 bit address, however it will crash when needed to access this address. The third is the most volatile and dangerous. It occurs when you have created looping code which never stops looping. The CPU reports this as an "infinite iteration" error, because it cannot loop forever. It can usually be avoided by programming more accurately, including stop commands, and preferably avoiding instruction 1001, which is an unconditional jump. When the CPU crashes, the components turn red as shown on the right. You should also get an error message such as the one below.
Error Message