Presentation on theme: "Assembly Language Lecture BY SHERY KHAN"— Presentation transcript:
1 Assembly Language Lecture 04-06 BY SHERY KHAN firstname.lastname@example.org Review BySultan FahadApril
2 LACUNY Web Roundtable email@example.com AgendaTo day we learn aboutRecap & Exercise (Page 15)Data Declaration (Page 17)Direct Addressing (page 17)Size Mismatch Errors (page 21)Register Indirect Addressing (page 22)October 21, 2005LACUNY Web RoundtableApril
3 LACUNY Web Roundtable firstname.lastname@example.org RECAP & EXERCISELast Lecture we can discuss the Few Important Topics Now on the basis of previous knowledge we can Solve the ExerciseOctober 21, 2005LACUNY Web RoundtableApril
4 LACUNY Web Roundtable email@example.com 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 operationOctober 21, 2005LACUNY Web RoundtableApril
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 WriteDATA BUS: data Travel From Both processor to memory& vice versa So data Bus is Bi DirectionalControl Bus Is Bi directionalOctober 21, 2005LACUNY 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, 2005LACUNY Web RoundtableApril
7 How many Instruction Classified into groups? There are Four Categories of Instructions.Data Movement InstructionArithmetic Logic instructionProgram Control InstructionSpecial InstructionsOctober 21, 2005LACUNY Web Roundtable
8 A combination of 8 bit are Byte what is name of Four Bit & 16 bit?? Four BITS: are called as NIBBLEFour Bytes : Are Called double Word (32bit)16 Bits : are called word (2 byte long)October 21, 2005LACUNY Web Roundtable
9 What is Maximum Memory 8088 can access?? The 8088 can Allow Whole MEGA BYTEWhich can be Accessed with 20 bitsOctober 21, 2005LACUNY Web Roundtable
10 LACUNY Web Roundtable firstname.lastname@example.org List the 14 register of 8088 ?HERE TO New the Register the Afd ViewOctober 21, 2005LACUNY Web Roundtable
11 What is Difference Little Endean & Big Endian Little Endian: Big Endian:Least Significant Most SignificantMore Significant Less SignificantMost Significant Least SignificantFor e.g For e.gOctober 21, 2005LACUNY Web Roundtable
12 Which Format was Used by INTEL 8088 Little Endian Order is used By Intel8088October 21, 2005LACUNY Web Roundtable
13 LACUNY Web Roundtable email@example.com Give the Value of Zero flag carry flag sign flag and overflow flag after each of the Following instructions mov ax 0x mov bx 0x0FFFadd ax,0xEDABZero FLAG:0CF:0SF:1OF:0Add ax,bxZF:0SF:0oF:0Add bx,0xf001ZF:0, CF:1 SF:0 OF:0October 21, 2005LACUNY Web Roundtable
14 LACUNY Web Roundtable firstname.lastname@example.org 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. B800FEW SLIDE SHOW WE DISCUSS THE LITTLE ENDIANAbove the 1234 Followed the Definition So this Is our desired Result1234October 21, 2005LACUNY Web Roundtable
15 LACUNY Web Roundtable email@example.com 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 requiredWhat is the difference between an instruction mnemonic and its opcode?OpcodeShort for operational code, it is a number that determines the computer instruction to beexecuted. (machine language representation of an instructionOctober 21, 2005LACUNY Web RoundtableApril
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 inits destination.Carry flagWhen two 16bit numbers are added the answer can be 17 bits long or when two 8bitnumbers are added the answer can be 9 bits long. This extra bit that won’t fit in the targetregister is placed in the carry flag where it can be used and tested.Sign flagA signed number is represented in its two’s complement form in the computer. The mostsignificant bit (MSB) of a negative number in this representation is 1 and for a positivenumber it is zero. The sign bit of the last mathematical or logical operation’s destinationis copied into the sign flag.Overflow flagThe overflow flag is set during signed arithmetic, e.g. addition or subtraction, when thesign of the destination changes unexpectedly. The actual process sets the overflow flagwhenever 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 significantbyte is stored after it. Like for example the number 0x1234 is stored at memory address0x123 then it will appear like as below:Address Contents…0x123 340x124 12Do try it for the given memory addresses with given numbers.
18 Why was segmentation originally introduced in 8088 architecture? Four windows of 64KCode windowData windowStack windowThe segmented memory model allows multiple functional windows intothe main memory, a code window, a data window etc. The processor seescode from the code window and data from the data window. The size ofone window is restricted to 64K software fits in just one suchwindow. It sees code, data, and stack from this one window, sodownward compatibility is attained.
19 What are the first and the last physical memory addresses accessible using the following segment values?First 0x0000 and last 0xFFFFFirst physical address Last physical addressa. 10000x x10000+0x x0FFFF=0x =0x1FFFFb. 0FFF0x0FFF0 0x0FFF0+0x x0FFFF=0x0FFF0 =0x1FFEF10020x x10020+0x x0FFFF=0x =0x2001Fd. 00010x x00010=0x =0x1000FE0000xE 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 leastsignificant position in hexadecimal format.Let say,our Segment base =0x1234, and we calculate segment first physical address as0x12340 <- 0x x00000 (Segment First Address)Thusall segments starting physical address has 0 at its least significant position. In caseof as segment first physical address there in no 0 at least significant positions sothis cannot be a segment starting physical address.
21 Q21 Write a program in assembly language that Calculate the Square ? [org 0x0100]Mov ax, 6Add ax, 6Mov ax, 0x4c00Int 0x21April
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)0000FFFFAnswer:a)First physical address = = 00000Last physical address = FFFF = 0FFFFb)First physical address = FFFF = FFFF0Last physical address = FFFF0 + 0FFFF = 10FFEF = 0FFEF (wraparound)26 April 2013Shery 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 thatoperation destination, sourceoperation destinationoperation sourceoperationOctober 21, 2005LACUNY Web Roundtable
25 LACUNY Web Roundtable firstname.lastname@example.org DATA DECLARATION:Only Register or data Can be placed in memory can be changedSo real data is one stored in memory withFew constant so there is Mechanism which is used And is Called Data DeclarationOctober 21, 2005LACUNY Web Roundtable
26 LACUNY Web Roundtable email@example.com DATA DECLARATION:To Declare a part of our program as holding data instead of instruction we need a Special Directives which are FollowingDEFINE BYTE: (db) I byteDEFINE WORD :(dw) 16 bits(2 byte)Db: reserve one single byte cell in memory dw:reserve whole 16 bits instead of ByteOctober 21, 2005LACUNY Web Roundtable