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

On mplabx ide create assembly code for unsigned integer division 1. (40 pts) Imp

ID: 3696936 • Letter: O

Question


On mplabx ide create assembly code for unsigned integer division

1. (40 pts) Implement the unsigned integer division operation using the subtraction method shown in the following activity diagram/flowchart. Initialize p with Ox148F and d with 0x0041. Subtraction Method q,r= p any number (dividend) d = any number (divisor) r = p (reminder) q = 0 (quotient) r

Explanation / Answer

$Lab DivMod $Div,$Top,$Bot,$Temp ASSERT $Top $Bot ; Produce an error message if the ASSERT $Top $Temp ; registers supplied are ASSERT $Bot $Temp ; not all different IF "$Div" "" ASSERT $Div $Top ; These three only matter if $Div ASSERT $Div $Bot ; is not null ("") ASSERT $Div $Temp ; ENDIF $Lab MOV $Temp, $Bot ; Put divisor in $Temp CMP $Temp, $Top, LSR #1 ; double it until 90 MOVLS $Temp, $Temp, LSL #1 ; 2 * $Temp > $Top CMP $Temp, $Top, LSR #1 BLS %b90 ; The b means search backwards IF "$Div" "" ; Omit next instruction if $Div ; is null MOV $Div, #0 ; Initialize quotient ENDIF 91 CMP $Top, $Temp ; Can we subtract $Temp? SUBCS $Top, $Top,$Temp ; If we can, do so IF "$Div" "" ; Omit next instruction if $Div ; is null ADC $Div, $Div, $Div ; Double $Div ENDIF MOV $Temp, $Temp, LSR #1 ; Halve $Temp, CMP $Temp, $Bot ; and loop until BHS %b91 ; less than divisor MEND
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