"Computer Programming Art" Learning Notes (i) _ Storage

Source: Internet
Author: User
Tags arithmetic operators

One, mix<?xml:namespace prefix = o ns = "Urn:schemas-microsoft-com:office:office"/>

Although Knuth for mix full, in the 3rd edition and his own home page, the announcement is about to be replaced by mmix, but for beginners like me, it seems to be more convenient to learn the mix first, in order to learn Tacop later, to understand the mix seems to be a necessary step.

The command format is generally

OP Address,i (F)

OP is the command keyword, address is the location, I is a change register, F is a byte description.

Format may also be: OP address (F), this point Knuth did not mention, but do not require to write I part of the site is very normal, Knuth but did not think rookie like me but at the beginning of the time to omit is the address.

As for sometimes it is very understandable to omit the F section, Knuth has a description.

Load operator, (LDA, etc.) storage operator (STA, etc.), note that the F section describes the memory address rather than the byte of the register, which I am also confused for half a day. The order of loading is from low to high.

Arithmetic operators: Add, Sub, mul, div

is only associated with RA. is related to both RA and Rx.

Address (Enta, INCA, DECA, etc.) that is described in the Addresses section is the number.

Comparison operators: The values of registers and memory are compared.

Move is moved from cell m to the cell in the R1 's content, the number of times F is specified, followed by the value of R1 plus F.

NUM, the character code into a numeric code, M is ignored, N1 into 1,n2 into 2,

CHAR, which is not the inverse of NUM, adds 3 before N, affecting Ra and Rx.

Note: Rx is the right complement of RA.

Exercise Detailed Analysis:

STZ 1

Address 1 Ching 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 Ching 0

CMP 1

Compare RA to address 1, equal because positive 0 and minus 0 are equal.

MOV-1, 1 (1)

Move the contents of address 1 to address 2 (specified by R2). Only move this one, afterwards r2=3;

NUM 1

-

0

0

0

0

0

-

1

0

0

0

0

10000=2*64*64+28*64+16

-

0

2

28

16

-

1

0

0

0

0

RA RX

CHAR 1

-

30

30

30

30

30

-

31

30

30

30

30

RA RX

HLT 1

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.