6502.org Forum  Projects  Code  Documents  Tools  Forum
It is currently Sun Nov 24, 2024 1:59 am

All times are UTC




Post new topic Reply to topic  [ 11 posts ] 
Author Message
 Post subject: ROM emulation/copier
PostPosted: Fri Aug 28, 2015 4:40 pm 
Offline
User avatar

Joined: Sun Sep 08, 2013 10:24 am
Posts: 740
Location: A missile silo somewhere under southern England
Hi guys

I'm thinking of creating my first ROM emulator/copier and just want to run my rough plan of action passed some folks who have done it previously.

This is what I was thinking of doing:

* The entire memory map uses 64KB RAM - no ROM. Some space is reserved for I/O
* Use an uC (Atmel 328P or 324P) to control the clock source for PHI2
* Allow the uC to control the 65C02S using the /RESET line
* When the system starts up, the uC hold /RESET low and stop PHI2
* It then copies the 6502 firmware/BIOS into the upper part of RAM and set the Reset, NMI and IRQ vector addresses
* the 6502 /RESET is released and PHI2 is started

What do you think?

My main question: if the 65C02 /RESET is held low, is the address and data buses tri-stated by the 65C02?


Top
 Profile  
Reply with quote  
 Post subject: Re: ROM emulation/copier
PostPosted: Fri Aug 28, 2015 4:48 pm 
Offline
User avatar

Joined: Mon May 25, 2015 2:25 pm
Posts: 693
Location: Gillies, Ontario, Canada
I think that works perfectly up to 25MHz on a 65C02 with 10ns SRAM.
But that is only because I have it working that way right now!

Note: Using BE as per BDD's info below as well.

brad


Last edited by Oneironaut on Fri Aug 28, 2015 5:29 pm, edited 1 time in total.

Top
 Profile  
Reply with quote  
 Post subject: Re: ROM emulation/copier
PostPosted: Fri Aug 28, 2015 5:09 pm 
Offline
User avatar

Joined: Thu May 28, 2009 9:46 pm
Posts: 8514
Location: Midwestern USA
banedon wrote:
I'm thinking of creating my first ROM emulator/copier and just want to run my rough plan of action passed some folks who have done it previously.

This is what I was thinking of doing:

* The entire memory map uses 64KB RAM - no ROM. Some space is reserved for I/O
* Use an uC (Atmel 328P or 324P) to control the clock source for PHI2
* Allow the uC to control the 65C02S using the /RESET line
* When the system starts up, the uC hold /RESET low and stop PHI2
* It then copies the 6502 firmware/BIOS into the upper part of RAM and set the Reset, NMI and IRQ vector addresses
* the 6502 /RESET is released and PHI2 is started

What do you think?

My main question: if the 65C02 /RESET is held low, is the address and data buses tri-stated by the 65C02?

Asserting reset doesn't tri-state the 65C02. You'd have to assert (negate) BE (bus enable) to do that. When BE is asserted, A0-A15, D0-D7 and RWB go high-Z.

I'm not sure what the purpose would be of stopping Ø2 while loading your ROM image into RAM. Continuously holding reset down is sufficient halt the 65C02. Note that Ø2 must be running and stable before releasing reset.

_________________
x86?  We ain't got no x86.  We don't NEED no stinking x86!


Top
 Profile  
Reply with quote  
 Post subject: Re: ROM emulation/copier
PostPosted: Fri Aug 28, 2015 5:50 pm 
Offline
User avatar

Joined: Sun Sep 08, 2013 10:24 am
Posts: 740
Location: A missile silo somewhere under southern England
Thanks guys: That is very useful info. I'll let you know how it goes when I build it. In the mean time, if you have further thoughts please let me know. :)


Top
 Profile  
Reply with quote  
 Post subject: Re: ROM emulation/copier
PostPosted: Sat Aug 29, 2015 11:03 am 
Offline
User avatar

Joined: Sun Sep 08, 2013 10:24 am
Posts: 740
Location: A missile silo somewhere under southern England
OK. Doing some testing on my existing 65C02 system, when I send BE low the buses all go high-z as advertised by the datasheet. However, I cannot seem to get the CPU to resume unless I reset it.
Is this by design or does anyone know a way of getting the CPU to continue? I.e. can you use a arbitrator to pull BE low, thus pausing the 65C02 so that another uC/uP can drive the buses and then tell the 65C02 to resume. I thought driving BE high would do this, but it doesn't seem to.
[edit] I wonder if an NMI or IRQ would do it?


Top
 Profile  
Reply with quote  
 Post subject: Re: ROM emulation/copier
