Using Dosemu to write a compilation in a Linux environment

Source: Internet
Author: User

The content of this chapter is assembly language, now the opportunity to write the assembly is not much, but must be able to read, the core of information security thinking "reverse" in this has a very good and direct embodiment, disassembly is direct reverse engineering.

So I was in the previous days of study in the Ubuntu environment installed can write DOS software, the following is the specific process:

    • Install DOSEMU simulated DOS environment under Ubuntu:

Instruction: sudo apt-get install Dosemu

    • Run

sudo dosemu

Dosemu see under the C and D disk is only virtual out, the corresponding directory under the ~/.dosemu/drives:
Execute command:

CD ~/.dosemu/drives

DOS used under the program placed in the ~/.dosemu/drives/d/bin directory:

DOSEMU has its own debug, to compile the assembly code also need to add Masm.exe and Link.exe program (need to download online):

    • Write assembly code:

Write in DOS with your own edit editor, enter command edit

After opening the mouse select File->new to start writing, then select Save as saved as. asm suffix file can be

In C-disk corresponding to the ~/.DOSEMU/DRIVES/C directory with vim written

But may feel in this directory to write the program is a bit cumbersome, not very good management program, and we usually used to write programs in the home directory dedicated folder (my ~/program/assembly/nasm directory is dedicated to the assembler). We can create a soft link in the C drive directory:

sudo ln-s ~/program/assembly/nasm./asm

In this way we write the assembly code under the ~/program/assembly/nasm, under DOS into the ASM directory can be directly compiled.

    • Assembly Links:

Compile the Hello.asm file written above

Assembly
Execute command:

Masm

Enter the file name Hello, do not need to add a suffix. asm, and then always enter, assemble to complete, generate the Hello.obj file.


Link
Execute command:

Link

Enter the file name Hello, do not need the. obj suffix, and then always enter to generate the executable program hello.exe, (there is an error to ignore).


Run
Enter Hello to run the program

    • Exit

Exitemu

Using Dosemu to write a compilation in a Linux environment

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.