装配控制器编程 [英] Assembly controller programming

查看:68
本文介绍了装配控制器编程的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的代码是:

  org 0 
mov a,r0
mov r0,
mov r1,
mov r2,
结束





a - 累加器

r0 - r2 - 内部存储器寄存器



我正在使用asm51编译器,并在fd51.exe中加载.hex文件





是否可以放置第3行,第4行和第5行一个,像mov(r0,r1,r2),?

解决方案

是的,你可以使用:

< pre lang =asm> org 0
mov a,r0
< span class =code-keyword> mov r2,
end



由于中间的指令是多余的,并且没有效果。



你应该知道了编程中的大多数都像数学一样,方程式/操作只有两个方面,如果你不做一些有用的事情,你可以将中间操作分解出来。


My code is:

org 0
    mov a,r0
    mov r0,a
    mov r1,a
    mov r2,a
end



"a" - accumulator
"r0 - r2" - internal memory registers

I'm using asm51 compiler, and load .hex file in fd51.exe


Is it possible to put 3-rd,4-th and 5-th rows into one, something like "mov (r0,r1,r2),a"?

解决方案

Yes you can just use :

org 0
    mov a,r0
    mov r2,a
end


Since the instructions in between are redundant, and have no effect.

You should be aware that most of programming is like mathematics and there are only two sides to an equation/operation, and if you don't do something useful in between you can factor the middle operations out.


这篇关于装配控制器编程的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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