Sunday, January 16, 2022

Write a program that will prompt the user to enter a hex digit character ("0" "9" or "A" "F"), display it on the next line in decimal.

 Include irvine32.inc

;AddTwo.asm-adds two 32-bit integer.

;chapter3 example

.386

.stack 4096

ExitProcess proto,dwExitCode:dword

.data

str1 byte "Please Enter The HexaDecimal Value:",0

str2 byte "Decimal value is:",0

str3 byte "Do you start again:",0

str4 byte "wrong choice",0

pr byte 'y',0

choice dword ?

.code

main proc

start:

mov edx,offset str1

call WriteString

call ReadHex

mov edx,offset str2

call WriteString

call WriteDec

call crlf

mov edx,offset str3

call WriteString

call ReadChar

mov choice,eax

cmp choice,'y'

je print

jne next

print:

jmp start

next:

call crlf

mov edx,offset str4

call WriteString

 

  invoke ExitProcess,0

  main endp

  end main

No comments:

Post a Comment