Page 1 of 1

RAM initial state...

Posted: Sat Oct 12, 2013 8:00 pm
by jedie
From XRoar sourcecode:

Code: Select all

/* Intialise RAM contents */
static void initialise_ram(void) {
	int loc = 0, val = 0xff;
	/* Don't know why, but RAM seems to start in this state: */
	while (loc < 0x10000) {
		machine_ram[loc++] = val;
		machine_ram[loc++] = val;
		machine_ram[loc++] = val;
		machine_ram[loc++] = val;
		if ((loc & 0xff) != 0)
			val ^= 0xff;
	}
}
If I understand this code correctly, than it's simply 4x 0xff then 4x 0x0 in a loop, right?

Code: Select all

0xff,0xff,0xff,0xff,0x0,0x0,0x0,0x0,0xff,0xff,0xff,0xff,0x0,0x0,0x0,0x0...
Is there someone who knowns why this is the initial state of RAM ?


EDIT: I do it just like that now, with: https://github.com/jedie/DragonPy/commi ... 286343R186

But i would like to know why is that so?

Re: RAM initial state...

Posted: Sun Oct 13, 2013 9:15 am
by sixxie
This was purely from observation of one machine - I've not really thought about why, or looked deeply into whether it's accurate across machines!

Re: RAM initial state...

Posted: Sun Oct 13, 2013 11:34 am
by jedie
Does MESS do the same?

Re: RAM initial state...

Posted: Sun Oct 13, 2013 12:19 pm
by sixxie
Doesn't look like it (MESS 0.148, I'm not completely up to date).

Re: RAM initial state...

Posted: Wed Oct 16, 2013 10:42 am
by jedie
I now run my HeyViewer ( https://github.com/jedie/PyDragon32/tre ... /HexViewer ) on a real Dragon 32 and see difference between the "initial" RAM state in XRoar and the real machine...

Maybe the real machine has just some random data in the RAM cells on init and doesn't set all cells to a defined level at startup?

The current region i compare was around $500-$800, because i see difference in my Emulator and XRoar in of $700...
Where "$600-$bff" is documented as "DOS - workspace area"

In Xroar i get from $600 some 00 and FF value in a unknown pattern. While the real machine has different values: 00,FE,FF,08,48...

Re: RAM initial state...

Posted: Wed Oct 16, 2013 1:18 pm
by sixxie
Ah it's almost certainly something to do with which RAM chips are used, their organisation etc.. I just know that on my Dragon 64 I always saw that checkerboard pattern in video RAM on startup, and the heuristic you extracted above appeared to describe it! Doesn't much matter, just going for verisimilitude ;)