我怎么能采取一些MOD组装摩托罗拉M6800 [英] How can I take mod of a number in assembly in Motorola M6800

查看:279
本文介绍了我怎么能采取一些MOD组装摩托罗拉M6800的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我怎么能采取一些例如MOD的摩托罗拉M6800.Please一%9组装告诉我,我应该使用哪一个助记符。

How can I take mod of a number for instance a%9 in assembly in Motorola M6800.Please tell me which mnemonics should I use.

推荐答案

最后,如果没有记错,6800没有一个除法指令(IIRC这是在6809加的),所以你必须实行分工你自己(或者,如果你不关心速度,只需减去除数反复,直到结果小于除数,这就是你的余数)。

At last if memory serves, the 6800 doesn't have a division instruction (IIRC that was added in the 6809), so you'll have to implement division on your own (or, if you don't care about speed, just subtract the divisor repeatedly until the result is less than the divisor, and that's your remainder).

要弄清楚刚才剩下的(不分裂)实际上是pretty容易二进制:

To just figure the remainder (without the division) is actually pretty easy in binary:


  1. 左移除数,直到它的更大的股息

  2. 转变是正确的一个地方

  3. 如果这是比分红更小,从分红减去它

  4. 重复步骤2和3,直到还剩下些什么股息比除数

  5. 这是你的剩余

例如,让我们的身影,其余除以127 9.我们开始通过移动9左后:

For example, let's figure the remainder after dividing 127 by 9. We start by shifting 9 left:

127 = 0111 1111
9   = 0000 1001

左移,直到你得到:

shift left until you get:

  0111 1111
  1001 0000

反复转移加减:

      0111 1111
-     0100 1000
=     0011 0111

      0011 0111
-     0010 0100
=     0001 0011

      0001 0011
-     0001 0010
=     0000 0001

由于1是小于9,我们有剩余的空间:1.如果您要检查,9x14 = 126

Since 1 is smaller than 9, we have our remainder: 1. In case you want to check that, 9x14=126.

这篇关于我怎么能采取一些MOD组装摩托罗拉M6800的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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