View Javadoc
1 /* 2 * MythSim 3 * 4 * Copyright (C) 2002-2004 Jason Vroustouris <jasonv@jasonv.com> 5 * 6 * This program is free software; you can redistribute it and/or modify 7 * it under the terms of the GNU General Public License as published by 8 * the Free Software Foundation; either version 2 of the License, or 9 * (at your option) any later version. 10 * 11 * This program is distributed in the hope that it will be useful, 12 * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 * GNU General Public License for more details. 15 * 16 * You should have received a copy of the GNU General Public License 17 * along with this program; if not, write to the Free Software 18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 19 */ 20 21 package org.mythsim.console; 22 23 import java.io.*; 24 import org.mythsim.core.*; 25 26 /*** 27 * Starting point for command line version (Pre Alpha). 28 * @author Jason Vroustouris 29 */ 30 public class MainConsole { 31 private MythSimConsole ms = new MythSimConsole(); 32 33 public MainConsole() { 34 try { 35 ms.setFileMicrocode(new File("sample.ucode")); 36 ms.setFileMemory(new File("sample.mem")); 37 } 38 catch (FileNotFoundException ex2) { 39 System.out.print(ex2); 40 } 41 42 try { 43 ms.parse(); 44 ms.boot(); 45 BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); 46 String command = ""; 47 48 while (!command.equalsIgnoreCase("quit")) { 49 System.out.print("Prompt:"); 50 command = br.readLine(); 51 if (command.equalsIgnoreCase("s")) { 52 ms.step(); 53 } 54 if (command.equalsIgnoreCase("r")) { 55 ms.print_registers(); 56 } 57 } 58 } 59 catch (MythError ex1) { 60 System.out.print(ex1.message()); 61 ex1.printStackTrace(); 62 } 63 catch (IOException ioe) { 64 System.out.println("IO error."); 65 System.exit(1); 66 } 67 catch (Exception ex) { 68 ex.printStackTrace(); 69 } 70 71 System.out.println("Exiting..."); 72 System.exit(0); 73 } 74 }

This page was automatically generated by Maven