#Check for Zero Value in the divisor/dividend
OR r9,r5,r6 # Check for the op1 being zero
- BEQI r9,$LaResult_Is_Zero # Result is zero
+ BEQID r9,$LaResult_Is_Zero # Result is zero
OR r9,r7,r8 # Check for the dividend being zero
BEQI r9,$LaDiv_By_Zero # Div_by_Zero # Division Error
+ BGEId r5,$La1_Pos
XOR r27,r5,r7 # Get the sign of the result
- BGEI r5,$La1_Pos
RSUBI r6,r6,0 # Make dividend positive
RSUBIC r5,r5,0 # Make dividend positive
$La1_Pos:
$LaDIV1:
ADD r6,r6,r6
ADDC r5,r5,r5 # left shift logical r5
+ BGEID r5,$LaDIV1
ADDIK r28,r28,-1
- BGEI r5,$LaDIV1
$LaDIV2:
ADD r6,r6,r6
ADDC r5,r5,r5 # left shift logical r5/r6 get the '1' into the Carry
lwi r28,r1,12
lwi r29,r1,16
lwi r30,r1,20
+ rtsd r15,4
addik r1,r1,24
- rts r15,4
.end __moddi3