What is the behaviour of STA (0:1) in MIX?

62 views Asked by At

In MIX STA stores the contents of the A register in a given memory location.

I can't see how the behaviour around the sign is covered in TAOCP. How does MIX behave in the following example:

Location 2000 contains: + 5 4 6 2 1

The A register contains: - 7 8 1 3 2

What does STA 2000 (0:1) do?

Is this thought of as taking the values 3 2 from the A register and putting them in the field 0:1 of memory location 2000? If so, is there an implicit conversion of any non-sign value to a +? Or does the 0 in the field specification mean "take the sign of the A register, and any remaining bytes and put those values into the location"?

Interpretation 1: 2000 -> + 2 4 6 2 1

Interpretation 2: 2000 -> - 2 4 6 2 1

Or is there a third option?

1

There are 1 answers

0
Chris Hall On BEST ANSWER

So, yes in the definition of STA, the F field is funky.

Reading Section 1.3.1, Storing Operations (p 130 of my Volume 1, Third Edition) I find:

On a store operation the field F has the opposite significance from the load operation: The number of bytes in the field is taken from the right-hand portion of the register and shifted left if necessary to be inserted in the proper field of CONTENTS(M). The sign is not altered unless it is part of the field. [my emphasis]

It gives various examples, where:

  Location 2000 contains: | - | 1 | 2 | 3 | 4 | 5 |
  Register A    contains: | + | 6 | 7 | 8 | 9 | 0 |
  STA 2000(0:1) gives:    | + | 0 | 2 | 3 | 4 | 5 |

which is your Interpretation 2.

It seems that the F field refers to the field in the destination word, and:

  • if F is (0:0):

    • the sign of the source is stored in the sign of the destination,
    • the rest of the destination is unchanged.
  • if F is (0:n) (n in 1..5):

    • the sign of the source is stored in the sign of the destination,
    • the n right-hand bytes of the source are stored in bytes (1:n) of the destination,
    • the rest of the destination is unchanged.
  • if F is (m:n) (m in 1..5, n in m..5):
    • the n-m+1 right-hand bytes of the source are stored in bytes (m:n) of the destination,
    • the rest of the destination (including the sign) is unchanged.

[It's a long time since I last even considered MIX... I confess I had remembered it as too quirky to be useful. I cannot say that I have changed my mind !]