Académique Documents
Professionnel Documents
Culture Documents
i) compact code (compared to C) ii) access to the special features of the processor hardware. i) Highly compact code ii) Fast execution
A typical example of memory mapped I/O device is Display buffer (each character position in screen is assigned with one / more unique address).
In IBM-PC, color display buffer is mapped with memory address B8000H. Each charater is assigned with 2 bytes, first byte for ASCII code of that character and second byte for the foreground and back ground color information. The address of the first byte of a specific row & column is calculated as B8000H + 2 (80 x Row + Column)
Alternate method to access a memory location is by using a pointer (Pointer is a variable that holds an address of memory location) Example: int a, b; int *c ; a=5 ; c = &a; b = *c;
/* p is a pointer to a char */
/* p is intialized */
Declaration & Initialization char *p = (char *) (0xB8000 + 2 * (80 * row + col)) ; /* declaration & initialization */