Presentation is loading. Please wait.

Presentation is loading. Please wait.

Assembly Language Lecture BY SHERY KHAN

Similar presentations


Presentation on theme: "Assembly Language Lecture BY SHERY KHAN"— Presentation transcript:

1 Assembly Language Lecture 04-06 BY SHERY KHAN sherykhan@gmail.com
Review By Sultan Fahad April

2 LACUNY Web Roundtable galina.letnikova@lehman.cuny.edu
Agenda To day we learn about Recap & Exercise (Page 15) Data Declaration (Page 17) Direct Addressing (page 17) Size Mismatch Errors (page 21) Register Indirect Addressing (page 22) October 21, 2005 LACUNY Web Roundtable April

3 LACUNY Web Roundtable galina.letnikova@lehman.cuny.edu
RECAP & EXERCISE Last Lecture we can discuss the Few Important Topics Now on the basis of previous knowledge we can Solve the Exercise October 21, 2005 LACUNY Web Roundtable April

4 LACUNY Web Roundtable galina.letnikova@lehman.cuny.edu
Exercise How the Processor uses the Address Bus ,Data bus and control Bus? Processor Execute Operation and memory contain data element Memory is a Dump Device in which Data resides Key point is that Processor want to read or write Data so for reading data or writing purposes are achieved by Address bus & data Bus & Control Bus Address bus is Used When Processor Want to Certain read or write operation. Data Bus is Used to move data form Memory to Processor in Read Operation & Processor to Memory For Write Operation. Control BUS is independent lines used to inform Memory about Certain operation October 21, 2005 LACUNY Web Roundtable April

5 EXERCISE Qno2 Which of the Following are Uni & Bi Directional
Address Bus Is Uni Directional because Address Always Travel From Processor to Memory & Memory Cannot Predict which Element the Processor want to read or Write DATA BUS: data Travel From Both processor to memory& vice versa So data Bus is Bi Directional Control Bus Is Bi directional October 21, 2005 LACUNY Web Roundtable

6 What is The Size of the Accumulator of 64 bit Processor?
The Size of Accumulator of 64 bit processor is 64 bit According to defination “ the Word size of processor is defined by the width of accumulator” October 21, 2005 LACUNY Web Roundtable April

7 How many Instruction Classified into groups?
There are Four Categories of Instructions. Data Movement Instruction Arithmetic Logic instruction Program Control Instruction Special Instructions October 21, 2005 LACUNY Web Roundtable

8 A combination of 8 bit are Byte what is name of Four Bit & 16 bit??
Four BITS: are called as NIBBLE Four Bytes : Are Called double Word (32bit) 16 Bits : are called word (2 byte long) October 21, 2005 LACUNY Web Roundtable

9 What is Maximum Memory 8088 can access??
The 8088 can Allow Whole MEGA BYTE Which can be Accessed with 20 bits October 21, 2005 LACUNY Web Roundtable

10 LACUNY Web Roundtable galina.letnikova@lehman.cuny.edu
List the 14 register of 8088 ? HERE TO New the Register the Afd View October 21, 2005 LACUNY Web Roundtable

11 What is Difference Little Endean & Big Endian
Little Endian: Big Endian: Least Significant Most Significant More Significant Less Significant Most Significant Least Significant For e.g For e.g October 21, 2005 LACUNY Web Roundtable

12 Which Format was Used by INTEL 8088
Little Endian Order is used By Intel8088 October 21, 2005 LACUNY Web Roundtable

13 LACUNY Web Roundtable galina.letnikova@lehman.cuny.edu
Give the Value of Zero flag carry flag sign flag and overflow flag after each of the Following instructions mov ax 0x mov bx 0x0FFF add ax,0xEDAB Zero FLAG:0 CF:0 SF:1 OF:0 Add ax,bx ZF:0 SF:0 oF:0 Add bx,0xf001 ZF:0, CF:1 SF:0 OF:0 October 21, 2005 LACUNY Web Roundtable

14 LACUNY Web Roundtable galina.letnikova@lehman.cuny.edu
13. For each of the following words identify the byte that is stored at lower memory address and the byte that is stored at higher memory address in a little endian computer. a b. ABFC c. B100 d. B800 FEW SLIDE SHOW WE DISCUSS THE LITTLE ENDIAN Above the 1234 Followed the Definition So this Is our desired Result 1234 October 21, 2005 LACUNY Web Roundtable

