ITC 544 Assembly Language Programming: Prime Number Checker

Verified

Added on  2025/08/26

|7
|488
|490
AI Summary
Desklib provides solved assignments and past papers to help students succeed.
Document Page
ITC 544
Page 1 of 7
tabler-icon-diamond-filled.svg

Paraphrase This Document

Need a fresh take? Get an instant paraphrase of this document with our AI Paraphraser
Document Page
Contents
Question 2..................................................................................................................................3
List of Figures
Figure 1: 17 as input...................................................................................................................5
Figure 2: 15 as input...................................................................................................................6
Figure 3: 2 as input.....................................................................................................................6
Figure 4:-2 as input....................................................................................................................7
Page 2 of 7
Document Page
Question 2
ORG 100
Input /User input is going to be taken from here
Store userInput /all the input associated with user Input is going to be stored inside it
Store Q /all the value of user Input is going to be stored for loop purpose inside Q
register
Store W /all the value of user Input is going to be stored for loop purpose inside W
register
Load Q
Subt One /through this checking of the divisibility is done through integer by taking n-1 to n-
2
Store Q /through this values are going to be stored in Q
Load userInput /through this checking of user input that if it is great than 1 or not
Subt One /if a comparison is lesser than 1 then the output is going to be 0
Skipcond 800
Jump invalid
loop, Load Q /through this the loop is going to be n-1 to n-2
Subt One
Skipcond 400
Jump gtTwo
Load One /through this thing if the value is not divisible by number that is going to be in the
range of 2 to n-1.
Output /0 is going to be displayed as output
Halt
gtTwo, Jump divide
Page 3 of 7
Document Page
after, Load E
Skipcond 800 /if the value is going to be divided by 2 then it is going to be even number else
the number is not going to be a prime number.
Jump cNext /through this checking of Q-1 loop to is going to be done
Load Zero
Output
Halt
cNext, Load userInput
Store W
Load Q
Subt One
Store Q
Jump loop
divide, Load W /E is going to 1 also if Q is divisible by W or 0
Skipcond 800 /lop is going to be continued if AC is going to be greater than 0
Jump final /if not possible then it is going to jumps towards final
Load W
Subt Q
Store W
Jump divide
final, Load W
Skipcond 400 /value of AC is 0 then it is going to be divisible by W
Jump notDb /else values are going to jump towards notDb
load One
Store E
Page 4 of 7
tabler-icon-diamond-filled.svg

Paraphrase This Document

Need a fresh take? Get an instant paraphrase of this document with our AI Paraphraser
Document Page
Jump after
notDb, Load Zero /placing of 0 is going to be in E when W is not going to divisible by W
Store E
Jump after
invalid, Load Zero /output is going to show as 0 if user input is showing less than 1
Output
Halt
/Variables
userInput, DEC 0
W, DEC 0
Q, DEC 0
E, DEC 0
/Constants
One, DEC 1
Zero, DEC 0
Page 5 of 7
Document Page
Figure 1: 17 as input
Figure 2: 15 as input
Page 6 of 7
Document Page
Figure 3: 2 as input
Figure 4:-2 as input
Page 7 of 7
chevron_up_icon
1 out of 7
circle_padding
hide_on_mobile
zoom_out_icon
[object Object]