Take the 2-minute tour ×
Code Review Stack Exchange is a question and answer site for peer programmer code reviews. It's 100% free, no registration required.

Converting assembly code to nodejs,

Having the assembly code:

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

Converted to nodejs code:

if (dl <= al) {
  al -= dl;
} else {
  al = (~al) && 0xFF;
  al++;
  dl += al;
}

Can this be improved?

I was thinking:

else {
  dl -= al;
}
share|improve this question
    
Place a label in your assembly to show where JA SHORT and JMP SHORT go. –  Bob65536 Apr 3 at 5:01
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.