taocp

This site has no text of the book. Keep your own copy of TAOCP next to it. See what is checked.

Exercise · Volume 1 · 1.3.1-4

Exercise 1.3.1-4

not stated yet in Lean solution written

Rating00
KindInformal: the exercise has no formal statement, so Lean does not state it from the written solution
SectionSection 1.3.1 of Volume 1. Companion chapter: Description of MIX

The task

Explain why the instruction LDA -2000,4 is legal although memory addresses are not negative.

The exact wording is in your copy of the book.

Solution

Show the solution

The rule that an address lies between 00 and 39993999 applies to MM, the address after indexing. For LDA -2000,4 the machine adds the content of index register 4 to the number −2000-2000. If rI4 holds a value of 20002000 or more, then M=rI4−2000M = \text{rI4} - 2000 is at least 00. If rI4 is at most 59995999, then MM is at most 39993999. So the instruction is legal for each rI4 from 20002000 to 59995999, and it is undefined for other contents.

Remarks

Such an instruction is useful in a loop that counts an index register up from a negative value, as in the programs of Section 1.3.2.

This solution is drafted, and a person has not reviewed it yet. The source.

In Lean

not stated yet The exercise is not stated in Lean yet.

The status is computed from the Lean build. The node of the map.

Something is wrong? Report it.