Writing assembly language with DOSBox under WIN8
DOSBox is a DOS simulation program that can be easily ported to other platforms , Therefore, it can be used to write assembly language in the WIN8 system . the relevant download links are provided below:
DOSBox Download: Http://pan.baidu.com/s/1qWwkss0
assembly Tool Download: Http://pan.baidu.com/s/1i3taKmT
DOSBox User guide:
(1) It's on your disk. Create a new directory to store your own code , such as: I create a new directory DOS under the E disk, then my working directory is: E:\DOS, later I write the assembly code will be stored in this directory.
(2) Select the link of the Assembly tool above ( press CTRL, click left mouse button ), Download the Assembly tool . Unzip the downloaded package file into the new working directory you just created , such as:
"OK" after entering the file directory to view, directory files such as:
We will actually use the following procedures: "Debug.exe" "Edit.com" "Link.exe" "Masm.exe".
(3) Open the program after downloading and installing DOSBox , the two interfaces that will appear,
We just need to care red Box-selected interface , the other interface does not need attention, It can be minimized but cannot be closed .
(4) In the above red box select the interface to enter the following command (the command line is case-insensitive):
The first step: MOUNT C E : \d OS (carriage return)
Note that here E:\DOS is the working directory you created earlier, enter it according to your own directory.
Step Two: C: ( Enter )
The results of the first two steps are as follows:
This allows us to enter a DOS environment like Win7, where we can write assembler programs.
in order to avoid entering the above command every time you enter the interface (especially if it is very annoying in the case of frequent use), we make the following simple configuration, so that we can go to the command line we want to use in the future. :
First, Enter the DOSBox installation directory , like my directory is the path of the redline callout:
Second, find files in the red circle , double-click on it and an editable text will appear (if you can't enter, then you can Right-click it-Open with Notepad ) such as:
Then, Find [AutoExec] in text ( You can use shortcut keys directly ctrl+f , enter AutoExec then return to ):
See step two, after finding AutoExec, enter below
MOUNT C E:\DOS
C:
Finally, when you run DOSBox again, you can see the interface directly into Figure 1 .
The environment is ready, following the formal code writing phase:
(1) in the command line input edit test.asm(test.asm is the filename, ASM is the assembly code suffix name, test can be self-prepared), so that in your working directory will be a new file named Test.asm;
(2) Enter the interface shown, which is an edit environment for writing code:
(3) in edit can use alt+f to Activate the File menu , then you can use the next key around , select the function you want to use.
( 4 ) Write your code and remember to save it every time you write it (preferably as a write-side save) by pressing alt+f Key Combinations , and then use the keyboard Next Key Choose Save, Enter can be.
If you do not save the file after editing, a prompt box appears:
Select "Yes" .
Of course, you can also exit after creating a new file , open the file in the working directory with Notepad and edit it in notepad . , and then run directly to the command line to compile. (Self-feeling is a bit more convenient)
The following is the compilation and debugging process for code:
(1) Enter the sample code, such as:
Code segment assume Cs:code start: mov ax,5h mov bx,6h add ax,bx mov ah,4ch int 21hcode Ends End Start
Remember to enter in edit, write to save before exit.
(2) Return to the command line, enter MASM test.asm, display the results see part One:
The MASM command in the figure generates an obj file , which can be entered after test.obj to change the file name, and the default file name is the same as the original. The general situation is directly enter .
(3) Enter link test.obj (If you change the file name to use the changed file name), display the results section two. the link command generates an exe file .
Similarly, you can change the file name here, but the general situation is to enter directly , without changing the file name.
(4) Input debug test.exe(Debug command debugging is executable program, that is EXE file), will appear '-' prompt, here will enter the debug command .
As you can see, after stepping, first the AX value is 05h, then the BX value is 06h, and the last Ax value changes to 0Bh, and for 05h and 06h.
(5) After you have finished , enter exit to exit the DOS interface.
Writing assembly language with DOSBox under WIN8