Question: Problem 1) Given following Sim68 assembly program: org $1000 sub d1,d1 movea d1,a0 move n(a0),d2 move x(a0),d0 loop move neg_one (a0), d1 add d1,d0 cmp

Problem 1)

Given following Sim68 assembly program:

org $1000

sub d1,d1

movea d1,a0

move n(a0),d2

move x(a0),d0

loop move neg_one(a0), d1

add d1,d0

cmp d0,d1

blt loop

muls d0,d0

move d0,y(a0)

swap d0

move d0,y+2(a0)

move exitcode(a1),d0

trap #0

n dc 10

x dc 15

neg_one dc -1

y ds 2

exitcode dc 3

end

a) What does the code segment do?

b) Generate the corresponding machine code (generate all addresses). Provide your answer in Binary as well as in HEX.

Problem 2)

Generate the Sim68 assembly program for the following machine code assuming it originates at address $0000:

1001 0000 0100 0000

0011 0000 0100 0000

0011 0100 0010 1000

0000 0000 0010 0100

0011 0110 0010 1000

0000 0000 0010 0110

0011 0010 0010 1000

0000 0000 0010 1000

1101 0000 0100 0001

1101 0000 1100 0011

1001 0100 0100 0011

0110 1110 0000 0000

1111 1111 1111 0000

0011 0010 0000 0000

1001 0000 0100 0000

1101 0000 0100 0011

0100 1110 0100 0000

0000 0000 0000 0000

0000 0000 0000 0001

1111 1111 1111 1111

1111 1111 1111 0000

0000 0000 0000 0011

Using for both problems:

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!