


Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
Prof. Abhay Aggrawal provided this lab handout for assistance at Birla Institute of Technology and Science for lab of Assembly Language Programming. It includes: Procedure, MASM, Assembler, programming, Integrated, Debugging, Mouse, PWB, Dosshel, Values, Menu
Typology: Exercises
1 / 4
This page cannot be seen from the preview
Don't miss anything!



statement literally specifying an instruction. One result of this is that the assembler can produce a “listing” file (.lst) t^ The three tools you will be working with are the Microsoft Macro Assembler (MASM), Codeview, and Programmer’s Work Bench. MAShat shows your assembly code side-by-side with the machine code generated. This list file can be a useful tool in understanding what is going on and can sometimes be used to aid in debugging.M is the assembler, which plays a role similar to a compiler in translating your text-based source code into the binary code of a computer. Translating assembly language source code into the equivalent binary machine code is a much simpler task than translating a program in a high level language. Therefore an assembler is a much simpler program than a compiler. The assembler translates source code on a statement by statement basis, with each source environment running under MS-DOS.^ Codeview is the debugger provided with the Microsoft Assembly Language development system. It is a powerful debugger that allows you to run and single step your program. You may set break-points, view and modify memory, and view and modify registers as your program runs. The Programmer’s Workbench is the development environment that ties everything together, much like any development environment such as Visual Studio, Borland or Watcom’s IDE (Integrated^ Development Environment), or the GNU tools on Linux. Unlike Visual Studio, PWB is a text based development
Figure1 shows the startup screen in PWB. Across the top is the menu bar that contains 9 pulldown menus that access various features of PWB. As with all Microsoft programs, the mouse is used to activate a pulldown menu or if no mouse is available, the alternate key and first letter of the menu name.
You are now ready to begin entering an assembly language program. Type the program listed in Example 1 This program will be used through much of this experiment to learn how to use PWB and its features. Before entering the program, it is a good idea to name it at this point. To name the program select Save from the File pulldown menu. Enter the desired file name with the extension of .ASM for an assembly language source file. Save the program in directory C:\masm. Once the name and path is selected, choose OK After this the PWB program returns to the main edit screen so the programcan be entered.
AX = DI= BX= CX= DX= SP= BP= SI=
IP= FL=
Now hit F10 a single time to single step through one instruction. You should notice changes in the source and register windows.
.stack 100h ; Identifies size of stack segment .data val1 word 1000h val2 word 4000h val3 word 2000h finalVal word? .code main PROC mov ax,val1 ; start with 1000h add ax,val2 ; add 4000h sub ax,val3 ; subtract 2000h mov finalVal,ax ; store the result (3000h) mov ax,4C00h ;Required to terminate program normally int 21h main ENDP end main