Number 117 fits into 7 bits (log2 117= 6,87036472 bits, so 7 bits).

Number 13 fits into 4 bits (log2 13= 3,700439718 bits, so 4 bits).

We can do log2 by using instruction bsr.

Select biggest from 4 and 7, we need one more bit to be sign bit. So, we can deal with 8 bits group.

The left most bit into N bits group it's a sign bit.

Values of dividend and divisor should be aligned. The left most bit 1 of dividend need be aligned with left most bit 1 of divisor. Both having same positive signal.

Transform -13 to +13 using N bits group.

117 01110101 dividend

13 00001101 divisor

Align both numbers, shift left most bit 1 of divisor to the left most bit 1 of dividend.

Divisor was shift left by 3 bits positions. We need this 3 value (align_position), to know how to stop division process.

01110101 dividend (remainder)

01101000 divisor

quotient=0

.repeat

quotient = quotient *2 ;shl

.if dividend >= divisor ;>=

dividend= dividend - divisor ;sub

inc quotient ;inc

.endif

divisor = divisor / 2 ;shr

align_position = align_position -1 ;dec

.until align_position != -1

align

117 01110101 dividend (remainder)

104 01101000 divisor

0 quotient

3 times to go (align_position)

Start process:

quotient=0 align_position=3

117 >= 104? yes, quotient *2, subtract, increase quotient, divisor/2, align_position-1 quotient=0*2+1 align_position=2

13 >= 52? no, quotient *2, divisor/2, align_position-1 quotient=2 align_position=1

13 >= 26? no, quotient *2, divisor/2, align_position-1 quotient=4 align_position=0

13 >= 13? yes, quotient *2, subtract, increase quotient, divisor/2, align_position-1 quotient=8+1 align_position=-1

0 (remainder)

Quotient=9, remainder(dividend) = 0. Because divisor was negative, we need transform quotient into negative.

+9=00001001

-9=11110110+1=11110111