8 Bit Multiplication
8 Bit Multiplication
8 Bit Multiplication
ALGORITHM FOR PRINT PROCEDURE . 1) 2) 3) 4) 5) 6) 7) 8) Initialize the variables and counters. Move the 4-digit no into some register. Rotate the register to the left by 4 bit places. Get the MSD and convert it into ASCII value. Display the digit using 02H function. Decrement the counter. If count 0, jump to step2 return
ALGORITHM FOR SUCCESSIVE PROCEDURE . 1) Call accept procedure 2) Store the 4-digit no in variable multiplier. 3) Call accept procedure. 4) Store the 4-digit number in the variable multiplicand. 5) Initialize result to 0000. 6) Add multiplicand to the result. 7) Decrement multiplier count. 8) If multiplier count 0, jump to step2 9) Pass the higher 4 digits of result to print procedure.. 10)Pass the lower 4-digits of result to print procedure/ 11)Return
ALGORITHM FOR SHIFTADD PROCEDURE . 1) 2) 3) 4) 5) 6) 7) 8) 9) Initialize variables and counters. Call accept to accept multiplier Store it in variable multiplier. Call accept procedure. Store it in some variable multiplicand. Shift left result by 1-bit. Add carry to the result. Shift left one of the numbers by 1-bit. Check if carry is present. If carry is present, add the other number to the result and also the carry. 10)If carry is not present, decrement count. 11)If count jump to step 6. 12)Pass the higher 4 digits of result to print procedure. 13)Pass the lower 4 digits of result to print procedure. 14)Return.
START
Shift left the result by 1 bit. Add multiplier and carry to the result
Is carry ?
Is count = 0?
RETURN
START
INIT. RES=0
RES=RES+1ST
DEC COUNTER
No
IS COUNTER= 0 ?
Yes
DISPLAY RES
STOP