assembly language to write Hello world

Source: Internet
Author: User
assembly language to write Hello world

Bo Master rookie one, is purely personal groping, do not like to spray. T_T 1.DOS, an abbreviation for the disk operating system, is a type of operating system on a personal computer. 2. assembly language running in the environment based on DOS operating system

3.masm is a tool group for the Assembly. (E:\compile\home the following 4 files into the local)

Masm.exe is a compiler that compiles the assembly code. ASM into an. obj file

Link.exe is a linked program used to generate the. obj file for an. exe executable file

Debug.exe is a debugging tool that can be used to break points

Edit.com is an editor that provides compilation code compilation 4. Because my computer is WIN10, I downloaded a DOS simulation environment tool: DOSBox, but this software is 16-bit

5. Operation steps: 5.1 open DOSBox
5.2 Input Mount C e:\compile\home (meaning to set E:\compile\home to Dos System (c) disk)
Because of this, you can not use the environment variable, to identify the masm,link,debug,edit instructions but only once valid
5.3 It is best to prepare the edited. asm file in advance (you can edit it with any editor, in advance because edit.com is not easy relative to another editor), place it in the file directory specified in 3.2, and then type the command:MASM hello.asm If the object filename appears
: (Regardless of it, press ENTER) if the source listing: (regardless of it, press Enter) if appear cross-reference
: (Regardless of it, press Enter) if 0 Warning Errors "means no error warning" 0 Server
Errors "means no server error" means the successful compilation of Hello.asm as Hello.obj
Now there's a new file in the directory called Hello.obj.
5.4 Type link hello.obj (meaning to generate the Hello.exe executable file) if run file: (regardless of it, press ENTER) if the list file: (regardless of it, press ENTER) appears if the libraries: (Whether it , press Enter) if link is present
: Warning L4021:no stack segment (regardless of it, press ENTER)
5.5 At this time the command line goes back to C:> (and the folder has Hello.exe) 5.6 Type the command hello.exe (that is, the executable file generated after compiling and linking the assembly code Hello.exe)

about the use of debug:

Enter command: R to view Register group initial values before the program runs

Enter command: U to view the assembly disassembly code. As you can see from the disassembly code, variables are compiled into direct addressing, using variables to represent valid addresses within the data segment

Input command: T, single step debugging

Enter command: D, observe memory changes (d with no address or range, default display of 80 bytes after the last D command)

Enter the command: G address, the program from the current location to run directly to the specified address to stop

Input command: E address to modify the contents of memory, such as: E ds:0100, enter a space can be modified by byte, carriage return stop Modify

PS: Then the problem comes, debug out of a lot of see do not understand, do.
Poke http://www.cnblogs.com/BoyXiao/archive/2010/11/20/1882716.html here.

resource Download : Requires two resources (I have uploaded in Csdn, no points )

DOSBox http://download.csdn.net/detail/xu_san_duo/9723755

masn5.0 http://download.csdn.net/detail/xu_san_duo/9723748 If it is helpful to you, please reprint a bit of praise.

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.