15 LACUNY Web Roundtable galina.letnikova@lehman.cuny.edu
15. What is the offset at which the first executable instruction of a COM file must be placed? The First Instruction of COM File Must be Offset at 0x0100(decimal 255) as required What is the difference between an instruction mnemonic and its opcode? Opcode Short for operational code, it is a number that determines the computer instruction to be executed. (machine language representation of an instruction October 21, 2005 LACUNY Web Roundtable April

16 What flags are defined in the 8088 FLAGS register
What flags are defined in the 8088 FLAGS register? Describe the function of the zero flag, the carry flag, the sign flag, and the overflow flag. Zero flag????? The Zero flag is set if the last mathematical or logical instruction has produced a zero in its destination. Carry flag When two 16bit numbers are added the answer can be 17 bits long or when two 8bit numbers are added the answer can be 9 bits long. This extra bit that won’t fit in the target register is placed in the carry flag where it can be used and tested. Sign flag A signed number is represented in its two’s complement form in the computer. The most significant bit (MSB) of a negative number in this representation is 1 and for a positive number it is zero. The sign bit of the last mathematical or logical operation’s destination is copied into the sign flag. Overflow flag The overflow flag is set during signed arithmetic, e.g. addition or subtraction, when the sign of the destination changes unexpectedly. The actual process sets the overflow flag whenever the carry into the MSB is different from the carry out of the MSB.

17 What are the contents of memory locations 200, 201, 202, and 203 if the word 1234 is stored at offset 200 and the word 5678 is stored at offset 202? In Little Endean, least significant byte is stored first at lower addresses; most significant byte is stored after it. Like for example the number 0x1234 is stored at memory address 0x123 then it will appear like as below: Address Contents 0x123 34 0x124 12 Do try it for the given memory addresses with given numbers.

18 Why was segmentation originally introduced in 8088 architecture?
Four windows of 64K Code window Data window Stack window The segmented memory model allows multiple functional windows into the main memory, a code window, a data window etc. The processor sees code from the code window and data from the data window. The size of one window is restricted to 64K software fits in just one such window. It sees code, data, and stack from this one window, so downward compatibility is attained.

19 What are the first and the last physical memory addresses accessible using the following segment values? First 0x0000 and last 0xFFFF First physical address Last physical address a. 1000 0x x10000 +0x x0FFFF =0x =0x1FFFF b. 0FFF 0x0FFF0 0x0FFF0 +0x x0FFFF =0x0FFF0 =0x1FFEF 1002 0x x10020 +0x x0FFFF =0x =0x2001F d. 0001 0x x00010 =0x =0x1000F E000 0xE xE0000 =0xE =0xEFFFF

20 Why a segment start cannot start from the physical address 55555??.
For any segment base address, segment first physical address will have 0 in the least significant position in hexadecimal format. Let say,our Segment base =0x1234, and we calculate segment first physical address as 0x12340 <- 0x x00000 (Segment First Address) Thusall segments starting physical address has 0 at its least significant position. In case of as segment first physical address there in no 0 at least significant positions so this cannot be a segment starting physical address.

21 Q21 Write a program in assembly language that Calculate the Square ?
[org 0x0100] Mov ax, 6 Add ax, 6 Mov ax, 0x4c00 Int 0x21 April

22 Table of Hexa To Deci October 21, 2005

23 First physical address = 00000 + 00000 = 00000
What are the first and the last physical memory addresses accessible using the following segment values? (2 mark each) 0000 FFFF Answer: a) First physical address = = 00000 Last physical address = FFFF = 0FFFF b) First physical address = FFFF = FFFF0 Last physical address = FFFF0 + 0FFFF = 10FFEF = 0FFEF (wraparound) 26 April 2013 Shery khan

24 TODAY LECTURE 05 DATA DECLARATION:
IMMEDIATE OPERANDS: In our previous Programs We use a Immediate operand but in Meaningful Programs we use data from Memory instead of Constant because constant cannot change Constant cannot appear as destination operand which is Ilegal if we place it as Destination we know that operation destination, source operation destination operation source operation October 21, 2005 LACUNY Web Roundtable

25 LACUNY Web Roundtable galina.letnikova@lehman.cuny.edu
DATA DECLARATION: Only Register or data Can be placed in memory can be changed So real data is one stored in memory with Few constant so there is Mechanism which is used And is Called Data Declaration October 21, 2005 LACUNY Web Roundtable

26 LACUNY Web Roundtable galina.letnikova@lehman.cuny.edu
DATA DECLARATION: To Declare a part of our program as holding data instead of instruction we need a Special Directives which are Following DEFINE BYTE: (db) I byte DEFINE WORD :(dw) 16 bits(2 byte) Db: reserve one single byte cell in memory dw:reserve whole 16 bits instead of Byte October 21, 2005 LACUNY Web Roundtable


Download ppt "Assembly Language Lecture BY SHERY KHAN"

Similar presentations


Ads by Google