搜索
bottom↓
回复: 8

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

[复制链接]

出0入0汤圆

发表于 2014-1-13 19:39:51 | 显示全部楼层 |阅读模式
本帖最后由 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[P0] == 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/

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有帐号?注册

x

出0入0汤圆

发表于 2014-1-13 20:43:38 | 显示全部楼层
要模拟,直接用keil就了吧。

出0入0汤圆

 楼主| 发表于 2014-1-13 20:55:08 | 显示全部楼层
KongQuan 发表于 2014-1-13 20:43
要模拟,直接用keil就了吧。

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

出0入0汤圆

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

出0入0汤圆

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

我试试,谢谢提醒。

出0入4汤圆

发表于 2014-3-6 16:39:45 | 显示全部楼层
cerr << "usage: 8051sim <HEX File> <Trace File>" << endl;
这是VC的格式吧

出0入93汤圆

发表于 2014-3-6 16:43:23 | 显示全部楼层

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

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

出0入93汤圆

发表于 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。

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有帐号?注册

x

出0入0汤圆

 楼主| 发表于 2014-3-7 22:05:25 | 显示全部楼层
takashiki 发表于 2014-3-6 17:01
谁叫我今天闲得蛋疼呢,给你改一下了,有Warnings,我可不管了,要改自己改去,哈哈。
VC6格式,理论上VC5 ...

哈哈,热心人就是多。

我要好好学习一下。
回帖提示: 反政府言论将被立即封锁ID 在按“提交”前,请自问一下:我这样表达会给举报吗,会给自己惹麻烦吗? 另外:尽量不要使用Mark、顶等没有意义的回复。不得大量使用大字体和彩色字。【本论坛不允许直接上传手机拍摄图片,浪费大家下载带宽和论坛服务器空间,请压缩后(图片小于1兆)才上传。压缩方法可以在微信里面发给自己(不要勾选“原图),然后下载,就能得到压缩后的图片】。另外,手机版只能上传图片,要上传附件需要切换到电脑版(不需要使用电脑,手机上切换到电脑版就行,页面底部)。
您需要登录后才可以回帖 登录 | 注册

本版积分规则

手机版|Archiver|amobbs.com 阿莫电子技术论坛 ( 粤ICP备2022115958号, 版权所有:东莞阿莫电子贸易商行 创办于2004年 (公安交互式论坛备案:44190002001997 ) )

GMT+8, 2024-5-3 10:30

© Since 2004 www.amobbs.com, 原www.ourdev.cn, 原www.ouravr.com

快速回复 返回顶部 返回列表