Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Answer as much as possible, please! Please use MPLAB software to write all three

ID: 3750053 • Letter: A

Question

Answer as much as possible, please!

Please use MPLAB software to write all three programs. I would like to see comment in every line to make sure that you understand the logic. If requires talk with TA for further assistance. a) Write a program in assembly language to check whether a number is even or odd. b) Use that program to determine number 15 is even or odd. c) Repeat problem b with 48 and 113 1. 2. a) Write a program in assembly language to check whether a number is prime or not. b) Use that program to determine number 31 is prime or not. c) Repeat the same program with 189 and 223 3. Write a program in assembly language using an array of 10 element to store 0 10, where each array location will hold one integer. The base address of that array will be 0x47213000.

Explanation / Answer

2) a)

Steps:

1028H

HLT


1) a)

  

Steps:

ADDRESS LABEL MNEMONIC 1000H LDA 1029H 1001H 1002H 1003H MVI R2, 00H 1004H 1005H MOV R4, A 1006H MOV R1, A 1007H LOOP1 MOV R3, E 1008H LOOP2 CMP R3 1009H JC DIVIDENDLESSTHAN0 100AH 100BH 100CH SUB R3 100DH JNZ LOOP2 100EH 100FH 1010H DIVIDENDLESSTHAN0 CPI 00H 1011H 1012H JNZ NOTADIVISOR 1013H 1014H 1015H INR R2 1016H NOTADIVISOR MOV A, R1 1017H DCR R4 1018H JNZ LOOP1 1019H 101AH 101BH MOV A, R2 101CH MVI R2, 00H 101DH 101EH CPI 02H 101FH 1020H JNZ COMPOSITE 1021H 1022H 1023H INR R2 1024H COMPOSITE MOV A, R2 1025H STA 102AH 1026H 1027H

1028H

HLT


Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote