0% found this document useful (0 votes)
6 views3 pages

Lab Coal Mid

The document contains assembly code for a banking system that performs arithmetic operations and checks for sufficient balance. It also includes a section for data encryption that reverses a string. The code utilizes the MASM32 library for input and output operations.

Uploaded by

bscs22f22
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)
6 views3 pages

Lab Coal Mid

The document contains assembly code for a banking system that performs arithmetic operations and checks for sufficient balance. It also includes a section for data encryption that reverses a string. The code utilizes the MASM32 library for input and output operations.

Uploaded by

bscs22f22
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/ 3

Task of banking system :

Code:

include \masm32\include\masm32rt.inc

.data

result DWORD 0
New db 13,10,0
Message db"The answer is : ", 0
m db"Register value is :" ,0
.code

start:
mov ax, 160
mov bx, 150
sub ax,bx
movzx eax,ax
invoke dwtoa, eax ,addr result
invoke StdOut, addr Message
invoke StdOut, addr result
invoke StdOut, addr New
invoke StdOut, addr m
lahf
shr ah,6
movzx eax, ah
invoke dwtoa, eax ,addr result
invoke StdOut, addr result
invoke ExitProcess, 0

end start

When balance is sufficient


When unsufficient

Code:

include \masm32\include\masm32rt.inc

.data

result DWORD 0
New db 13,10,0
Message db"The answer is : ", 0
m db"Register value is :" ,0
.code

start:
mov ax, 5
mov bx, 6
Test ax,bx
movzx eax,ax
invoke dwtoa, eax ,addr result
invoke StdOut, addr Message
invoke StdOut, addr result
invoke StdOut, addr New
invoke StdOut, addr m
lahf
shr ah,6
movzx eax, ah
invoke dwtoa, eax ,addr result
invoke StdOut, addr result
invoke ExitProcess, 0

end start

Task 2: encryption:
include \masm32\include\masm32rt.inc

.data
DATA BYTE "mehwish",0
Sizee = ($ - DATA) - 1

.code

start:

mov ecx,Sizee
mov esi,0
L1:
movzx eax,DATA[esi]
push eax
inc esi
loop L1

mov ecx,Sizee
mov esi,0
L2:
pop eax
mov DATA[esi],al
inc esi
loop L2

invoke StdOut, addr DATA


invoke ExitProcess, 0
end start

Output:

You might also like