The design is a child of the 1960s, back when bytes had 6 bits and decimal computing was common. Machines had to compete with 10 digit calculators. It must be emphasized that this is a fictional architecture, actually implementing it will be difficult since a byte doesn't have a fixed size. MIX can work in binary where a byte stores 6 bits, you'd get the equivalent of a 31-bit machine: 1 bit for the sign and 5 x 6 bits for the bytes makes up a word. Or can work in decimal where one byte stores two digits (0..99). That doesn't fit in 6 bits (0..63), emphasizing the fictional part of the design.
It does share another common characteristic of machines back then, memory is only word addressable. Or in other words, you could not address a single byte like you can on all modern processors. So a trick is needed to lift byte values out of a word, that's what the (first:last)
modifier does.
Number the parts of the word from 0 to 5, left to right. 0 is the sign bit, 1 is the MSB (most significant byte), 5 is the LSB (least significant byte). The most important detail is that you have to shift the bytes, the last addressed byte in (first:last)
becomes the LSB in the destination.
So the simple ones to understand are LDA 2000(0:5)
, copies everything, LDA 2000(1:5)
, copies everything except the sign bit, LDA 2000(3:5)
copies 3 bytes without any shifting since the LSB is copied. As long as last
is 5 then nothing particularly special happens.
LDA 2000(0:0)
is easy to understand as well, it only copies the sign bit, none of the bytes.
LDA 2000(0:3)
is where the trouble starts. A picture might help:
+---+---+---+---+---+---+
| 0 | 1 | 2 | 3 | 4 | 5 |
+---+---+---+---+---+---+
|
v
+---+---+---+---+---+---+
| 0 | x | x | 1 | 2 | 3 |
+---+---+---+---+---+---+
(0:3) moves the sign bit and bytes #1 through #3. Note how byte #3 becomes the least significant byte in the destination word. It is this shift that probably causes confusion.
Perhaps LDA 2000(4:4)
becomes clear now as well. Only a single byte is copied, it becomes the LSB in the destination. Same recipe for LDA 2000(1:1)
, now moving byte #1 to byte #5.