Page 1 of 1

Copying a ROM to RAM ...

Posted: Wed Sep 30, 2015 5:34 pm
by tjewell
Okay - I'd like to copy my Orchestra-90 ROM to RAM so I can tinker with it. I'd also like to understand the general process for copying ROMs to RAM. Back in the day I never owned a Dragon 64, so I'm unsure how the extra memory works.

Is the basic principle that I get Xroar emulating a D64, and then switch between 32K and 64K mode (how do I do that?) and copy the Basic ROM and the Orchestra ROM byte by byte into RAM? So when I'm done, I have the same machine but now with the ROMs in RAM and I can tinker to my heart's content?

Thanks all!

Re: Copying a ROM to RAM ...

Posted: Wed Sep 30, 2015 6:38 pm
by tormod
For instance like this (pasted from HDB-DOS preload.asm)

Code: Select all

        orcc    #$50            Disable interrupts

* Copy ROMs to RAM

        ldx     #$8000          Start of ROM
copyrom sta     $ffde          Switch to ROM page
        lda     ,x
        sta     $ffdf          Switch to RAM page
        sta     ,x+
        cmpx    #$e000          End of ROM
        bne     copyrom

        andcc    #$af            Enable interrupts
This copies 8KB of cartridge ROM, replace $e000 above if needed.

Re: Copying a ROM to RAM ...

Posted: Wed Sep 30, 2015 6:45 pm
by robcfg
You don't need to switch to 64kb mode. That will block your access to the rom as you'll have the second 32KB mapped on the upper address range.

As far as I remember, cartridge memory goes from &HC000 to &FEFF (that's 16KB minus 256 bytes that are used as I/O ports).

So, you only have to PEEK(&HC000+X) and POKE the result to the memory area of your choice.

Re: Copying a ROM to RAM ...

Posted: Wed Sep 30, 2015 9:37 pm
by pser1
Hi Tony,

I would recommend the routine proposed by Tormod.
If you have a 64k, the best way is go MAP1 and have the basic and the Orchestra copied to the same adresses
but now in RAM, so you can modify anything if you need to.
I assume you are planning to do that in XRoar and with the help of GDB, aren't you?

cheers
pere

Re: Copying a ROM to RAM ...

Posted: Thu Oct 01, 2015 12:01 am
by tjewell
Thanks everyone! Pere, I took your advice and adapted Tormod's code and now have the ROM in RAM, ready for any patching I fancy. And yes, this is all happening within Xroar and GDB. Now to dust off those 6809 manuals ...

Re: Copying a ROM to RAM ...

Posted: Thu Oct 01, 2015 10:46 am
by pser1
Hi Tony,
alright, so no need to worry about what you are doing changing bytes ... XRoar would not burn in flames!
best luck and have fun with the GBD

cheers
pere