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

📄 uasm.h

📁 模拟了tec2000的所有功能
💻 H
字号:

#include<fstream.h>
#include<iomanip.h>
typedef unsigned short word_t;
typedef unsigned char byte_t;
class CUasm
{
public:
    word_t addr,address;	
    word_t length;
	int j;
	int * sign;//指令标志数组
	int signp;//标志数组指针
	word_t a[100];//执行地址队列
	int ahead;//队列头指针
	int atail;//队列尾指针
	bool StartUasm(char*,char*,int);
	bool uuasm(char*);
	bool uuuasm(char *,word_t head,word_t tail);
	bool outcod(char *);
	void exe(char *,word_t head);
	void datadefine(char *,word_t head,word_t tail);
private:
    long errLine;
	void get_addr_and_len(ifstream& in_file);
	bool exec(ifstream&,ofstream&,ofstream&);
	bool perform(ifstream&,ofstream&,ofstream&,word_t,word_t);

protected:
	//各种指令的处理函数
	void dw(ifstream& ,ofstream&,ofstream&,byte_t);
	void add(ifstream& ,ofstream&,ofstream&);
	void sub(ifstream& ,ofstream&,ofstream&);
	void and(ifstream& ,ofstream&,ofstream&);
	void cmp(ifstream& ,ofstream&,ofstream&);
	void xor(ifstream& ,ofstream&,ofstream&);
	void test(ifstream& ,ofstream&,ofstream&);
	void or(ifstream& ,ofstream&,ofstream&);
	void mvrr(ifstream& ,ofstream&,ofstream&);
	void Dec(ifstream& ,ofstream&,ofstream&);
	void inc(ifstream& ,ofstream&,ofstream&);
	void shl(ifstream& ,ofstream&,ofstream&);
	void shr(ifstream& ,ofstream&,ofstream&);
	void jr(ifstream& ,ofstream&,ofstream&);
	void jrc(ifstream& ,ofstream&,ofstream&);
	void jrnc(ifstream& ,ofstream&,ofstream&);
	void jrz(ifstream& ,ofstream&,ofstream&);
	void jrnz(ifstream& ,ofstream&,ofstream&);
	void jmpa(ifstream& ,ofstream&,ofstream&);
	void ldrr(ifstream& ,ofstream&,ofstream&);
	void in(ifstream& ,ofstream&,ofstream&);
	void strr(ifstream& ,ofstream&,ofstream&);
	void pshf(ifstream& ,ofstream&,ofstream&);
	void push(ifstream& ,ofstream&,ofstream&);
	void out(ifstream& ,ofstream&,ofstream&);
	void pop(ifstream& ,ofstream&,ofstream&);
	void mvrd(ifstream& ,ofstream&,ofstream&);
	void popf(ifstream& ,ofstream&,ofstream&);
	void ret(ifstream& ,ofstream&,ofstream&);
	void cala(ifstream& ,ofstream&,ofstream&);
	//扩展指令的函数
	void adc(ifstream& ,ofstream&,ofstream&);
	void sbb(ifstream& ,ofstream&,ofstream&);
	void rcl(ifstream& ,ofstream&,ofstream&);
	void rcr(ifstream& ,ofstream&,ofstream&);
	void asr(ifstream& ,ofstream&,ofstream&);
	void not(ifstream& ,ofstream&,ofstream&);
	void jmpr(ifstream& ,ofstream&,ofstream&);
	void jrs(ifstream& ,ofstream&,ofstream&);
	void jrns(ifstream& ,ofstream&,ofstream&);
	void clc(ifstream& ,ofstream&,ofstream&);
	void stc(ifstream& ,ofstream&,ofstream&);
	void ei(ifstream& ,ofstream&,ofstream&);
	void di(ifstream& ,ofstream&,ofstream&);
	void calr(ifstream& ,ofstream&,ofstream&);
	void ldra(ifstream& ,ofstream&,ofstream&);
	void ldrx(ifstream& ,ofstream&,ofstream&);
	void strx(ifstream& ,ofstream&,ofstream&);
	void stra(ifstream& ,ofstream&,ofstream&);
	void iret(ifstream& ,ofstream&,ofstream&);
};

⌨️ 快捷键说明

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