0% found this document useful (0 votes)
44 views5 pages

Imran Shaheer 19F-0285 Coal Lab 3 Problem # 1: Code

The document contains 4 programming problems involving assembly language code. Problem 1 defines an array and uses assembly instructions to get the type, size, and length of the array. Problem 2 prompts the user for input and stores it in a buffer using the ReadString procedure. Problem 3 displays a greeting using a name input from the user. Problem 4 performs multiplication and addition on user-input values and displays the result.

Uploaded by

Imran Shaheer
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
44 views5 pages

Imran Shaheer 19F-0285 Coal Lab 3 Problem # 1: Code

The document contains 4 programming problems involving assembly language code. Problem 1 defines an array and uses assembly instructions to get the type, size, and length of the array. Problem 2 prompts the user for input and stores it in a buffer using the ReadString procedure. Problem 3 displays a greeting using a name input from the user. Problem 4 performs multiplication and addition on user-input values and displays the result.

Uploaded by

Imran Shaheer
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 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

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy