aspiringgeek

11-19-2008, 08:24 PM

I am trying to write the following assembly function store(regA,value) such that it writes to regA if first two bytes of regA are not 0xAB. If first two bytes of regA are 0xAB, store has to change first two bytes of regA so that writes go to some unknown other address.

I have this:

store(regA,val){

x0 = regA

x1 = regA and 0xFF00

x1 = x1 xor 0xAB00

if IsEqual(0, x1): write 0x0000, val

else write regA, val

I am told that it's possible to write this function in just two lines, not counting "write" instruction. Can anyone see how?

thanks

I have this:

store(regA,val){

x0 = regA

x1 = regA and 0xFF00

x1 = x1 xor 0xAB00

if IsEqual(0, x1): write 0x0000, val

else write regA, val

I am told that it's possible to write this function in just two lines, not counting "write" instruction. Can anyone see how?

thanks