cutting a word to put in two instructions (processor RISC)

I'm working with an microcontroller mpc555. I need to charge one register with an integer signed 32bits. But the instructions accept just numbers 16bits. So I cut it in two instructions:

li r30, value1
addis r30, value2

where value1 is the less significant bits and value2 the most.

Example: To put 100000 (hex: 000186A0 ) at the register r30, I do:
li r30, 0x86A0
addis r30, 0x0001

It works well to positive numbers, but I can't do it for negative numbers! I tried to put the values like a two's complement number but when I compile, it gives me an error saying that the number is bigger than 32767(16 bits signed: 2^15). So the processor doesn
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!