Jacob Stinson
Jacob Stinson

Reputation: 301

In assembly language what does the line (r3)+ do?

I have some lines in assembly that I must be able to answer what the Effective Address (EA) of it is. The line are...

(R3)+

+(R2)

What do the plus signs do here? I know that (R3) would have an EA = [R3], but I do not understand the + signs and cannot find an answer anywhere. Thanks.

The assembly language is NIOS II

Upvotes: 3

Views: 454

Answers (1)

Ira Baxter
Ira Baxter

Reputation: 95354

This notation is common in assembly code on machines that do indirect addressing through registers, originally the PDP-11 but these days, I think a lot of DSPs.

What the (Rn) means typically is "indirect using the address in register N".

What +(RN) means, typically is "add one (storage unit) to register N, and then go indirect using the address in register N". What (RN)+ means, is "go indirect on the address in register N, and when done, add one (storage unit) to register N". -(RN) and (RN)- are analogs that "subtract one (storage unit)".

The notation, IIRC, was originally used on the PDP-11 in very early 1970s, and a variant climbed into the C language in the form of ++, -- and * operator combinations.

The PDP-11 also allowed addressing with an offset to a register, e.g., "k(RN)". DSPs may or may not allow this.

Yes, the details should be easily found in any programming manual for the device.

Upvotes: 2

Related Questions