INC AL不会增加1 [英] INC AL is not incrementing by 1

查看:198
本文介绍了INC AL不会增加1的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试将汇编代码转换为nodejs.

I am trying to convert assembly code into nodejs.

但是我目前卡在INC AL上,突然使AL变为0xCA,然后变为0xCB.

But I am currently stuck on a INC AL suddenly making AL 0xCA, then 0xCB.

这是ASM:

CMP AL, DL // DL = 09, AL = 35
JA SHORT   // jump is taken
SUB DL,AL  // ---> jumped
JMP SHORT  // ---> jumped
NOT AL     // AL = 35
INC AL     // AL = CA (which is 202)
ADD DL, AL // AL = CB, DL = 09

现在INC AL如何将35变成CA? inc应该不是i++吗?

Now how did INC AL make 35 into CA? Isn't inc suppose to be i++?

我的nodejs代码:

My nodejs code:

// cmp al, dl
if (b <= a) {
  a -= b;
} else {
  // a++;
  a += 0xcb;
}

推荐答案

NOT AL会按位反转您的价值.

NOT AL is bitwise inverting your value.

NOT(35) -> CA    00110101 -> 11001010
INC(CA) -> CB

这篇关于INC AL不会增加1的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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