Assembly language (Wang Shuang) Chapter 3rd register (Memory Access)

Source: Internet
Author: User

3.1 In-memory words

In-memory words are 16 bits, stored in 2 memory units

Address large storage high (8 digits to the left of the word), the address is small low (8 digits to the right of the word)

Word cell: A memory unit that holds 1 glyph data, consisting of 2 memory units, a total of 16 bits

3.2 DS

The name of a register that is used to place the segment address of the data segment

The MOV instruction can transfer the data to register, the contents of one register to the other register, the inside deposit element (Word unit) go to register

But generally will mov Ax,1000h;mov ds,ax instead of direct mov ds,1000h

Because 8086CPU does not support the direct transfer of the memory unit to the segment register.

3.3-word transfer

Straight on chestnuts

MOV ax,1000h

MOV ds,ax;

MOV ax,[0]

Assuming that the 10000h data is 11h,10001h, the data is 22H

Then after the instructions are executed, the AX data is 2211H

Indicates that something in memory is transferred in 1-character units, or 2 bytes, into a register.

3.4 mov Add Sub

Move, add and subtract

3.5 Data Segments

To cut a piece of memory into a process. Storing data, artificially defined, system not recognized

If you want the system to know that the memory is put into the data, just use the segment address in DS to point to its address.

3.6 Stacks

The stack also takes a piece of memory and follows the LIFO principle.

Identifying a memory segment with SS:SP is a stack

3.7 CPU-provided stack mechanism

The basic instruction is out of the stack and into the stack, in words

The top element of the stack is specified by the SS:SP2 register

Enter the stack first sp+2 then push in

Out of the stack first pop out again sp-2

3.8 Beyond the Stack

Because the stack is a memory space, there is a size

Push too much and pop too much will run outside the stack, affecting other memory

8086 there is no way to limit the top and end of the stack, you can only pay attention to

3.10 Stack Segment

This is the memory segment, but the SS:SP point

The SP is a 16-bit register, so the stack span is 0000-ffff

Section Summary

Segment storage data called data segment, segment address is DS, when using mov,add,sub and other instructions to access the memory unit, the CPU will be the content of our defined data segment as data to access

Segment storage code is called the code snippet, which is the instruction segment. Point to the CS:IP so that the CPU executes the instructions in the code snippet we defined

Segment as stack called stack segment, point is SS:SP, when the CPU into the stacks operation, such as Push,pop to our defined stack segment as the stack space

Completed ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Assembly language (Wang Shuang) Chapter 3rd register (Memory Access)

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.