Computer Architecture and Organization THE IBM PC ARCHITECTURE LEOPOLDO GABRIEL, MSCS,BSME About Leopoldo Toscano Gabriel Academics B.S. in Mechanical Engineering. Mapua Institute of Technology Registered Mechanical Engineer M.S. in Computer Science, Ateneo de Manila University Basic Computer Diagram Processor Bus Memory Controller Controller To I/O devices Controller Controller Controller Controller Course Outline Introduction Memory Addressing Writing Assembly Language Program Memory Mapped Video Understanding the Program Structure Building Large Program Interrupt Functions Cross Language Programming Compiling High Level Language Programs Memory Contains the code and data of a program that can be accessed by the processor Have addresses that enable processor to remember the location of code and data Is divided into words – the number of bytes that can be accessed simultaneously at any given time. In a 16-bit processor, the word is 16-bit or two bytes. Contiguous words can be grouped in paragraph which normally contain the a number of words belonging together. In IBM PC, a paragraph is composed of 16 bytes. Is composed of Random Accessed Memory(RAM) and Read Only Memory(ROM) Memory Address The 8086 memory address is divided into overlapping segments whose size is 64K The memory address is composed of segment address and the offset Segment Address Offset Address 16 - bit 16 - bit For Example 1100110011110011 : 0000110011110011 In binary(grouped)1100 1100 1111 0011 : 0000 1100 1111 1011 In decimal 12 12 15 In Hexadecimal C C F In Hexadecimal CCF3:0DFB 3 : 0 3 : 0 13 15 11 D F B Converting to physical address The IBM PC is capable of addressing 1 Megabyte of memory. It uses 20-bit hysical address In decimal it is 0000 0000 0000 0000 0000 In Hexdecimal 0 0 0 0 0 to 1111 1111 1111 1111 1111 F F F F F In Hexadecimal this is 0 to F FFFF FFFF or a total 1 0000 0000 Bytes Since this will require 20 bits but 16-bit register have a maximum value of of FFFF FFFF the address is divided into segments so that the address are expressed as a combination of two values , the segment and offset addresses. The memory in IBM PC is divided into segments Overlapping Memory Segment Physical Address 0 0000 0000 Segment: Offset 0002 0001 NA NA 0000 0000:0000 0 0000 0010 NA 0001:0000 0000:0010 0 0000 0010 0002:0000 0001:00010 0000:0020 text text 0 0000 FFFF 0002:FFE0 0001:FFF0 0000:FFFF text Overlapping Memory Segment (Cont.) The preceding figure shows the equivalence of physical and segment-offset address. A given memory location can have more than one segment-offset address but there is only one physical address. For example, Physical address 0 0000 0000 is specified as segment offset address 0000:0000 Physical address 0 0000 0010 may be specified as segment offset address 0000:0010 or 0001:0000 Physical address 0 0000 0020 may be specified as segment offset address 0000:0020 or 0001:0010 or 0002:0000 Or Segment 0000 0001 0002 Offset +0020 +0010 +0000 --------- --------- _____ 00020 00020 00020 Physical Address Exercise: Fill in the missing box so the addresses are the same in each row. If the segment address is not valid for the row then set the answer to NA. Ghibi P. Trinidad IT150-8L_OL163 Physical Address Address 1 Address 2 Address 3 Address 4 00B00 0010:0A00 0F00:NA 00B0:0000 0D0F:NA 002A0 0010:01A0 0F00:NA 00B0:NA 0D0F:NA 0F0D0 0010:EFD0 0F00:00D0 00B0:E5D0 0D0F:1FE0 01B32 0010:1A32 0F00:NA 00B0:1032 0D0F:NA 0E324 0010:E224 0F00:NA 00B0:D824 0D0F:1234 Memory Map of the IBM PC Interrupt Table ROM BIOS Operating Data Area Operating System Data Operating System Functions Applications Video RAM ROM BIOS Interrupt Table Starts at physical address 0000 or segment address 0000:0000 The interrupt table contains the segment and offset addresses of the ROM-BIOS or OS functions Each entry in the table contains 16-bit offset followed by the 16-bit segment address of the routine interrupt routine. The size of each entry is therefore 32 bytes or 4 byte each. ROM BIOS Operating data ROM BIOS functions needs memory to store variables. This section in memory is allotted for that purpose. For example, when the user press a key in the keyboard, the ROM BIOS keyboard function needs to capture the scan code of the key and store it in this memory so that applications can determine the key that was pressed. Operating System Data When the PC is started, the ROM-BIOS will attempt to load the operating system from a bootable device such as a hard disk or USB that contains the Operating System The Operating system is a collection of functions that are used in managing the system resources. OS functions needs this memory area to store their variables. Operating System Functions The OS functions are loaded from the disk to the memory by the bootstrap loader. This functions are: ◦ Process Management ◦ Memory Management and ◦ File System Applications This is the part of the memory dedicated for executing programs. Program is made of ◦ Code ◦ Instructions ◦ Operation - opcode ◦ Operand ◦ Data ◦ Has type ◦ Int,Character,String,Array,Structure ◦ Has size ◦ 1 byte, 2 bytes, 4 bytes, dimension Video Memory The memory holding the content of the video display The pixels or characters making up the graphics or text mode screen is memory mapped. Each memory either holds the character code or the color of the pixel The more pixel that can be displayed individually, the higher the resolution The higher resolution the bigger the memory required. The video memory of an IBM PC starts at address B800:0000 ROM-BIOS Serves like the gene of the machine that defines how the machine will behave upon power on and provides the default behavior through the preexisting IO routines that applications will most likely depend on. The content of the ROM-BIOS survives the termination(power off) of the machine. Contains the basic or primitive functions that ◦ Contains the program that determines if the various IO devices are working. The Power on Self Test (POST ) ◦ Contains the program that read the very first content of a bootable media(i.e.floppy, hard disk, or USB) and load this content to the memory. A process called “bootstrapping” ◦ Contains machine level I/O programs to access to the input and output devices i.e keyboard, disk, mouse etc.