在C ++/C中创建迷你汇编器 [英] create mini assembler in c++/c

查看:125
本文介绍了在C ++/C中创建迷你汇编器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何通过更改摩托罗拉MCR68000的此编码来创建迷你汇编器
到C或C ++的机器代码?请帮助我.....



ORG $ 4000
MOVE.B A1,D0
MOVE.B(A2),D1
ADD.B D0,D1
MOVE.B D1,(A1)+
LOOP MOVE.W(A1)+,-(A2)
BNE LOOP
END

how to create mini assembler by change this coding of Motorola MCR68000
to the machine code in c or c++?? please help me.....



ORG $4000
MOVE.B A1,D0
MOVE.B (A2),D1
ADD.B D0,D1
MOVE.B D1,(A1)+
LOOP MOVE.W (A1)+,-(A2)
BNE LOOP
END

推荐答案

4000
MOVE.B A1,D0
MOVE.B(A2),D1
ADD.B D0,D1
MOVE.B D1,(A1)+
LOOP MOVE.W(A1)+,-(A2)
BNE LOOP
END
4000
MOVE.B A1,D0
MOVE.B (A2),D1
ADD.B D0,D1
MOVE.B D1,(A1)+
LOOP MOVE.W (A1)+,-(A2)
BNE LOOP
END


最好是自己做作业.它被提供给您,以便您将学到一些东西,思考一下taucht.阅读教科书并尝试一下.

一旦有了代码并遇到问题,您总是可以带着一个更具体的问题回到这里,社区将竭尽所能为您提供帮助.不要忘了只张贴引起问题的相关代码位,因为代码转储通常根本无法帮助别人帮助/协助您.
It would be best if you do your own homework. It is given to you so that you will learn something, think about what have been taucht. Read your text books and give it a try.

Once you have code and run into problems you can always come back here with a more specific question and the community will do its best to help you. Don''t forget to post only the relevant code bits that pose the problem as a code dump is not usually helpful at all in getting someone to help/assist you.


如果您不能使用诸如lex/yacc(或堂兄弟flex/bison)之类的工具,则应编写自己的词法分析器和解析器.因为组装相对简单,所以这不应该是一项艰巨的任务(您可能会发现Crenshaw出色的构建一个编译器 [ ^ ](尽管过时,但很有用).
If you cannot use tools like lex/yacc (or the cousins flex/bison) then you should write your own lexer and parser. It shouldn''t be a daunting task, since assembly is relatively simple (you may find Crenshaw''s wonderful Let''s build a compiler[^], although dated, useful).


这篇关于在C ++/C中创建迷你汇编器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