XRoar and Dragon32 emulation?

Hardware Hacking, Programming and Game Solutions/Cheats
pser1
Posts: 1655
Joined: Sun Mar 25, 2012 7:32 pm
Location: Barcelona (SPAIN)

XRoar and Dragon32 emulation?

Post by pser1 »

Hi Ciaran,
I am trying to verify a program that switches to MAP1 and writes a word into $c000 then compares the written value to what exists
in $c000 and much to my surprise the memory has been written! Even having told XRoar that I want a 32K machine ...

I might be wrong, but right now I don't remember having set at any place in the xroar.conf file that it has to have 64k.

The bat I use is this one:
xroar -machine dragon32 -machine-cpu 6309 -extbas d32.rom -machine-cart dragondos -cart-rom ddos40.rom -ram 32 -force-crc-match
-disk-write-back -joy-left 0,0:1:0 -kbd-translate -lp-file ..\XRoar\dragon.txt

Probably I am forgetting about a parameter that should be set, but don't know what :-(
Is there anyway to tell XRoar that the Dragon32 has *only* 32k and so it is not possible to write from $c000 onwards?
thanks beforehand
pere
sixxie
Posts: 1346
Joined: Fri Jul 18, 2008 8:36 am
Location: Hertfordshire
Contact:

Re: XRoar and Dragon32 emulation?

Post by sixxie »

I think you're seeing aliasing: you'll probably find your data is also magically appearing at $4000...

Edit: here's how I test for 64K:

Code: Select all

                ; test for 64K
                sta reg_sam_tys
                lda $0062
                ldb $8063
                coma            ; a != [$0062]
                comb            ; b != [$0063]
                std $8062
                cmpd $8062
                bne no_64k      ; didn't write
                cmpd $0062
                beq no_64k      ; *did* shadow write
                ; 64k-specific stuff here
                ; ...
                bra 10F
no_64k          sta reg_sam_tyc
                ; 32k-specific stuff here
                ; ...
10
Might be overkill ;)
pser1
Posts: 1655
Joined: Sun Mar 25, 2012 7:32 pm
Location: Barcelona (SPAIN)

Re: XRoar and Dragon32 emulation?

Post by pser1 »

Hi Ciaran,
thanks a lot for this explanation. I had not thought about this possibility ...
Will try your code.
Just need to be sure that a program that must switch to map1 is not loaded in a 32k machine.
Will tell you how it works for me.

cheers
pere
pser1
Posts: 1655
Joined: Sun Mar 25, 2012 7:32 pm
Location: Barcelona (SPAIN)

Re: XRoar and Dragon32 emulation?

Post by pser1 »

I see that you don't switch to MAP1 ...
The code I was trying does this:

Code: Select all

	sta	$ffdf			; switch to MAP1
	ldd   $c000		; get two bytes from rom area
	ldx   #$9669		; create a pattern 1001 0110 0110 1001
	stx   $c000		; store into two dos-rom bytes
	cmpx  $c000		; have been modified?
	bne   No64K		; NO, this machine cannot siwtch to MAP1
	std   $c000		; put back two saved bytes
Is there any problem doing this that way? ... other than the $c000 that could be changed to $8000

regards
pere
pser1
Posts: 1655
Joined: Sun Mar 25, 2012 7:32 pm
Location: Barcelona (SPAIN)

Re: XRoar and Dragon32 emulation?

Post by pser1 »

I have tried my old code changing $c000 by $8000 and the result is the same.
If the machine has only 32K, the area from $8000 on *is* ROM, and so it should not
be overwritten ... I think that this will not happen on the real D32

cheers
pere
sixxie
Posts: 1346
Joined: Fri Jul 18, 2008 8:36 am
Location: Hertfordshire
Contact:

Re: XRoar and Dragon32 emulation?

Post by sixxie »

pser1 wrote:I have tried my old code changing $c000 by $8000 and the result is the same.
If the machine has only 32K, the area from $8000 on *is* ROM, and so it should not
be overwritten ... I think that this will not happen on the real D32
Hmm, you're right that it wouldn't happen as you describe. It looks like I've introduced a bug somewhere along the line. What should happen if you write to addresses >= $8000 in map type 1 on an unexpanded Dragon 32 is that the value from ROM usually at that address will be written to the aliased location in low RAM (address & $7fff).

I've got a fix, will try and roll out a minor release soon.

..ciaran
pser1
Posts: 1655
Joined: Sun Mar 25, 2012 7:32 pm
Location: Barcelona (SPAIN)

Re: XRoar and Dragon32 emulation?

Post by pser1 »

sixxie wrote: Hmm, you're right that it wouldn't happen as you describe. It looks like I've introduced a bug somewhere along the line. What should happen if you write to addresses >= $8000 in map type 1 on an unexpanded Dragon 32 is that the value from ROM usually at that address will be written to the aliased location in low RAM (address & $7fff).
I've got a fix, will try and roll out a minor release soon.
..ciaran
That's great news!
I think I have tried older versions and all of them had the same behaviour
I will test it as soon as you tell me you have released the mod
thanks a lot
cheers
pere
sixxie
Posts: 1346
Joined: Fri Jul 18, 2008 8:36 am
Location: Hertfordshire
Contact:

Re: XRoar and Dragon32 emulation?

Post by sixxie »

pser1 wrote:
sixxie wrote: I will test it as soon as you tell me you have released the mod
Released!
pser1
Posts: 1655
Joined: Sun Mar 25, 2012 7:32 pm
Location: Barcelona (SPAIN)

Re: XRoar and Dragon32 emulation?

Post by pser1 »

sixxie wrote: Released!
I have downloaded v35.1 and tested the same program I was using without changes ...
The result is the same, $c000 gets modified and so the compare finds equal values
wich should not happen on real hardware.
cheers
pere
pser1
Posts: 1655
Joined: Sun Mar 25, 2012 7:32 pm
Location: Barcelona (SPAIN)

Re: XRoar and Dragon32 emulation?

Post by pser1 »

Hello Ciaran,
I have tested it some more times getting always the very same result. The RAM cell $c000 is overwritten
despite the program has switched to MAP1 and the emulation expects to work with a 32K machine.

For maybe there is something wrong in my bat file that starts XRoar I include it here.
Not sure if the place where I put the parameter -ram 32 is the correct one.

Code: Select all

xroar -machine dragon32 -machine-cpu 6309 -extbas d32.rom -machine-cart dragondos -cart-rom -ram 32 ddos40.rom -ram 32 -force-crc-match -disk-write-back -joy-left 0,0:1:0 -kbd-translate -lp-file ..\XRoar\dragon.txt 
Unfortunately I cannot debug with GDB using standard 6809 CPU because I get this message
Register 9 is not available
And it stops.
cheers
pere
Post Reply