tailieunhanh - The 80x86 IBM PC and Compatible Computers- P18

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 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 . 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 - . 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

crossorigin="anonymous">
Đã phát hiện trình chặn quảng cáo AdBlock
Trang web này phụ thuộc vào doanh thu từ số lần hiển thị quảng cáo để tồn tại. Vui lòng tắt trình chặn quảng cáo của bạn hoặc tạm dừng tính năng chặn quảng cáo cho trang web này.