I have this instruction:
Move @-4(pc), 766(r5)
pc : 1000 (start point)
Can you explain how this instruction should run?
I have this instruction:
Move @-4(pc), 766(r5)
pc : 1000 (start point)
Can you explain how this instruction should run?
I don't remember about pdp, but VAX syntax, which is an extension, would mean following: 766(r5) means that address of second operand is R5 + 766(octal if it is a PDP). @-4(RC) I guess means auto-decrement, so it takes RC, subs 4, reads a value which is an address of a variable. So, 4 bytes before the entry point has pointer to var1, var2 is at R5 + 766(oct); Move is obviously, moving instruction. And I guess, it moves OP1 to OP2.
Looks like PDP-11 code to me ... @-4(PC) means 'decrement the contents of the Program Counter by 4 to give you an address ... and the '@' means take the contents at that address. So if the PC is at 1000 you subtract 4 from it (in octal) to give you 774 and then you look inside address 774 for the contents (which is what the '@' means). Having got this value - the SOURCE operand we then have to put it somewhere i.e. a DESTINATION address. Go to R5 (General Purpose Register 5) and look in there for an address. Add 766 octal to that address and you have the DESTINATION address (whatever that might be).
The PDP-11s CPU can then move the SOURCE to the DESTINATIOn as it now has both. (And its a MOV instruction not a MOVe - all PDP instructions were 3 letter mnemonics if my memory serves me correctly - or at least most of them were)
Having said all that (!!) the SOURCE operand is below the 1000 mark i.e. its in a reserved area (addresses 0 to 1000 on a PDP-11 were 'reserved') so I wouldn't like to speculate on what would happen if this was a real instruction operating on a real PDP ... !!! System trap?
Take care
R