Question

In: Computer Science

From this information: the following code, explain which statements are instructions, which are assembly directives, which...

From this information: the following code, explain which statements are instructions, which are assembly directives, which are labels, and which are comments: ;"this"program"adds"3"to address $2000"and"increments"Accumulator"B """"""""

org"$4000

ldaa"$2000

adda"#3 ;"

add"3"to"(A)"

staa"$2000

incb ; increment"B

Solutions

Expert Solution

1. ;this"program"adds"3"to address

2. $2000"and"increments"Accumulator"B """"""""

3. org"$4000

4. ldaa"$2000

5. adda"#3 ";add"3"to"(A)"

6. staa"$2000

7.incb ; increment"B

1. The first line is a comment line in assembly language comments are written after the ; i.e. we first write this ; then write whatever we want assembler doesn't consider this for execution.

2. Is a address

3. The 3 one is a assembly directive.

4. ldaa is the instruction which is for data transfer.

5. Adda is the instruction which​ is add to a Register.

6. Staa is an instruction.

7. Inc is also an instruction which is for increment.


Related Solutions

Question: In the following MIPS assembly code, translate all the instructions to their corresponding machine code...
Question: In the following MIPS assembly code, translate all the instructions to their corresponding machine code in hexadecimal format. This code is stored in the memory from address 0x2fff0004. Loop: lw $t0, 4($s0)             addi $t1, $t1, -15             sll $t1, $t1, 2             beq $t1, $s1, Exit             addi $s0, $s0, 4             j Loop Exit: …
Identify the directives and statements in the following program. What is the output of the program?...
Identify the directives and statements in the following program. What is the output of the program? [2 points] #include <stdio.h> int main (void) { printf(“Parkinson’s Law: \n Work expands so as to \t”); If i and j are positive integers, does (-i)/j always have the same value as –(i/j)? Justify your answer. [2 points] printf(“fill the time \n”); Supply parenthesis to show how a C compiler would interpret the following expressions: [2 points] a * b – c *d +...
HCS12 Assembly code please. Translate the following code into assembly. Allocate each variable on the stack....
HCS12 Assembly code please. Translate the following code into assembly. Allocate each variable on the stack. Simulate your program and screenshot the final value of the variables in memory. { char A,B,C; int F; A = 2; B = 6; C = - 10; F = (A + B)*C; C = F +10 }
4. Explain what is happening on each line of the following AVR assembly code. If you...
4. Explain what is happening on each line of the following AVR assembly code. If you were to execute this code what would be the final decimal values in R20, R21 and SREG registers? BCLR 0 BCLR 1 BCLR 2 BCLR 3 BCLR 4 BCLR 5 BCLR 6 BCLR 7 LDI ​R19, 0x02 LDI​R20, 0x74 LDI​R21, 0x04 LDI​R22, 0x22 ADD​R20, R22 SUB​R22, R21 ADD​R20, R21 MOV​R20, R21 JMP​DONE ADD​R21, R20 SUB​R21, R22 DONE:​SUB​R20, R21 -embedded system-
The following code fragment is expressed in arm assembly code. Fill in the blanks, so that...
The following code fragment is expressed in arm assembly code. Fill in the blanks, so that it is equivalent to the following C code. int counter; int x = 5; int y = 6; for (counter =10; counter >0;counter--) IF(X==Y) Y = Y + 1 ; ELSE Y = Y + 2} Fill in the blanks in the following code: MOV__________ ;loop counter into r0-ten times round the loop MOV__________ ;Value of y loaded into r1 MOV__________ ;Value of x...
Write assembly code for the following machine code. Assume that the segment is placed starting at...
Write assembly code for the following machine code. Assume that the segment is placed starting at location 80000. Create labels for jump and branch instructions. Indicate the actual memory addresses represented by such labels. 0010 1010 0000 1000 0000 0000 0000 1010 0001 0001 0000 0000 0000 0000 0000 0010 0000 0010 0001 0001 1000 0000 0010 0000 0000 1000 0000 0000 0100 1110 0010 0101 0000 0010 0001 0010 1000 0000 0010 0000
a. Write machine code for the following assembly code. Assume that the segment is placed starting...
a. Write machine code for the following assembly code. Assume that the segment is placed starting at location 80000. Use decimal numbers to represent each instruction. loop:         beq $s3, $s1, endwhile                  add $t0, $s3, $s4                  lw $t1, 0($t0)                  add $s0, $s0, $t1                  addi $s3, $s3, 4                  j loop endwhile: b. Write assembly code for the following machine code. Assume that the segment is placed starting at location 80000. Create labels for jump and branch instructions. Indicate the actual...
Fill in the missing information from the statements below sothat the entire code block fulfills...
Fill in the missing information from the statements below so that the entire code block fulfills the program requirements from the last step and prints the desired output. You only need to supply the parts of each statement that are not shown below.Fill in the Blanks — Fill in the blanksnumber1 = int(_________ ("Enter the first number: "))number2 = __________ (input("Enter the second number: "))the_sum = _________print(  )_____________
Explain the section of code in the setup() function that implements the following instructions Wire.beginTransmission(0x68); Wire.write(0);             ...
Explain the section of code in the setup() function that implements the following instructions Wire.beginTransmission(0x68); Wire.write(0);              // set the address byte sec = Wire.read(); Wire.endTransmission();     // stop transmitting Wire.beginTransmission(0x68); Wire.write(0);              // set the address Wire.write(sec & 0x7F);     // clear CH bit Wire.endTransmission();     // stop transmitting Why is this necessary?
Translate these two LEGv8 assembly instructions to 32-bit binary machine code. Give your answer in hexadecimal....
Translate these two LEGv8 assembly instructions to 32-bit binary machine code. Give your answer in hexadecimal. CBZ X19, exit ADD X10, X19, X20 exit:
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT