Professional Documents
Culture Documents
Lab 1-2-2019
Lab 1-2-2019
Lab 1-2-2019
PRACTICAL EXERCISES
Instructions:
a. The lab exercises are sectioned into two – Emu8086 and Visual MASM
b. Ensure that you demonstrate the exercises individually
c. In case of challenges get in touch with the lab attendants or myself
d. You will need to have installed the two apps on your PC or lab PC
name "hi-world"
org 100h
ret
Activities:
1. Launch the Emu8086, create a new file using the “COM template “ and copy the program
2. Click on “ Compile Button”, then save the file with the suggested file name and click on
“ Run Button”
3. Observe the output of the program as depicted in the figure 1.0
Figure 1.0: Output Screenshot
4. Modify the program above to display “ Great Ife, Oba Awon University” with the
background color = light blue and foreground color = green
; *************************************************************************
; 32-bit Windows Console Hello World Application - MASM32 Example
; EXE File size: 2,560 Bytes
; Created by Visual MASM (http://www.visualmasm.com)
; *************************************************************************
; *************************************************************************
; MASM32 proto types for Win32 functions and structures
; *************************************************************************
include c:\masm32\include\kernel32.inc
include c:\masm32\include\masm32.inc
; *************************************************************************
; MASM32 object libraries
; *************************************************************************
includelib c:\masm32\lib\kernel32.lib
includelib c:\masm32\lib\masm32.lib
; *************************************************************************
; Our data section. Here we declare our strings for our message
; *************************************************************************
.data
strMessage db "Hello World!",0
; *************************************************************************
; Our executable assembly code starts here in the .code section
; *************************************************************************
.code
start:
; Use the StdOut API function to display the text in a console.
invoke StdOut, addr strMessage
; When the console has been closed, exit the app with exit code 0
invoke ExitProcess, 0
end start
Activities
1. Launch the Visual MASM app and create a new Assembly file as a ” 32-bit Windows
Console Application”
2. Assemble the program and Run.
3. Save the file with a name or accept the default names
4. If the program assembled and linked successfully, you have see the following in the “
Output Window”
*******************************
*******************************
****************************
****************************
5. Type “cmd” at the start button on the Desktop to switch to the console
6. At the C: prompt, type “cd C:\Program Files (x86)\Visual
MASM\Projects\Win32Con\Release “
7. List the directory with “ Dir” and locate the executable file “ Win32con.exe”
8. Type the filename at the prompt and observe the output “ Hello World”
9. Modify the program to display “ Great Ife! Oba Awon University”
Part Three:
1. Launch the Visual MASM app and create a new Assembly file as a ” 32-bit Windows
MessageBox Application”
2. Repeat step 2-4 ( in Part Two above)
3. If your program execute successfully, you should see the following in your output
window
************************************************************************
**********
************************************************************************
***********
Microsoft (R) Windows (R) Resource Compiler, Version 5.00.1823.1 - Build 1823
****************************
****************************
5. Modify the program to display in the MessageBox “ Great Ife! Oba Awon University”
with a Title “ Ogba Obafemi”