Ex1: Use the Opcodes help of the menu Help, describe syntaxes of following MASM
instructions
(1) ADD
(2) SUB
(3) MUL, IMUL
(4) DIV, IDIV. Which register will store the remainder ?
Ex2 : Write a masm Locals.asm program that will print the following :
; Source code From masm32\tutorial\console\demo4\locals.asm
.486 ; create 32 bit code
.model flat, stdcall ; 32 bit memory model
option casemap :none ; case sensitive
include \masm32\include\windows.inc ; always first
include \masm32\macros\macros.asm ; MASM support macros
include \masm32\include\masm32.inc
include \masm32\include\gdi32.inc
include \masm32\include\user32.inc
include \masm32\include\kernel32.inc
includelib \masm32\lib\masm32.lib
includelib \masm32\lib\gdi32.lib
includelib \masm32\lib\user32.lib
includelib \masm32\lib\kernel32.lib
show_text PROTO :DWORD ; prototype a method + type of parameter
.code ; Tell MASM where the code starts
start: ; The CODE entry point to the program
call main ; branch to the "main" procedure
exit
; «««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««
main proc
LOCAL txtinput:DWORD ; a "handle" for the text returned by "input"
mov txtinput, input("Type some text at the cursor : ") ; get input string
invoke show_text, txtinput ; show inputted string
ret
main endp
; «««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««
show_text proc string:DWORD
print chr$("This is what you typed at the cursor",13,10," *** ")
print string ; show the string at the console
print chr$(" ***",13,10)
ret
show_text endp
; «««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««
end start ; Tell MASM where the program ends
Ex2-1:
Write a MASM program that will print the following cantor of Hàn Mặc Tử
Guide ex2
Ex3: Write a program that will accept 3 numbers, then sum of them and their average
will be printed out.
Guide ex3
Ex4: Write a MASM program that will solve the equation ax+b=0
Ex5: Write a MASM program that will accept 2 numbers, v1, v2 then print out v1+v2,
v1-v2, v1*v2, v1/v2.