Presentation is loading. Please wait.

Presentation is loading. Please wait.

CS-401 Computer Architecture & Assembly Language Programming

Similar presentations


Presentation on theme: "CS-401 Computer Architecture & Assembly Language Programming"— Presentation transcript:

1 CS-401 Computer Architecture & Assembly Language Programming
Lecture-17 Display Memory

2 Lets revise the last lecture

3 In Today’s Lecture We will discuss our first program

4 Number printing Algorithm

5 Number Printing Algorithm
Divide the number by base. The remainder is its right most digit. Convert the digit its ASCII representation. Save the digit on stack. If the quotient is non zero repeat the whole process to get the next digit otherwise stop. Pop the digits one by one and print on screen left to right.

6 Number Printing Algorithm
10 4529 x x x x SP

7 Number Printing Algorithm
452 10 4529 9 x x x x SP Remainder is 9 and its equivalent ASCII is 0x39

8 Number Printing Algorithm
10 452 0x39 SP x x x x 9’s equivalent ASCII is pushed onto stack

9 Number Printing Algorithm
45 10 452 2 0x39 SP x x x x Remainder is 2 and its equivalent ASCII is 0x32

10 Number Printing Algorithm
10 45 0x32 SP 0x39 x x x x 2’s equivalent ASCII is pushed onto stack

11 Number Printing Algorithm
4 10 45 5 0x32 SP 0x39 x x x x Remainder is 5 and its equivalent ASCII is 0x35

12 Number Printing Algorithm
10 4 0x35 SP 0x32 0x39 x x x x 5’s equivalent ASCII is pushed onto stack

13 Number Printing Algorithm
10 4 4 0x35 SP 0x32 0x39 x x x x Remainder is 4 and its equivalent ASCII is 0x34

14 Number Printing Algorithm
10 0x34 SP 0x35 0x32 0x39 x x x x 4’s equivalent ASCII is pushed onto stack

15 Number Printing Algorithm
10 4 0x35 SP 0x32 0x39 x x x x

16 Number Printing Algorithm
10 4 5 0x32 SP 0x39 x x x x

17 Number Printing Algorithm
10 4 5 2 0x39 SP x x x x

18 Number Printing Algorithm
10 SP x x x x

19 Division Algorithm

20 div div performs an unsigned division of the accumulator (and its extension) by the source operand. If the source operand is a byte it is divided into the two-byte dividend assumed to be in registers AL and AH. The byte quotient is returned in AL, and the byte remainder is returned in AH.

21 div div performs an unsigned division of the accumulator (and its extension) by the source operand. If the source operand is a word, it is divided into the two-word dividend in registers AX and DX. The word quotient is returned in AX, and the word remainder is returned in DX.

22 div div performs an unsigned division of the accumulator (and its extension) by the source operand. If the quotient exceeds the capacity of its destination register (FF for byte source, FFFF for word source), as when division by zero is attempted, a type zero interrupt is generated, and the quotient and remainder are undefined. Flags ACOPSZ undefined. div reg8/reg16/mem8/mem16

23 mul mul performs an unsigned multiplication of the source operand and the accumulator. If the source operand is a byte it is multiplied by the register AL and the double length result is returned in AL and AH. If the source operand is a word, then it is multiplied by register AX, and the double length result is returned in registers DX and AX. Flags affected: C O set when the upper half of result is non zero. Flags A P F Z undefined. mul reg8/reg16/mem8/mem16


Download ppt "CS-401 Computer Architecture & Assembly Language Programming"

Similar presentations


Ads by Google