Assembly Language Learning 01

Source: Internet
Author: User

Assembly Language (8086CPU)

Well, to learn a course, I think there should be a certain degree of discipline, and I have to add to the thought to learn, organized: the best is the overall introduction of the whole book, and then detailed introduction of the various chapters, and, book chapters of the Directory has a certain degree of coherence, is progressive, the front of the study, For the back of the content to do a good job, laid the foundation. Can't just lay it down (understand the computer system is the best I've read)

Reading materials: Wang Shuang's "assembly language" textbook is better.

Below, after reading three chapters, write your own harvest.

Assembly language: Based on the underlying languages. When studying this book, I learned that the principle of computer composition will play a good role in the study of this book.

First, let's take a look at the composition of the computer. Today's computers are generally von Neumann computers: Five parts: Input devices, output devices, operators, controllers, and memory. They are connected by a bus.

In fact, the computer is a bunch of physical originals, they are composed of each other, through the bus connection, the final formation of computer (bare metal).

The most important part of the computer is the CPU.

The computer is used to process data. But how is data stored in a computer? Therefore, the need to produce storage systems: main memory, auxiliary and so on. How is the data represented in the computer? will produce a discussion of the system. The best is binary. So, all data in the computer, instructions are in binary notation (binary with high and low level to convert the representation)

All the information, there are corresponding tables (corresponding rules).

Computers to process information: data, directives, and so on.

Processing instructions, then, how to execute the instructions? How do I determine if the data read in memory is an instruction? How to determine the length of the instruction and when does the instruction terminate?

Before you know this, how do you know in memory to determine if a read is an instruction? But how do you determine which address to read?

8086CPU Address Determination: Physical Address = Segment Address *16+ offset address. (That is, determine a reference point and then determine the coordinates relative to the reference point). The segment address is stored in the segment register, and the offset address is placed somewhere (different information, placed in a different location). Instruction: The segment address is placed in the data segment CS, the offset address is placed in the instruction pointer register IP, the physical address in memory is determined by CS:IP (CS*16+IP)

Having understood how to determine the position of the instruction in memory, let's discuss how to transfer and execute the instructions.

For simplicity:

1.cs:ip the in-memory read instruction into the instruction buffer,

2.IP changes, pointing to the next instruction.

3. Execute the instructions and turn to step 1.

  

 Note: There are registers inside the CPU (to speed up reading information, acceleration): 4 Data registers (AX,BX,CX,DX), 2 variable address registers (DI,SI), 2 pointer registers (SP,BP), 4 segment registers, 1 instruction pointer registers and one symbol register, total 14.

Processing data: Similar to CPU processing instructions, the address of the data is determined: ds*16+ offset address [...]

Stack: A piece of memory in a computer, a stack segment, consisting of a contiguous memory address, which is a multiple of 16 of the starting address. The maximum stack segment is 64k.

So how do you determine the stack segment? How do I read data from a stack segment? Stack top element? How is an empty stack represented?

Similar to the above method of determination: SS:SP, the transformation of the top element of the stack is from the high address to the low address of the direction of growth. Empty stack: The top pointer of the stack points to the next storage unit of the highest address.

Note: The segment registers inside the CPU cannot participate in arithmetic operations (that is, they cannot be assigned directly), and an intermediate register must be added (as with two value exchanges).

························································································································· ····························

Later is to write their own first assembly program, not to be continued .....

Assembly Language Learning 01

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.