19 lines
822 B
C
19 lines
822 B
C
|
void mainentry() {
|
|||
|
int x = 5;
|
|||
|
|
|||
|
char* video_memory = (char*) 0xb8000;
|
|||
|
*video_memory = 'X';
|
|||
|
|
|||
|
// Here , the star following the type means that this is not a variable to hold
|
|||
|
// a char (i.e. a single byte ) but a pointer to the ADDRESS of a char ,
|
|||
|
// which , being an address , will actually require the allocation of at least
|
|||
|
// 32 bits .
|
|||
|
char * video_address = (char*)(0xb8000);
|
|||
|
// If we ’d like to store a character at the address pointed to , we make the
|
|||
|
// assignment with a star - prefixed pointer variable . This is known as
|
|||
|
// dereferencing a pointer , because we are not changing the address held by
|
|||
|
// the pointer variable but the contents of that address .
|
|||
|
*video_address = 'x';
|
|||
|
// Just to emphasise the purpose of the star , an ommision of it , such as:
|
|||
|
}
|