Take the 2-minute tour ×
Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. It's 100% free, no registration required.

Im reading the Knuth's book TAOCP. And im just learning a simple math operations with registers. And there is an example of subtraction operation:

rA before: - | 1234 | 0| 0| 9
Cell 1000: - | 2000 |  150| 0
SUB 1000    
rA after:  + | 766  | 149 | ?

i understand that -1234-(-2000) = 766 but how (0 | 0) - 150 = 149 ??

and why 9 - 0 = ?

These are "packed" words. And maybe i need to read more about them. Or can anyone explain ?

share|improve this question

1 Answer 1

up vote 3 down vote accepted

The problem is that in MIX the byte size is not fixed. In | 2000 | 150| 0, although we know that the (3:4) field contains 150 we don't know what the (3:3) and (4:4) fields are individually.
A 6-bit-per-byte computer sees the low end of the computation as $$150\times 64 - 9 = 9591 = 149\times 64 + 55,$$so 149 is stored in the (3:4) field and 55 in the (5:5) field.
A 7-bit-per-byte computer sees the low end of the computation as $$150\times 128 - 9 = 19191 = 149\times 128 + 119,$$ so 149 is stored in the (3:4) field and 119 in the (5:5) field.
Thus the (3:4) field is 149 both times but the (5:5) field may vary and so is shown as unknown.

Note also the the default F-code (0:5) is being used with the SUB instruction, so the whole word is being used, and that fact that there appear to be packed values involved doesn't alter that.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.