 Hello and welcome to the series of video lectures on the subject microprocessor for secondary IT students. I am Dr. Srisail Charatgajbar and in this video lecture we are going to study real and protected addressing modes of 80286 microprocessor. At the end of this session you will be able to describe real addressing mode of 80286 microprocessor. You will also be able to describe protected virtual addressing mode of 80286 microprocessor. 80286 microprocessor operates in either of the two modes. The first mode is real addressing mode in which the processor works similar to the 80286 microprocessor only with the faster speed. And the second mode is a spatial mode which is called as the protected virtual addressing mode in which the microprocessor has memory management and protection abilities. Now let us see the real addressing mode in detail. In real addressing mode 80286 just acts as a fast version of 8086 microprocessor. Only A0 to A19 address lines are used out of 24 address lines. So similar to 8086 it can address up to 2 raise to 20 that is 1 megabyte of physical memory. The physical memory in this case is nothing but a random access memory. Now a question is worth asking here is that will the speeds of 80286 in real addressing mode and 8086 be identical? The answer is no. Because due to the extra pipelining and other circuit level improvements, the speed of 80286 in real addressing mode will be much faster than the 8086 microprocessor which is roughly around 6 times faster than the 8086 microprocessor. Now let us see the real mode memory organization of 80286 microprocessor. In real mode of 80286 microprocessor it can address 1 megabyte of physical memory which is divided into 16 logical segments each of 64 kilobyte in size. At any instant of time the microprocessor has access to only 4 segments namely code segment, data segment, stack segment and extra segment. Now these segments can be of two types either they can be non-overlapping segment or they can be overlapping segment. Now let us see the association of this physical memory with the registers present in the microprocessor. Now the code segment register stores the base address of current code segment. So it will store actually the upper 4 digits of this base address. So similarly data segment will store the upper 4 digits of the data segment base address and so on. Now let us see how the 20-bit physical address is generated in case of real mode of 80286 microprocessor. Here we require base address and offset address. Now in this case the offset value which is 16-bit is added with the segment register value which is shifted to the left by 4 bits. So these are added by the adder to give the 20-bit physical address. Now this segment register value of 16-bit can be present in either of the segment registers whereas this offset value can be obtained in this particular offset register. So for example if you want to access the instruction from the code segment of the memory then in that case the base address will be stored in the code segment and the respective offset value will be present in the instruction pointer. Similar explanation can be given for the remaining segment register and offset values. Before winding the real addressing mode of 80286 microprocessor one thing which is notable in this case is that when 80286 is reset it always starts its execution in the real addressing mode and it performs the following functions. First it initializes the instruction pointer and other registers, it initializes the peripherals, then it initializes the interrupts, then it sets up the descriptor tables and prepares for entering the protected virtual addressing mode. Now pause for a minute and write down the answer of the following question. I hope you have written the answer. The answer in this case is 10FFFH. Now let us see the protected virtual addressing mode 80286 is the first processor which implemented virtual memory and memory management concepts. Though virtual memory does not exist physically it still appears to be available in the system. Concept of virtual memory is implemented using physical memory that is accessible by the CPU and the secondary memory where program code and data is stored. Now as you can see here the complete program to be executed is stored in the secondary memory for example the hard disk of a computer. This complete program is divided into the segments and each segment will be of size less than the 16 megabyte. These segments are called as the pages and these are ordered sequentially as per the program. Now these pages are loaded into this physical memory through the swapping and when this program segment is loaded into this physical memory it is accessed by the CPU, it is executed and again the result may be stored into the secondary memory by using the unswapping mechanism and the next page is again loaded into the physical memory using this swapping. Now let us see what is swapping. Swapping is the procedure of fetching the chosen program segments and data from the secondary storage into the physical memory. Whereas unswapping is the procedure of storing back the partial results or data onto the secondary memory from the physical memory. Virtual memory is allotted per task and it is 1 gigabyte per task. This 1 gigabyte of memory is mapped to the 16 MB of physical memory. So to execute a program which is stored in the hard disk it is first loaded into the physical memory in terms of program or data segment less than 16 MB in size using swapping sequentially as per the sequence of execution. In case of huge programs a set of descriptors also known as descriptor table arranged in proper sequence described the complete program. In multiprogramming environment a descriptor table is prepared and managed by OS. A descriptor is a data structure which identifies a particular program segment or page. A page is a smaller segment belonging to a huge program. Pages are arranged in appropriate sequence and are swapped in and out of the primary memory as per the need of complete execution of a program. Information about a page is contained in the descriptor. There are different types of descriptors, data segment descriptors, code segment descriptors, system segment descriptors which are mainly used for system programs. There are gate descriptors which are used in case of subroutines. In protected virtual address mode the 80286 uses the 16 bit contents of the segment register namely code segment, data segment, stack segment and extra segment as a selector. A selector is used to address a descriptor stored in the 16 MB physical memory. Now what is a descriptor? A descriptor is nothing but a block of continuous memory locations containing information of a segment like segment base address, segment limit, segment type, privilege level, segment availability in physical memory, descriptor type, segment used by another task, etc. Now let us see the significance of descriptor information. Segment base address is the starting location of a segment. Segment limit indicates maximum size of segment. So using segment base and segment limit one can find the last location of a segment. Segment type indicates importance of a segment. Privilege level also indicates importance of a segment. Segment with lower privilege level will not be allowed to access segment with higher privilege levels thus offering a memory protection from unauthorized access. Segment availability in physical memory indicates certain segment is present or not in the physical memory. Segment type indicates whether it is a stream descriptor or gate descriptor etc. Segment used by another task helps in deciding whether a particular segment should be unswept from the physical memory or not. So this is a pictorial representation of how the 24 bit physical address is calculated in 80286 case. So this is a physical memory totaling 16 MB. Since the 24 address lines are used it can access 16 MB of random access memory. Now similar to the real addressing mode the segments will be available here in the unreserved memory area each of 64 kilobytes and at any instant of time only four segments will be active. In contrast with the real addressing mode there will be also a segment descriptor table which is available in the physical memory which stores the information about the pages. Now in this case similar to the real addressing mode a physical address address is used to generate a 24 bit physical address. The input to this physical address are segment base address and offset address. The segment base address is obtained from this segment descriptor information. So these are added here and the 24 bit address is obtained and particular code or data is accessed from the random access memory. This is the reference. Thank you very much.