⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 main.java

📁 用jAVA实现的一个CPU32位的指令代码
💻 JAVA
字号:
import java.io.File;
import java.io.IOException;

public class Main {

	public static void main(String[] args) throws IOException {

		/*
		 * Demo one: 
		 * movl 9, x 
		 * movl -8, y 
		 * addl x, y 
		 * print y # result is 1
		 */

		System.out.println("MiniPentium demo one:");
		System.out.println("movl 9, x\nmovl -8, y\naddl x, y\nprint y # result is 1\n");
		File exefile = new File("src", "Test1.exe");
		Vcpu cpu = new Vcpu(new Memory());
		cpu.loader(exefile);
		cpu.start();
		/*Demo two: 
		 * movl 9 , x 
		 * movl -8 , y
		 * movl 10 , z 
		 * addl x , y 
		 * subl y , z
		 * mull x , z 
		 * print z 
		 * print x 
		 * print y
		 */
		File exefile2=new File("src","Test2.exe");
		cpu.reset(new Memory());
		cpu.loader(exefile2);
		cpu.start();

	}
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -