Create a new MASM project by following the procedure as described in the tutorial. Go to the main.asm
file and copy the following code. As seen in the code block, a variable ‘num’ is declared and it holds the
value ‘23’ and another variable ‘ans’ is declared, and it holds the value ‘255’. You should write a code
which determines whether ‘num’ is a prime number or not. If it is a prime number, you should write ‘1’
to the variable ‘ans’ otherwise write ‘-1’ to variable ‘ans’.
At the end of the program, you can verify whether your code is functioning correctly by examining the
value of the variable ‘ans’. Following sections will explain how to debug the code by viewing the memory
and register contents in real time. Following two screen shots show the memory contents for two cases;
1) when I place a prime number 23 (hex 0x17) in ‘num’, the code writes 1 in the location of ‘ans’ 2) when
I place a non-prime number 32 (hex 0x20) in ‘num’, the code writes -1 (hex 0xff ff ff ff) in the location for
variable ‘ans’.
Please submit a single asm file implementing the required computation. The code must place the result
(either 1 or -1) in the variable ‘ans’.
Show transcribed data
assembly language programs, it must be first setup correctly. it vou do not have an assembly programming etwirenment setup tomectiv. please follere the provided tutoril to set it se. Problem description Given a pocitive integer greater than 1. find whether the guen integer is a prime nureber ar not. Procedure Create a new MA5M project by following the peocedure as described in the Luterial. Go to the main anm file and copy the following code. As seen in the code block, a varable 'thum' is seclared and is helds the value '25' and another variablie 'ans' in declared, and it halds the val ae
255
′′
. Tou should write a code which determines whether 'num' is a prime number of nce. if at is a prime number, you should write '1' to the variable 'ans' etherwise write "-1't to variahle 'am's As the end of the proeram, you can verify whether pour code is functiening cocrectly by exarnining the value of the variable 'ans'. Following sections will explain how to debug the code by wiewing the memiory and register contents in real time. Foliowing two screen shats thow the memary contents for twa cases; 1) whe I place a prime number 23 (hex Dran) in 'num', the code arites 1 in the focation of 'ans' 2) when I place a non-prime number 32 (hex Ow20) in 'rum', the code writes -1 (hes Daft if
ftth
) in the lacation for variable 'ans:" Adates Sasostase0 Deliverables Please submit a single asm fle implementirg the reguired compucation. The tode mast place the result \{either 1 or -1] in the variable 'ans'.