Copying a ROM to RAM ...

A place to discuss everything Dragon related that doesn't fall into the other categories.
Post Reply
tjewell
Posts: 353
Joined: Mon Oct 19, 2009 4:58 pm
Location: Cambridge, England

Copying a ROM to RAM ...

Post 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!
User avatar
tormod
Posts: 416
Joined: Sat Apr 27, 2013 12:06 pm
Location: Switzerland
Contact:

Re: Copying a ROM to RAM ...

Post 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.
Last edited by tormod on Wed Sep 30, 2015 6:46 pm, edited 1 time in total.
User avatar
robcfg
Posts: 1542
Joined: Sat Apr 04, 2009 10:16 pm
Location: Stockholm, Sweden
Contact:

Re: Copying a ROM to RAM ...

Post 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.
pser1
Posts: 1677
Joined: Sun Mar 25, 2012 7:32 pm
Location: Barcelona (SPAIN)

Re: Copying a ROM to RAM ...

Post 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
tjewell
Posts: 353
Joined: Mon Oct 19, 2009 4:58 pm
Location: Cambridge, England

Re: Copying a ROM to RAM ...

Post 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 ...
pser1
Posts: 1677
Joined: Sun Mar 25, 2012 7:32 pm
Location: Barcelona (SPAIN)

Re: Copying a ROM to RAM ...

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