Jonathan Riddell's programs

Version 1.0 March 2001

This is a simple Java Brookshear machine. The Brookshear Machine is a simple computer simulation with 256 bytes of memory, a CPU, registers, ALU and a simple assembly langage to program it in. Each instruction is 2 bytes long and the first half byte is the opcode - see brookshear-instructions.html for details. There are example programs. It is not a graphical application.

to use: java Brookshear filename memory-dump-file initial-instruction eg: java Brookshear prog1.text MEMORY-DUMP 0

This is copyright Jonathan Riddell. It may be copied and distributed under the terms of the GNU GPL only. See COPYING for details. These .class files are compiled with Kaffe, a free Java implementation. I am unclear on whether compiling with a proprietry javac with proprietry Java libraries allows the result to be GPLd, best not to do it. Contact me if you wish to do so.

Jonathan Riddell, jr@jriddell.org


Download

brookshear.tar.gz, brookshear.zip

Brookshear Machine instructions

The Brookshear machine has 16 registers, numbered (in hexadecimal) 0x to Fx. Each register holds one byte (8 bits). There are 256 cells in memory, numbered from 00x to FFx. Each cell holds one byte. Each instruction in the language is coded in two bytes. The first half-byte (represented by the first hex digit) contains the opcode. The thirteen forms of instruction are described in the table below.

 

 

0iii No-operation

1RXY Load register R with contents of location XY

2RXY Load register R with value XY

3RXY Store contents of register R at location XY

4iRS Move contents of register R to register S

5RST Add contents of registers S and T as binary numbers, place result in register R

6RST Add contents of registers S and T as floating-point numbers, place result in
register
R

7RST OR together the contents of registers S and T, place result in register R

8RST AND together the contents of registers S and T, place result in register R

9RST XOR together the contents of registers S and T, place result in register R

ARiZ Rotate the contents of register R one bit to the right, Z times

BRXY Jump to instruction at XY if contents of register R equal contents of register 0

Ciii Halt

 

 

 

The following conventions are used in the above table:

R,S,T Register numbers

XY A one-byte address or data value

Z A half-byte value

i Ignored when the instruction is de-coded: usually entered as 0