Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Initial contents: D5 0x0033EDBC A5 = 0x0001 0000: A 6 0x0001 0002; Memory Location 0xFFFE 0x10000 0x10002 0x10004 0x00 0x22 0x44 0x66 0x11 0x33 0x55
Initial contents: D5 0x0033EDBC A5 = 0x0001 0000: A 6 0x0001 0002; Memory Location 0xFFFE 0x10000 0x10002 0x10004 0x00 0x22 0x44 0x66 0x11 0x33 0x55 0x77 (a)Show the contents of D5 and A5 after the following instruction (b)Show the contents of A5 and A6 after the following instruction ADDA . L 2(%A5 ), %A6 Show the contents of A5 and D6 after the following instruction MOVE . L (c) (%A5 ) + ,-( %A6 ) 5. [8 points] Fill in the following assembly language program to find how many "l" in four 16- bit number which is located starting at the memory address 0x1234. The program should start at 0x10000 and the result (the number of"1") should store in data register D3. ORG 0x10000 CLR.L %D3 MOVE. L LEA //Initialized 0 into D3 (the result) //set up the counter to count the 16-bit number //Pointing A0 to the initial data location //Initialized 0 into DO //Load the 16-bit number into DO and increment //A0 points to the next data location //shift 1 bit Right in DO //If the carry bit-o, branch to CoUNT //otherwise, add 1 into the result //Decrement the Counter D5 , 8A0 NEXT CLR.L %D0 MOVE ,8D0 LOOP ASR. L ,8D0 COUNT #1, %D3 ADD 1.L COUNT SUBI #1,8D5 BNE LOOP //compare memory location to check if all //data have been read already //yES, done //set up the counter again //NO, next data //END the program BEQ EXIT MOVE . L #16, %D5 BRA NEXT EXIT TRAP #15 Initial contents: D5 0x0033EDBC A5 = 0x0001 0000: A 6 0x0001 0002; Memory Location 0xFFFE 0x10000 0x10002 0x10004 0x00 0x22 0x44 0x66 0x11 0x33 0x55 0x77 (a)Show the contents of D5 and A5 after the following instruction (b)Show the contents of A5 and A6 after the following instruction ADDA . L 2(%A5 ), %A6 Show the contents of A5 and D6 after the following instruction MOVE . L (c) (%A5 ) + ,-( %A6 ) 5. [8 points] Fill in the following assembly language program to find how many "l" in four 16- bit number which is located starting at the memory address 0x1234. The program should start at 0x10000 and the result (the number of"1") should store in data register D3. ORG 0x10000 CLR.L %D3 MOVE. L LEA //Initialized 0 into D3 (the result) //set up the counter to count the 16-bit number //Pointing A0 to the initial data location //Initialized 0 into DO //Load the 16-bit number into DO and increment //A0 points to the next data location //shift 1 bit Right in DO //If the carry bit-o, branch to CoUNT //otherwise, add 1 into the result //Decrement the Counter D5 , 8A0 NEXT CLR.L %D0 MOVE ,8D0 LOOP ASR. L ,8D0 COUNT #1, %D3 ADD 1.L COUNT SUBI #1,8D5 BNE LOOP //compare memory location to check if all //data have been read already //yES, done //set up the counter again //NO, next data //END the program BEQ EXIT MOVE . L #16, %D5 BRA NEXT EXIT TRAP #15
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