I am trying to convert this pseudocode into LC4 assembly language
B = 0
If (A >= 0) {
While (B*B <= A) {
B = B + 1
}
}
B = B - 1
What mnemonic do I use for an if statement? Would it be CMP and for the while statement CMPI?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
I would say it’s the other way around, the
ifcompares against a constant, while thewhiledoes not. So usecmpito compareAagainst0andcmpto compareB*BagainstA.