0
\$\begingroup\$

This is a question on a hand out, it asks:

What is the machine code that corresponds to the AVR Assembly Language Instruction inc r22? Enter your answer as a 16 bit binary number. There must be no spaces or punctuation marks - just enter sixteen 1's or 0's.

I found the corresponding machine code which is 1001 010d dddd 0011. I added the binaries together for 22 which is 16 + 6 so:

10000 +たす 110
= 010110

I assume from here that you just sub it into the d's hence,

1001 010d dddd 0011
1001 0101 0110 0011

And there's the 16 bit answer. Is this correct, or have I done this the wrong way?

angelatlarge
3,63124 silver badges37 bronze badges
asked Apr 14, 2013 at 8:32
\$\endgroup\$
5
  • \$\begingroup\$ Where did you find 1001 010d dddd 0011? \$\endgroup\$ Commented Apr 14, 2013 at 9:08
  • \$\begingroup\$ @jippie avr assembly documents \$\endgroup\$ Commented Apr 14, 2013 at 9:11
  • \$\begingroup\$ Do you have a link to it? \$\endgroup\$ Commented Apr 14, 2013 at 9:23
  • \$\begingroup\$ You want the AVR Instruction Set document - doc0856.pdf \$\endgroup\$ Commented Apr 14, 2013 at 9:26
  • \$\begingroup\$ Did your teacher work in web design? "Enter your credit card with no spaces, because we can't figure out how to remove them before handing them to the processing API ...". \$\endgroup\$ Commented Apr 14, 2013 at 15:59

1 Answer 1

1
\$\begingroup\$

Check it with the assembler!

The code I get for inc r22 is 0x9563, which is 1001010101100011. You are correct!

answered Apr 14, 2013 at 9:16
\$\endgroup\$
2
  • \$\begingroup\$ I have no idea how to use the assembler yet, i suck! Thank you \$\endgroup\$ Commented Apr 14, 2013 at 9:39
  • \$\begingroup\$ @jameskensington: Maybe you can improve your answer by describing how to "check it with the assembler"? \$\endgroup\$ Commented Apr 14, 2013 at 16:48

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.