Microprocessor and Microcontroller Lab
Microprocessor and Microcontroller Lab
Procedure for doing experiments in PC using MASM/TASM 1. Copy the files (MASM.EXE and LINK.EXE) or (TASM.EXE and TLINK.EXE) to a convenient directory in your PC 2. Open the command prompt ( run-> cmd or start->programs>accessories->command prompt) 3. In the command prompt type cd <path to directory> to change to the directory containing copied files 4. Open notepad and start typing the program in notepad 5. Once program is complete choose save dialog box, select file type as all files and save the program as program1.asm (or any other name with .asm as extension) in the directory mentioned above 6. In the command prompt type tasm program1.asm (or masm program1.asm) to assemble the program. This will list the details of program and make an object file, if there is no error. 7. Once assembling is complete, type tlink program1.obj (or link program1.obj) to link and generate the executable. 8. Once linking is over you can see the executable file with .exe extension. To run this file, just type the name of the file in command prompt program1 9. To debug the executable program use TD.EXE which has a simple graphical interface to view the instructions, registers, segments and flags 10.Explore the facilities of td.exe
Structure of an assembly language program with data segment and code segment only
HELLO
MYCODE
ASSUME START:
;TO DISPLAY A CHARACTER MOV AH,02 MOV DL,41H INT 21H ; TO DISPLAY A STRING MOV AH,09 LEA DX,MSG INT 21H ;TO TERMINATE PROGRAM AND RETURN TO OS MOV AX,4C00H INT 21H
MYCODE