Write a Pep/9 assembler program that divides a number by a number by shifting ri
ID: 3825290 • Letter: W
Question
Write a Pep/9 assembler program that divides a number by a number by shifting right and subtracting. Each shift right halves the number. For example, if we shift 0x02 one bit to the right the answer is 0x01 (0000 0010 shifted left is 0000 0001). Divide 0x28 by 0x10 (in decimal it is 40 divided 16, but leave the answer in hex). Write a Pep/9 assembler program that divides a number by a number by shifting right and subtracting. Each shift right halves the number. For example, if we shift 0x02 one bit to the right the answer is 0x01 (0000 0010 shifted left is 0000 0001). Divide 0x28 by 0x10 (in decimal it is 40 divided 16, but leave the answer in hex).Explanation / Answer
Consider for above program
(3005H)=0X28
(3006H)=0X10
Program is
LXI 3005H // load Immediate location
MOV A,M // mov memory M to accumulator A
RRC A //Rotate right to A
MOV M,A // Move A to M =>3007H Location
SUB M //substract =>3008H Location
SUB M //3009H Location
SUB M //3010H Location
SUB M //3011H Location
STA 3012H // Store result to 3012H
Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.