Đang chuẩn bị liên kết để tải về tài liệu:
The 80x86 IBM PC and Compatible Computers- P18

Đang chuẩn bị nút TẢI XUỐNG, xin hãy chờ

The 80x86 IBM PC and Compatible Computers- P18: Praised by experts for its clarity and topical breadth, this visually appealing, one-stop source on PCs uses an easy-to-understand, step-by-step approach to teaching the fundamentals of 80x86 assembly language programming and PC architecture. Offering users a fun, hands-on learning experience, it uses the Debug utility to show what action the instruction performs, then provides a sample program to show its application. | SECTION 28.2 PROGRAMMING PC HARDWARE WITH C C In addition to accessing the CPU s registers we can also access memory and input output ports with C C . Accessing 80x86 SEGMENT OFFSET memory addresses in C The IM memory space of the 80x86 microprocessor is accessed by addresses in the form of seg.offset. For example the logical address B000 0000 represents the physical address B0000H. If the address is within the same segment it is a 16-bit address and uses a near pointer. If the address is outside the segment it is in the 32-bit form of seg offset and uses a far pointer. In C compilers for the 80x86 PC the physical address of B8000H is represented in its seg offset form of B800 0000H and is declared as 0xB8000000 where Ox indicates a hex number. unsigned int far pter declare a far pointer 7 pter unsigned int far 0xB80000G0 assigned the hex B8000000 address to pter pointer The code unsigned int far is written to typecast address 0xB8000000 since pter OxB8000000 will cause the compiler to generate a warning message. This typecasting informs the compiler that OxBOOOOOOO a long integer is a far pointer pointing to an unsigned integer. Next we show how the BIOS data area can be accessed to examine the PC hardware configurations and its devices. Accessing BIOS data area with C As we have seen throughout many of the chapters in this book the physical memory locations 00400H to 004FFH commonly referred to as the BIOS data area hold some very important information about PC hardware configuration and the status of many of its devices such as printer and COM ports. The address for the BIOS data area in segroffset format is 0000 0400H - 0000.04FFH. Example 28-7 uses C to detect the installation of LPT 1 and display the port address assigned to it. Example 28-8 shows how the COM2 port is detected and reported. Example 28-7 Write a C program to detect the installation of LPT 1 and report the I