RAM initial state...

A place to discuss everything Dragon related that doesn't fall into the other categories.
Post Reply
jedie
Posts: 656
Joined: Wed Aug 14, 2013 12:23 pm
Location: germany
Contact:

RAM initial state...

Post 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?
... too many ideas and too little time ... Related stuff written in Python:
Dragon 32 emulator / PyDC - Python Dragon 32 converter: https://github.com/jedie/DragonPy
DWLOAD server / Dragon-Lib and other stuff: https://github.com/6809
sixxie
Posts: 1357
Joined: Fri Jul 18, 2008 8:36 am
Location: Hertfordshire
Contact:

Re: RAM initial state...

Post 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!
jedie
Posts: 656
Joined: Wed Aug 14, 2013 12:23 pm
Location: germany
Contact:

Re: RAM initial state...

Post by jedie »

Does MESS do the same?
... too many ideas and too little time ... Related stuff written in Python:
Dragon 32 emulator / PyDC - Python Dragon 32 converter: https://github.com/jedie/DragonPy
DWLOAD server / Dragon-Lib and other stuff: https://github.com/6809
sixxie
Posts: 1357
Joined: Fri Jul 18, 2008 8:36 am
Location: Hertfordshire
Contact:

Re: RAM initial state...

Post by sixxie »

Doesn't look like it (MESS 0.148, I'm not completely up to date).
jedie
Posts: 656
Joined: Wed Aug 14, 2013 12:23 pm
Location: germany
Contact:

Re: RAM initial state...

Post 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...
... too many ideas and too little time ... Related stuff written in Python:
Dragon 32 emulator / PyDC - Python Dragon 32 converter: https://github.com/jedie/DragonPy
DWLOAD server / Dragon-Lib and other stuff: https://github.com/6809
sixxie
Posts: 1357
Joined: Fri Jul 18, 2008 8:36 am
Location: Hertfordshire
Contact:

Re: RAM initial state...

Post 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 ;)
Post Reply