Program to convert ASCII into dec in Assembly Language

A program written in assembly language comprises of a progression of memory helper processor guidelines and meta-proclamations (referred to differently as orders, pseudo-directions and pseudo-operations), remarks and information. Assembly language guidelines as a rule comprise of an opcode mental helper pursued by a rundown of information, contentions or parameters.Code of the conversion of ASCII to dec in assembly language is given below.

.386
.model flat , stdcall
.stack 4096
GetStdHandle proto, a1:dword
ReadConsoleA proto , a1:dword , a2:ptr byte , a3:dword , a4:dword , a5:dword
WriteConsoleA proto , a1:dword , a2:ptr byte , a3:dword , a4:dword , a5:dword
ExitProcess proto , a1:dword
.data
buffer byte “123456789”,0
x dword ?
.code
main proc
mov esi , offset buffer
mov ebx , 0
L1:
mov cl , [esi]
cmp cl , 0
je endl1
sub cl , 48
movzx ecx , cl
mov eax , 10
mul ebx
mov ebx , eax
add ebx , ecx
inc esi
jmp L1
endL1:
mov x , ebx
invoke ExitProcess , 0
main endp
end main

Add a Comment

Your email address will not be published. Required fields are marked *