"Computer programming art" learning notes (1)

xiaoxiao2021-03-06  96

First, MIX

Although Knuth is not a Mix, on the 3rd edition and his own homepage, the declaration is about to be replaced with MMix, but for beginners, such as me, the full book first school Mix seems to be more convenient, in order to learn the content behind Tacop Learn more about MIX appears to step.

Command format is generally

Op Address, i (f)

OP is the command keyword, address is the address, i is the index register, F is a byte description.

The format is also: OP Address (f), this Knuth did not mention, but did not ask if the I did not write, it was normal, but the knut did not expect the rookie as myself, but I couldn't be able to save the address. .

As for the other F, it is very well understood, and Knuth has an explanation.

Load operator, (LDA, etc.) Storage Operator (STA, etc.), note that the F section describes the byte of the memory address rather than the register, this is confused for a long time. The order in the installation is from low to high.

Arithmetic Operators: Add, Sub, Mul, DIV

Only related to RA. It is related to RA and RX.

Address section described later in the address transfer operation (ENTA, INCA, DECA, etc.), described in the address section.

Compare operators: Compare registers and memory values.

The MOVE is moved from the unit M to the content referred to by the content of R1, and the number of times is specified, and the value of f after the event is added.

Num, change the character code into numeric code, M is ignored, N1 is 1, N2 to 2,

Char, not Num's countercarriers, plus 3 before n, affecting RA and RX.

Note: RX is the right side of RA.

Exercise details:

STZ 1

Address 1 Qing 0

Ennx 1

RX = -1

Stx 1 (0: 1)

-

1

0

0

0

0

Address 1

SLAX 1

-

0

0

0

0

0

-

0

0

0

1

0

RA RX

Enna 1

Ra = -1

Incx 1

-

0

0

0

0

63

RX

ENT1 1

R1 = 1

SRC 1

-

63

0

0

0

0

-

1

0

0

0

0

RA RX

Add 1

-

0

0

0

0

0

Ra overflow

Dec1 -1

R1 = 2;

STZ 1

-

0

0

0

0

0

Address 1 Qing 0

CMP 1

Compare RA and Address 1, equal, because 0 and negative zero are equal.

MOV -1, 1 (1)

Move the content of the address 1 to the address 2 (specified by R2). Move this one, after the event, R2 = 3;

Num 1

-

0

0

0

0

0

-

1

0

0

0

0

1000 = 2 * 64 * 64 28 * 64 16

-

0

2

Twist

16

-

1

0

0

0

0

RA RX

Char 1

-

30

30

30

30

30

-

31

30

30

30

30

RA RX

HLT 1

转载请注明原文地址:https://www.9cbs.com/read-100821.html

New Post(0)