Class Console

java.lang.Object
  extended by Console

public class Console
extends java.lang.Object

Instances of this class represent console user interfaces to a simulated computer equipped with a Micro-1 processor.


Constructor Summary
Console()
          Constructs a processor and a memory with 256 cells
Console(int cap)
          Constructs a memory with specified number of cells, and constructs an associated processor.
 
Method Summary
 void controlLoop()
          This is the read-execute-print loop for the console.
 void help()
          Displays synopsis of all commands in the console window
 void load(java.lang.String fName)
          Loads hexadecimal numbers stored in fName into memory starting at address 0.
static void main(java.lang.String[] args)
          Creates a console (with memory and CPU), then starts the console's control loop.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Console

public Console(int cap)
Constructs a memory with specified number of cells, and constructs an associated processor.

Parameters:
cap - the sepcified amount of memory

Console

public Console()
Constructs a processor and a memory with 256 cells

Method Detail

load

public void load(java.lang.String fName)
Loads hexadecimal numbers stored in fName into memory starting at address 0. Resets PC to 0.

Parameters:
fName - the name of a file containing hex numbers

help

public void help()
Displays synopsis of all commands in the console window


controlLoop

public void controlLoop()
This is the read-execute-print loop for the console. It perpetually 1) displays a prompt 2) reads a command from the keyboard 3) executes the command 4) displays the result Commands include quit, help, load (a program from a file), memory (display contents of memory), registers (display contents of registers), and step N (execute the next N instructions.


main

public static void main(java.lang.String[] args)
Creates a console (with memory and CPU), then starts the console's control loop.