160 likes | 260 Views
8 bit decimal addition. Start. Initialize H-L pair with address of operands. Move the contents of F100 to accumulator. Increment the H-L pair to obtain the next operand . Add the contents of accumulator with the next operand. Perform Decimal adjustment. Is carry generated ?. No. Yes.
E N D
8 bit decimal addition Start Initialize H-L pair with address of operands Move the contents of F100 to accumulator Increment the H-L pair to obtain the next operand Add the contents of accumulator with the next operand Perform Decimal adjustment Is carry generated ? No Yes Increment the register C Store the result Halt
8 bit decimal subtraction Start Initialize H-L pair with address of second operands Load accumulator with 99h Perform 9’s Compliment Increment A to get 10’s compliment Decrement H-L and get second operand Add the contents of A with next operand Perform Decimal adjustment Store the result Halt
8 bit binary addition Start Initialize H-L pair with address of operands Move the contents of F100 to accumulator Increment the H-L pair to obtain the next operand Add the contents of accumulator with the next operand Store the result Halt
8 bit binary subtraction Start Initialize H-L pair with address of operands Move the contents of F100 to accumulator Increment the H-L pair to obtain the next operand Subtract the contents of accumulator with the next operand Store the result Halt
16 bit addition Start Initialize H-L pair with address of operands Move the LSB to E register Increment the H-L pair to obtain the MSB of first operand Load the MSB to D register Load the 2nd operand into H-L pair Clear C register to store carry, if any Add D-E pair with the H-L pair Is carry generated ? No Yes Increment the register C Store the contents of H-L pair Load accumulator with the contents of C Store the result Halt
8-bit multiplication Start Initialize H-L pair with address of operands Move the contents of F100 to B register Increment the H-L pair to obtain the next operand Copy the next operand to C register Clear contents A register Add the contents of B register to accumulator Perform Decimal adjustment Is carry generated ? No Yes Increment the register D Decrement the count(C register) Is count Zero ? No Yes Store the result Halt
8-bit division Start Initialize H-L pair with address of operands Move the Dividend to Accumulator Clear contents of C register for the quotient Increment the H-L pair to obtain the divisor Copy the divisor to B register Perform Subtraction A=A-B Increment C Is A ≥ B Yes No Store the result as Remainder at F200 and quotient at F201 Halt
Picking out the largest number Start Initialize H-L pair with address of size of array Move the array size to register Increment the H-L pair to obtain the array contents Copy the first array number to accumulator Decrement the array size value(C reg) Increment H-L pair to next array number Compare the number with number in accumulator Is A ≥ B? Yes No Copy the number to accumulator to get Largest number Decrement the count(C register) Is count Zero ? No Yes Store the result at F200 Halt
Picking out the Smallest number Start Initialize H-L pair with address of size of array Move the array size to register Increment the H-L pair to obtain the array contents Copy the first array number to accumulator Decrement the array size value(C reg) Increment H-L pair to next array number Compare the number with number in accumulator Is A ≤ B? Yes No Copy the number to accumulator to get smallest number Decrement the count(C register) Is count Zero ? No Yes Store the result at F200 Halt
Ascending Order Start Clear register B Move the array size to register C Point the H-L pair to the address of array contents Copy the first array number to accumulator Increment H-L pair to next array number Compare the number with number in accumulator Yes Is A ≤ B? No Copy the number to register E Decrement H-L pair to point previous number Copy the contents of E reg to the address in H-L pair Increment H-L pair to next array number Copy the larger number in accumulator to the memory location Increment register B Decrement the count(C register) Is count Zero ? No Yes Move the contents of B reg to Accumulator Is accumulator Zero ? No Yes Halt
Descending order Start Clear register B Move the array size to register C Point the H-L pair to the address of array contents Copy the first array number to accumulator Increment H-L pair to next array number Compare the number with number in accumulator Yes Is A ≥ B? No Copy the number to register E Decrement H-L pair to point previous number Copy the contents of E reg to the address in H-L pair Increment H-L pair to next array number Copy the larger number in accumulator to the memory location Increment register B Decrement the count(C register) Is count Zero ? No Yes Move the contents of B reg to Accumulator Is accumulator Zero ? No Yes Halt
Start Time delay Initialize Stack Pointer Load accumulator with 1 Push PSW onto the stack Store the contents of accumulator at FFF9 Call 06d3 to display the number Call delay to display the number for a period of time Pop PSW from the stack to retrieve the contents of accumulator Increment the accumulator Start Load B reg with FF Load C reg with FF Do nothing Decrement C reg Is C reg zero? No Yes Decrement B reg No Is B reg zero? Yes Return to main program