can u show me how they got this answers? Given the following program. What is th
ID: 1922417 • Letter: C
Question
can u show me how they got this answers?
Given the following program. What is the hexadecimal value of register X and register Y after the execution of gram?Explanation / Answer
The first answer appears to be wrong and I am assuming you are using some Motorola microprocessor possibly the 68hc11. NUMb: EQU 2*4; store 8 into NUMb NUMa: EQU 8>>2; >> is called the right hand shift operator and shifts the number of bits to the right X number of bits where X is the number to the right of >>. So in binary 8 originally looks like 1000. Shifting it to the right 2 times gives you 0010 which is 2 in decimal. ldy #NUMa; loads the value stored in NUMa into Y so in this case 2. This is our second answer. For the first answer: ldx: #~NUMb ; (NOTE this assumes ~ not -) ~ is the bitwise not operator. When applied it changes the zeros to ones and the ones to zeros. So we originally have 8 which is 0000 0000 0000 1000 since X is a 16-bit register. When we apply a bitwise not operation to 8 we get: 1111 1111 1111 0111 which is $FFF7. For the case where it is a negative number and not a bitwise not operation I will post this answer as well. ldx #-NUMb; (NOTE this assumes - not ~) - is the negative operator. In order to find a negative number we must take the two's complement of that number. In order to find the two's complement of a number we apply a bitwise not operation to the number and add one to the result. So originally we have 8 which is 0000 0000 0000 1000. When we apply our bitwise not operation we get: 1111 1111 1111 0111 which is $FFF7 Then we must add one to the result so we get: 1111 1111 1111 1000 which is $FFF8
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.