PostPosted: Sat Aug 29, 2015 12:55 pm 
Offline
User avatar

Joined: Fri Dec 11, 2009 3:50 pm
Posts: 3367
Location: Ontario, Canada
banedon wrote:
I.e. can you use a arbitrator to pull BE low, thus pausing the 65C02 [...]
Sounds as if you're overestimating BE. The effect of that input is a lot dumber than you might suppose or wish it to be. All it does is tristate the CPU bus lines (and R/W) just as some external '245 tristate buffers would do. IOW the pause is something you have to establish yourself, either by stopping the clock or by pulling RDY low.

Failing to pause the CPU when BE has gone low means any program presently running will crash (tristate buses mean no more instructions arriving from memory!). That's tolerable prior to initial reset, but otherwise might not agree with your plans.

_________________
In 1988 my 65C02 got six new registers and 44 new full-speed instructions!
https://laughtonelectronics.com/Arcana/ ... mmary.html


Top
 Profile  
Reply with quote  
 Post subject: Re: ROM emulation/copier
PostPosted: Sat Aug 29, 2015 4:48 pm 
Offline
User avatar

Joined: Sun Sep 08, 2013 10:24 am
Posts: 740
Location: A missile silo somewhere under southern England
So can you get away with asserting RDY followed by BE, do whatever, then send BE high and then RDY? However, I'm guessing this will still empty out what the 65C02 was doing so would still have the same issue?
So how on earth do you take control of the bus without getting possible contention and without having to reset? It must be do-able as I think this was done with the Commodore 128. Although that might have been with a modified 6510... not sure.
Or combine the above with detecting the next rising edge of PHI2 and then do it then?


Top
 Profile  
Reply with quote  
 Post subject: Re: ROM emulation/copier
PostPosted: Sat Aug 29, 2015 7:34 pm 
Offline
User avatar

Joined: Thu May 28, 2009 9:46 pm
Posts: 8514
Location: Midwestern USA
banedon wrote:
So can you get away with asserting RDY followed by BE, do whatever, then send BE high and then RDY? However, I'm guessing this will still empty out what the 65C02 was doing so would still have the same issue?

Asserting RDY will cause the MPU to halt on the next Ø2 high, holding all registers in whatever state they were in at the time. When RDY is released the MPU will restart on the next Ø2 high, no reset needed.

_________________
x86?  We ain't got no x86.  We don't NEED no stinking x86!


Last edited by BigDumbDinosaur on Sat Aug 29, 2015 7:37 pm, edited 1 time in total.

Top
 Profile  
Reply with quote  
 Post subject: Re: ROM emulation/copier
PostPosted: Sat Aug 29, 2015 7:36 pm 
Offline
User avatar

Joined: Thu May 28, 2009 9:46 pm
Posts: 8514
Location: Midwestern USA
Dr Jefyll wrote:
Sounds as if you're overestimating BE...Failing to pause the CPU when BE has gone low means any program presently running will crash (tristate buses mean no more instructions arriving from memory!).

Worse yet, if the MPU is still running after tri-stating the buses, it might load random garbage for instructions, depending on bus capacitance, noise from nearby circuits, etc. There's no telling what might happen.

_________________
x86?  We ain't got no x86.  We don't NEED no stinking x86!


Top
 Profile  
Reply with quote  
 Post subject: Re: ROM emulation/copier
PostPosted: Sat Aug 29, 2015 9:16 pm 
Offline
User avatar

Joined: Sun Sep 08, 2013 10:24 am
Posts: 740
Location: A missile silo somewhere under southern England
Oh well. At least I should be able to do the ROM simulator/copy.


Top
 Profile  
Reply with quote  
 Post subject: Re: ROM emulation/copier
PostPosted: Tue Sep 01, 2015 3:31 pm 
Offline
User avatar

Joined: Thu Dec 11, 2008 1:28 pm
Posts: 10986
Location: England
(To avoid confusion, it might be worth avoiding this "asserting" word- half the time it's used incorrectly. For an active-high signal like RDY, assert means take it high. But generally we're interested in using RDY to stall the machine, which means we need to take it low, which is de-asserting it. For an active-low signal like NMI, it's asserted when it's brought low. As noted before, it would be more consistent and less surprising if RDY were called STALL and were an active low input. That would be exactly the same as it is now, with respect to logic levels, but would have us correctly saying that we assert STALL by bringing it low. More precisely, we'd call it \STALL or STALL* or STALLB.)


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 11 posts ] 

All times are UTC


Who is online

Users browsing this forum: Google [Bot] and 67 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to: