Question: Don't use method such as try, catch, just basic code please import java.io . * ; public class VPCrte { static final int MEMSIZ =

Don't use method such as try, catch, just basic code please import java.io.*;
public class VPCrte
{
static final int MEMSIZ =100;
static final int HALT =0;
static final int ADD =1;
static final int SUB =2;
static final int MLT =3;
static final int DIV =4;
static final int ILOAD =5;
static final int LOAD =6;
static final int STOR =7;
static final int READ =8;
static final int WRITE =9;
static final int BR =10;
static final int BZ =11;
static final int BN =12;
static final int DUMP =13;
static int MEMORY[]= new int[MEMSIZ];
static int PCREG;
static int IRREG;
static int GPREG;
static boolean debug = false;
public static void readToMemory(String fname) throws IOException
{
// for each line of "machine code":
{
if (debug)
{
// display info about code as it is loaded into memory
}
// copy machine code instruction into memory
}
}
public static String pad(int n, int w)
{
// determine length of 'n'
// calculate number of leading 0's to pad with
// create and return string of leading 0's, and 'n'
}
public static void dumpMemory()
{
System.out.println("===================================================================");
int c=0;
System.out.println("PCREG ="+ pad(PCREG,4));
System.out.println("IRREG ="+ pad(IRREG,4));
System.out.println("GPREG ="+ pad(GPREG,4)+"
");
System.out.println("MEMORY: 0123456789");
System.out.println("---------------------------------------------------------------");
for (int i=0; i

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!