You are on page 1of 5

KM40203

MICROPROCESSOR AND ELECTRONICS

MICROPROCESSOR LAB 1&2

Microprocessor Lab 1 & 2


Objectives The objectives of this lab are: 1. Introduction to the facilities in this lab 2. To equip students with the skills necessary for creating Assembly language programmes from creating source codes, to assembling and linking process 3. To expose the students to the debugging techniques of Assembly programmes

Experiment #1 The DOS Environment Ex 1.1 Starting DOS 1. Click the Start button and then point to Programs and then click MS-DOS Prompt The DOS Prompt The Dos prompt, as shown displays the current drive (C:) and the current directory or folder (Windows). The prompt means that the computer is waiting for your command.

Ex 1.2 Changing Directory To change from the current directory (windows) to another directory (tasm), at the command line, type: cd c:\tasm and press the Enter key. The command cd (Change Directory) must be followed by the path to the new directory. The path starts at the drive root directory (C:\) until the location of the directory itself. If the command is typed correctly and the directory exists then the prompt should be changed as shown

Ex

1.3 Displaying Files

To view the files as well as sub-directories in the current directory, you can use the dir command. The syntax is: dir [/p][/w]. The [/p][/w] are called switches and affects the behaviour of the dircommand. To get a full list of the allowed switches and their effects, type: help dir at the command prompt.

KM40203

MICROPROCESSOR AND ELECTRONICS

MICROPROCESSOR LAB 1&2

Ex 1.4 Creating a Directory To create a new directory at the current location, type the command md <directory name>. The directory name must be 8 characters or less and can contain alphabet and digits. To create the directory KM40203 under the tasm directory, do: 1. Change to the tasm directory 2. Type md km40203 and press the Enter key

Ex 1.5 Exist DOS To exist DOS and return to the windows environment, type Exit at the command line and press the Enter key

Experiment #2 Creating Source Code 1. Open the Notepad or any word processor 2. Type the source code shown in Figure 1 3. Save the file in your directory (folder), make sure the file type is set to Text Documents

KM40203

MICROPROCESSOR AND ELECTRONICS

MICROPROCESSOR LAB 1&2

Experiment #3 Creating object Code The Assembler available in the lab is Turbo Assembler 6.0. The Assembler is installed in the directory called Tasm in drive C: 1. Run the MS-DOS Prompt 2. Change the directory to C:\Tasm by typing: cd c:\tasm and press enter key 3. Type tasm <path of source code> <path of object code> then press the enter key. The path includes the drive, directory and file name. Example: tasm c:\prog\dispemess.asm c:\prog\dispmess.obj 4. If you have no syntax errors in your source code, you should get a message like the one shown in Figure 2. 5. 6.

7. On the other hand, if any syntax error is detected, you should get the error message and line number that caused the syntax error similar to Figure 3. In that case, you should open your source code, correct the syntax error and try to assemble your progra m again

KM40203

MICROPROCESSOR AND ELECTRONICS

MICROPROCESSOR LAB 1&2

Experiment # 4 Creating Executable Code If the assembly process was successful, an object code file should have been created. To create an executable file from the object file, do the following: 1. Type tlink <path of object code> and press the enter key If no error encountered during the linking process, you should get a message similar to the one shown in Figure 4.

Experiment #5 Executing your Program To execute (run) your program, type the program name at the command line and press the enter key

Experiment #6 Debugging your Program To run the Debugger, type: Td <path of the executable program> and press the enter key Example td c:\dispmesg

You should get something similar to Figure 5.

KM40203

MICROPROCESSOR AND ELECTRONICS

MICROPROCESSOR LAB 1&2

You might also like