开发者

Addressing Modes in PDP-11 Assembler

I have small question about pdp-11(simulator), I have this command (it begins from the address 1000) add 2500, #2500

and this initial list:

register/address - in开发者_运维百科itial value
pc                 1000
sp                 600
2500               3000

and I want to know how this small snippet exactly runs, in my booklet I found that: firstly it reads inforamtion from the address 1000, inside this address we have value 066727, after we read number from the address 1002, AND VALUE MUST BE 2500(because of add 2500, #2500), but in my booklet I have 1474 without any explanations why, I know that I have here relative addressing mode, but why 1474 inside the address 1002 and not 2500, thanks in advance for any help


If you have:

    add     2500,#2500      ;add content of location 2500 to immediate value.

The first word assembled will be the instruction, the second will be the address data for the first operand (the 2500), and the third will be the immediate value 2500. The PC relative addressing mode for the first operand will add the value of the PC to the value given to get the address of the operand. This will be the difference between 2500 and the PC at that point (1474, after the increment to read the offset).

1004 + 1474 = 2500, the address of the data.

Normally, one would do a:

    add     #2500,2500       ;add 2500 to the word at location 2500.

As the first example stored the result in the instruction stream.


ADD 2500,#2500

compiles as

    0:      066727 ; ADD
    2:      002474 ; 2500 - 6 (next instruction offset)
    4:      002500 ; #2500 (literal value)
    6:      ...    ; next instruction
  ...
 2500:      003000


I don't recall all the addressing modes, but look at address 1474 and see if it contains 2500.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