You are on page 1of 5

Imran Shaheer

19F-0285
Coal Lab 3
Problem # 1:
Code:
.386
.model flat, stdcall
.stack 4096
ExitProcess PROTO, dwexitCode:DWORD
.data

; define your variables here


arr WORD 80H ,12H,43H,76H,10H
.code
main proc
MOV EAX,TYPE arr
MOV EAX,SIZEOF arr
MOV EAX, LENGTHOF arr
INVOKE ExitProcess,0

main ENDP
END main
Problem # 2:
Code:
.386
.model flat,stdcall
.stack 4096
ExitProcess proto,dwExitCode:dword
include irvine32.inc
.data
prompt byte "please enter your name:",0
namebuffer byte 50 dup(?)
byteCount dword ?

.code
main proc
mov edx,offset prompt
call WriteString
mov edx,offset namebuffer
mov ecx,sizeof namebuffer
call ReadString
call WaitMsg
exit
main ENDP
28 END main

Output:

Problem # 3:
Code:
INCLUDE Irvine32.inc
.data
ab1 byte "ENTER YOUR NAME: ",0
ab2 byte "MRr ",0
ab3 byte " IS LEARNING ASSEMBLY LANGUAGE. ",0
ab4 byte "Number of character is : ",0
buffer byte 21 dup (0) ; input buffer

.code
main PROC
mov edx, offset ab1
call writestring

mov edx, offset buffer


mov ecx, sizeof buffer

call ReadString

MOV EDX , OFFSET ab2


CALL WRITESTRING
mov edx, offset buffer
call writestring
MOV EDX , OFFSET ab3
CALL WRITESTRING
call crlf
mov edx , offset ab4
call writestring
mov ecx, sizeof buffer
call writedec
call crlf
call WaitMsg

exit
main ENDP
END main
Problem # 4:
Code:
;Author: Abuzar Ghafari
; Program Name: exp7
; Program Description: ReadString Procedure Example
; Date: 10/18/2020

INCLUDE Irvine32.inc
.data
var1 byte "Enter A:",0
var2 byte "Enter B:",0
var3 byte " The B is: ",0
X byte ?
Y WORD ?
D byte ?

.code
main PROC
mov edx,offset var1
call WriteString
call crlf
mov eax,0
call ReadDec
mov X,al
call crlf
mov edx,offset var2
call WriteString
call crlf

mov al,X
mov bl,4
MUL bl
mov Y,ax
mov eax,0
call ReadDec
mov D,al
add Y,ax
mov edx,offset var3
call WriteString
call crlf
mov eax,0
mov ax,Y
call WriteDec
call crlf
call WaitMsg
exit
main ENDP
END main

You might also like