Professional Documents
Culture Documents
2011
Introduction:
Machine language can be made directly from java code using interpreter .
Java code
Interpreter
Machine Langauage
C ,C++ code is executed faster than Java code ,because they transferred to assembly language before machine language .
This is a C++ Program that print "Hello World" , we write the program on Visual Studio and Run the Program :
2)
3)
We will find the Assembly code on the project folder we save in ,named as ProjectName.cod
Assembly Language :
Assembly Language is a programming language that is very similar to machine language, but uses symbols instead of binary numbers. It is converted by the assembler (e.g. Tasm and Masm) into executable machine-language programs.
Figure (2): Hello Program in Assembly language 6- Write C:\Tasm\Bin\tasm hello.asm to create the file hello.obj This file is the machine language for the program. 7- Write C:\Tasm\Bin\ tlink hello.obj to create the file hello.exe This file is executable program. 8- Finally, write C:\Tasm\Bin \hello.exe You will show the message hello, world on DOS screen
C:\Tasm\Bin\td Hello
Number 1 2 3 4 5 6 7 Indicate to the menu bar of turbo debugger Indicate to the region contain Code pane Indicate to the region contain Register pane Indicate to the region contain Data pane Indicate to the region contain Flag pane Indicate to the region contain Stack pane
Description
Indicate to the instruction pointer (IP) it contains the offset address of the instruction will be execute. Indicate to Code register that have value of (42CC) and we get it from register pane. The offset address of each instruction This statement tell the assembler to put (@data) default offset address in AX and this value from gure equal to (42CD) indicate to the machine language of statement and from gure it is equal to (B8CD42) This column is the values of Registers.
8 9 10
11 12
10
9-Save your work then exit the editor 10-Type make16 yourfile then enter
Note:
You can open a notepad file and write your assembly file the save it as filename.asm
11
The following files will be created Yourfil.obj Yourfil.lst Yourfil.exe 11-Run your program using yourfile
Note:
Note if you use a 32 bit registers you will assemble and link using make32 instead of make16 command
12
After your program has been assembled and linked, you're ready to load its EXE file using CodeView. Open an MS-DOS command window, and type the following, pressing Enter after each line:
13
Here's what CodeView displays the first time you load the program. The highlight bar in the source window is automatically placed on your program's first executable instruction:
14
15
Keep pressing F10 message box says that the program has ended. This is not an error message.
16
You can now click on OK to restart the program, or press the Esc key to close the message box:
17
Lab work:
Write the previous code "Hello program", then Use Debugger to single step through this program using the (TRACE) command.
Home work
Make a report that explain the steps of setting up JCreator for assembling, linking, and debugging assembly language programs. We will do this by adding commands to its Tools menu. (JCreator HW) Folder will help you to do this configuration . Apply steps [1,2 and 5] only . After finish configuration , apply it on" Hello " program we write on this lab.
18