Example uses "volatile"; compiler says "undefined identifier volatile"

Paul phshaffer at gmail.com
Thu Aug 1 03:04:27 UTC 2019

I'm trying to build a Bare Bones 'OS' via example.  Example says 
to compile with
"gdc -c kernel.main.d -o kernel.main.o -g"  I'm having trouble 
getting GDC all set up..as I'm a rank amateur.  So, I tried 
compiling the example below with DMD.  DMD spits out exceptions 
to the use of 'volatile'. DIP62 on D wiki says status:REJECTED 
for volatile.
Whats my work around here?  This is what I'm trying to do-> 
https:// wiki.osdev.org / D_Bare_Bones

Thanks for any help.

module kernel.main;

extern(C) void main(uint magic, uint addr) {
         int ypos = 0; //Starting points of the cursor
	int xpos = 0;
	const uint COLUMNS = 80; //Screensize
	const uint LINES = 25;

	ubyte* vidmem = cast(ubyte*)0xFFFF_8000_000B_8000; //Video 
memory address

	for (int i = 0; i < COLUMNS * LINES * 2; i++) { //Loops through 
the screen and clears it
			volatile *(vidmem + i) = 0;

	volatile *(vidmem + (xpos + ypos * COLUMNS) * 2) = 'D' & 0xFF; 
//Prints the letter D
	volatile *(vidmem + (xpos + ypos * COLUMNS) * 2 + 1) = 0x07; 
//Sets the colour for D to be light grey (0x07)

	for (;;) { //Loop forever. You can add your kernel logic here

More information about the Digitalmars-d-learn mailing list