Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Q.5. (5 points) Contents of the memory are as follows. BRA instruction uses relative addressing. What should be the offset in the BRA instruction in
Q.5. (5 points) Contents of the memory are as follows. BRA instruction uses relative addressing. What should be the offset in the BRA instruction in order to branch to the following address? Show all calculations. OF8 i. Address 0F8H 100 BRA? 101Next instr. 1D6 Q.6. (10 points) Write the expanded code generated by the preprocessor for the following program. What will be printed when the code is run? Expanded code MProgic #include "headerl.h" #define A 5 #define f(x) 2x main ) int a=4, 3, C=10; #ifndef A CA. f(a+2); #else C=kf(b+2); tendir printf ("c: d ", C): Output headerl.h int k-6: Q.7. (5 points) In a text editor, initial contents of the text buffer are given as follows. Show the contents of the text area and the forward and backward links after the following insertion and deletion operations: backward link forward link Text area 0 Text area 10 FOR I=1 TO 5 20 A(I)-(I)+1 30 B-B/2 40 NEXT I INSERT 35 B=B+1 DELETE 20 1 2 3 4 Q.8. (10 points) Given the following assembly language program and its equivalent machine language code where some references are missing. The assembler generates a relocatable code. All references use direct addressing. Write the values of the location counter (LC) and the contents of the symbol table, and also fill in the missing references in the machine code. (Assume that 3 bytes are allocated for each instruction and WORD pseudo-operation allocates 3 bytes and stores the given number at that byte.) LC Symbol Table Ll: START INSTI INST2 D1 JAR L1 HLT WORD 5 END Machine code 00 00 D5 22 7B 23 4C 00 00 000005 22 D1: Q.5. (5 points) Contents of the memory are as follows. BRA instruction uses relative addressing. What should be the offset in the BRA instruction in order to branch to the following address? Show all calculations. OF8 i. Address 0F8H 100 BRA? 101Next instr. 1D6 Q.6. (10 points) Write the expanded code generated by the preprocessor for the following program. What will be printed when the code is run? Expanded code MProgic #include "headerl.h" #define A 5 #define f(x) 2x main ) int a=4, 3, C=10; #ifndef A CA. f(a+2); #else C=kf(b+2); tendir printf ("c: d ", C): Output headerl.h int k-6: Q.7. (5 points) In a text editor, initial contents of the text buffer are given as follows. Show the contents of the text area and the forward and backward links after the following insertion and deletion operations: backward link forward link Text area 0 Text area 10 FOR I=1 TO 5 20 A(I)-(I)+1 30 B-B/2 40 NEXT I INSERT 35 B=B+1 DELETE 20 1 2 3 4 Q.8. (10 points) Given the following assembly language program and its equivalent machine language code where some references are missing. The assembler generates a relocatable code. All references use direct addressing. Write the values of the location counter (LC) and the contents of the symbol table, and also fill in the missing references in the machine code. (Assume that 3 bytes are allocated for each instruction and WORD pseudo-operation allocates 3 bytes and stores the given number at that byte.) LC Symbol Table Ll: START INSTI INST2 D1 JAR L1 HLT WORD 5 END Machine code 00 00 D5 22 7B 23 4C 00 00 000005 22 D1
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started