oldbeginner 发表于 2014-1-13 19:39:51

有人能帮忙编译下8051仿真器(c++)吗?有代码

本帖最后由 oldbeginner 于 2014-1-13 19:56 编辑

网上找了个8051模拟的C++代码,有makefile,要用g++,我在windows下编译失败,有人能试一下码?

还有,如果把该文件移到vc中,难不难?谢谢。





操作指导
Instructions

The simulator will continue executing the provided program until either the user hit Ctrl-C or the program completion condition is met. The program completion condition can be set by defining a macro PROGRAM_COMPLETION located in i8051.h to indicate the program completion condition, e.g., RAM == 0x01.

The program's output can be controlled through the macros PORTS, DEBUG, DEBUG_PC and DETAIL located in i8051.h. If PORTS is defined, anytime one of the output ports of the 8051 changes all ports will be printed out. If DEBUG is defined, a trace of all instructions executed by the simulator will be outputted to the output file specified by the user. If DEBUG is defined and DEBUG_PC is defined the PC for each instruction executed will be outputted to the output file. Finally, if DETAIL is defined, more information regarding each instruction will outputted to the output file.

NOTE: DEBUG_PC and DETAIL are not available in version 1.0.

To use the simulator, edit i8051.h and uncomment the PORTS, DEBUG, DEBUG_PC, and/or DETAIL macros to enable the respective output. Modify the macro PROGRAM_COMPLETION to the appropriate completion condition. If there is no program completion condition do not define PROGRAM_COMPLETION. Make the executable using the supplied Makefile. The program can be invoked by the following command

    8051sim < hexfile > < outfile >

网站地址:http://www.cs.ucr.edu/~dalton/i8051/i8051sim/

KongQuan 发表于 2014-1-13 20:43:38

要模拟,直接用keil就了吧。

oldbeginner 发表于 2014-1-13 20:55:08

KongQuan 发表于 2014-1-13 20:43
要模拟,直接用keil就了吧。

目的不是只为模拟,想理解decoder。

error_dan 发表于 2014-1-13 21:47:48

怕是要挂Cygwin,否则纯UNIX环境下的工具你就是用minGW的GCC编译出来也有相当大概率跑不了.

oldbeginner 发表于 2014-1-13 21:51:11

error_dan 发表于 2014-1-13 21:47
怕是要挂Cygwin,否则纯UNIX环境下的工具你就是用minGW的GCC编译出来也有相当大概率跑不了. ...

我试试,谢谢提醒。

sunliezhi 发表于 2014-3-6 16:39:45

cerr << "usage: 8051sim <HEX File> <Trace File>" << endl;
这是VC的格式吧

takashiki 发表于 2014-3-6 16:43:23

sunliezhi 发表于 2014-3-6 16:39
cerr

这是C++的操作符重载。

而且,这个后缀名cc就表明了,它100%不是VC的。

takashiki 发表于 2014-3-6 17:01:10

谁叫我今天闲得蛋疼呢,给你改一下了,有Warnings,我可不管了,要改自己改去,哈哈。
VC6格式,理论上VC5以上所有VC都可以打开。


改动的内容:
在每一个文件中加入了using namespace std;
VC中默认并不包含这个命名空间,必须using。似乎BCB也是不包含的,默认包含我觉得并不可取。
Warnings很多,产生的原因很简单,源程序将char和unsigned char等同,这是不负责任的作法,非常不负责任。我一直强调的,char、signed char、unsigned char是三种完全不同的数据类型,这里居然都有坑。当然,作为一个程序员,从来不用关心Warnings,只关心Errors。

oldbeginner 发表于 2014-3-7 22:05:25

takashiki 发表于 2014-3-6 17:01
谁叫我今天闲得蛋疼呢,给你改一下了,有Warnings,我可不管了,要改自己改去,哈哈。
VC6格式,理论上VC5 ...

哈哈,热心人就是多。

我要好好学习一下。
页: [1]
查看完整版本: 有人能帮忙编译下8051仿真器(c++)吗?有代码