views:

326

answers:

3

please can someone tell how i will approach this Question..thanks

The contents of selected registers and memory locations are specified as follows; D1:2; D3:$80A3; D4:$91EF; D4: $91EF; A2:$00008000; SP: $9000; $ABCDEF7 stored at $8000; $00124300 at $7FFC for the following independent segments of code statements, determine the modified values (in hex) of the register, memory locations, status registers.

(i) BSET D1, (A2)

(ii) CMPI #$19F2, D4

(iii) AND.W D3, (A2)+

(iv) Move.L D3, -(A2)

(v) ROXR D1,D4

and SHow the STatue Register of X N Z V

My own ANSWER , i m not sure it is correct...

i) D1 remain unafected... x = - N= -, Z=0, v=-, C=-

V) count = 2 since D4 = $247B , So, D1 remain unchanged... x =1 N=0, Z=0, v=0, C= 1

but from Question (ii ---> iv) i am still confuse about it

+1  A: 

The best approach to your problem is to obtain the 68000 instruction set documentation from a site such as http://www.ticalc.org/pub/text/68k/ and use it to work out what the result of the instructions you listed will be.

anon
+1  A: 

Uh ... This is indeed very much like homework.

All you need to do is look at each instruction, figure out what it means (what the operation performed is), and decode the addressing.

For the first one, that is a BSET, which on the 68000 means "bit set", i.e. it sets a bit to a 1 somewhere. The addressing is decoded as "the bit index in register D1, the address in register A2". I will assume byte addressing, not sure if this is proper but I think so.

Since register D1 is said to contain the value 2, the register A2 is said to contain $8000, and the memory at $8000 is said to contain $0abcdef7, and the 68k is a big-endian CPU, this means the byte $0a will have its bit #2 set to a one. This is equivalent to a binary OR with the value $4, which results in $0e. And that is your answer.

unwind
+1  A: 

Grab a instruction cheet sheet for the 68000.

it should describe for each instruction the arguments, what it does and which flags it modifies.

BSET D1,(A2)

This will set the nth bit where n is a value from D1 after reading the byte from A2 which points to memory location $8000. The result will then be written back. The cheat will tell you how and why the various flags are updated. Note not all flags will be updated.

You probably will need to understand the various addressing modes available in the 68000.

(A2)+

Reads the value from A2 and advances the pointer to point to the next location. The actual amount depends on whether a byte,word or long word is fetched.

mP