6502.org Forum  Projects  Code  Documents  Tools  Forum
It is currently Fri Nov 01, 2024 4:39 am

All times are UTC




Post new topic Reply to topic  [ 18 posts ]  Go to page 1, 2  Next
Author Message
PostPosted: Thu Sep 23, 2021 10:29 pm 
Offline

Joined: Sun Jul 11, 2021 9:12 am
Posts: 155
Hi Guys,

I received a couple of W65C816's a few days back. I can see that there are a couple of pins that are slightly different to the W65C02 (as expected).

I think I understand what is going on to some extent. Just wondering if this tying of lines that I have done here is correct.

Attachment:
Image2.png
Image2.png [ 8.9 KiB | Viewed 1383 times ]


I'm guessing that write qualifications would be the same as the W65C02, right?

I also understand that there is some latching involved on the low to high of Phi2 if I want to use more than 64K. But I'll start with baby steps and move up along the way.

I was quite excited to get these chips as the 816 looks like it has some awesome features.

As always, many thanks for the guidance. 8)


(Grayscale image too! Gotta look after BDD! 8) )


Top
 Profile  
Reply with quote  
PostPosted: Thu Sep 23, 2021 10:46 pm 
Offline
User avatar

Joined: Sun Jun 30, 2013 10:26 pm
Posts: 1948
Location: Sacramento, CA, USA
R/!W is an output, and needs to go to your memory and I/O, not to a pull-up.

And where did A16 disappear to?

_________________
Got a kilobyte lying fallow in your 65xx's memory map? Sprinkle some VTL02C on it and see how it grows on you!

Mike B. (about me) (learning how to github)


Last edited by barrym95838 on Thu Sep 23, 2021 10:51 pm, edited 1 time in total.

Top
 Profile  
Reply with quote  
PostPosted: Thu Sep 23, 2021 10:47 pm 
Offline

Joined: Sun Jul 11, 2021 9:12 am
Posts: 155
Just saw that I labeled the upper bank of address pins wrong. I'd better fix that.


Top
 Profile  
Reply with quote  
PostPosted: Thu Sep 23, 2021 10:53 pm 
Offline

Joined: Sun Jul 11, 2021 9:12 am
Posts: 155
barrym95838 wrote:
R/!W is an output, and needs to go to your memory and I/O, not to a pull-up.

And where did A16 disappear to?


You got in just before I posted. I made a boo boo on the layout. Fixed now.

And agreed with the R/!W line. That was force of habit. I normally design peripherals and have a pull up on the RAM side so it keeps it at the correct state when the bus is tri-stated.


Top
 Profile  
Reply with quote  
PostPosted: Thu Sep 23, 2021 10:59 pm 
Offline

Joined: Sun Jul 11, 2021 9:12 am
Posts: 155
Fixed a couple of things. Corrected the incorrect address line labels and dropped the R/!W resistor as Barry pointed out, not necessary at that point in the circuit.

Attachment:
image3.png
image3.png [ 9.36 KiB | Viewed 1374 times ]


So the rest of the signals ties seem ok to keep it happy? Obviously I need to handle the reset etc.


Top
 Profile  
Reply with quote  
PostPosted: Thu Sep 23, 2021 11:10 pm 
Offline
User avatar

Joined: Thu May 28, 2009 9:46 pm
Posts: 8468
Location: Midwestern USA
J64C wrote:
I received a couple of W65C816's a few days back. I can see that there are a couple of pins that are slightly different to the W65C02 (as expected)...

Note that qualifying read cycles with Ø2 is mandatory with the 816 unless you interpose a bus transceiver between the MPU and other devices. Qualifying write cycles is highly recommended, since the data bus will be indeterminate or contain the bank bits during Ø2 low—also, the bank bits persist for a short while after the rise of Ø2. Some I/O devices may malfunction if this is not correctly handled. Also, memory corruption could occur.

Attachment:
File comment: Read/Write Circuit
read_write_qualify_alt.gif
read_write_qualify_alt.gif [ 46.98 KiB | Viewed 1373 times ]

Lastly, ignore VDA and VPA at your own peril, especially VDA.

Quote:
(Grayscale image too! Gotta look after BDD! 8)

I appreciate it. Ironically, I got back earlier from an eye doctor appointment and am all bleary-eyed right now from various indignities having been inflicted on me. :D Never underestimate the power of the medical profession to make you feel like crap. :evil:

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


Top
 Profile  
Reply with quote  
PostPosted: Thu Sep 23, 2021 11:30 pm 
Offline

Joined: Sun Jul 11, 2021 9:12 am
Posts: 155
BigDumbDinosaur wrote:
I appreciate it. Ironically, I got back earlier from an eye doctor appointment and am all bleary-eyed right now from various indignities having been inflicted on me. :D Never underestimate the power of the medical profession to make you feel like crap. :evil:


Not wrong there! :lol:

I was trying to get my head around the significance VDA and VPA.

Quote:
7.5 VDA and VPA Valid Memory Address Output Signals

When VDA or VPA are high and during all write cycles, the Address Bus is always valid. VDA and VPA
should be used to qualify all memory cycles. Note that when VDA and VPA are both low, invalid addresses
may be generated. The Page and Bank addresses could also be invalid. This will be due to low byte
addition only. The cycle when only low byte addition occurs is an optional cycle for instructions which read
memory when the Index Register consists of 8 bits. This optional cycle becomes a standard cycle for the
Store instruction, all instructions using the 16-bit Index Register mode, and the Read-Modify-Write
instruction when using 8- or 16-bit Index Register modes.


I'm just not understanding what it is getting at. What's and example where you'd need to check the state of these pins?


Top
 Profile  
Reply with quote  
PostPosted: Fri Sep 24, 2021 12:01 am 
Offline

Joined: Wed Jun 23, 2021 8:02 am
Posts: 166
There are several uses for the VPA and VDA signals. They identify if a bus cycle is being requested by the processor and what type of access it is.
VPA:VDA=00 means the processor is not requesting a bus cycle
01 means the processor is requesting a bus cycle for data memory or I/O
1x means the processor is requesting a bus cycle for program memory (opcode fetch, inline instruction argument or PC-relative data read)
11 means the processor is performing an opcode fetch.

Uses of these signals are as follows:

  1. When VPA and VDA are both 0, the processor still generates an address and outputs it on the A0-A15 and D0-D7 pins. However the processor does not require this cycle to actually be performed. If the cycle is performed, the data returned (it is always a read cycle) is simply discarded. This is similar to what happens on the 6502 in some cases where a dummy access is performed - but the 6502 doesn't have VPA or VDA so there is no way to know that the access is not required. In most cases a spurious read cycle is harmless - it just causes an extra access to memory and uses a little bit of extra power, but doesn't affect the operation of anything. The exception is if the dummy read is to an I/O port. In some cases reading an I/O register can have side effects, such as clearing status flags. In this case incorrect operation can result. On the 6502 the only way to avoid this issue is to arrange your memory map and use of instructions such that absolute indexed addressing or post-indexed indirect addressing is never used to access an address 256 higher than any address which exhibits read side effects. On the 65C816 you can use VDA to qualify all I/O accesses - i.e. an I/O access only occurs if VDA=1 in addition to the address of the I/O port being present on A0-A23. You don't usually need to include VPA in this since you generally don't execute instructions from I/O space.
  2. When VPA and VDA are both 1 this indicates an opcode fetch (similar to the 6502 SYNC signal). This can be used for hardware single stepping, either by pulling RDY low or by stopping the clock.
  3. The VPA and VDA signals can be used to implement some types of hardware memory management strategies external to the processor.


Top
 Profile  
Reply with quote  
PostPosted: Fri Sep 24, 2021 6:50 am 
Offline
User avatar

Joined: Sun Jun 30, 2013 10:26 pm
Posts: 1948
Location: Sacramento, CA, USA
kernelthread wrote:
... since you generally don't execute instructions from I/O space ...

Hmmm ... what strange but useful invention can we create to rectify that situation?

_________________
Got a kilobyte lying fallow in your 65xx's memory map? Sprinkle some VTL02C on it and see how it grows on you!

Mike B. (about me) (learning how to github)


Top
 Profile  
Reply with quote  
PostPosted: Fri Sep 24, 2021 7:44 am 
Offline
User avatar

Joined: Wed Feb 14, 2018 2:33 pm
Posts: 1482
Location: Scotland
barrym95838 wrote:
kernelthread wrote:
... since you generally don't execute instructions from I/O space ...

Hmmm ... what strange but useful invention can we create to rectify that situation?


There is a demo for the BBC Micro which has a 16-byte IO area for the Tube interface - but in the demo, there is an FPGA connected to it to provide 16 bytes of dual-ported RAM - the other side is continually updated via an FPGA and clever code running on a PC to make the 6502 effectively run a 2MB (or was it 20MB?) unrolled loop of code to perform the "Bad Apple" Animation with 44Khz sound on a 640x512x1 display.

https://www.youtube.com/watch?v=D_ta5QxBSMk

Not bad for a 2Mhz system. The code is essentially a set of STA xxxx instructions ending with a JMP back to the start. It's beam racing the video output and uses the vertical sync signal.

So never underestimate what might be possible :-)

-Gordon

_________________
--
Gordon Henderson.
See my Ruby 6502 and 65816 SBC projects here: https://projects.drogon.net/ruby/


Top
 Profile  
Reply with quote  
PostPosted: Fri Sep 24, 2021 11:03 am 
Offline

Joined: Wed Jun 23, 2021 8:02 am
Posts: 166
barrym95838 wrote:
kernelthread wrote:
... since you generally don't execute instructions from I/O space ...

Hmmm ... what strange but useful invention can we create to rectify that situation?


An 8080 or Z80 processor?


Top
 Profile  
Reply with quote  
PostPosted: Fri Sep 24, 2021 5:41 pm 
Offline
User avatar

Joined: Thu May 28, 2009 9:46 pm
Posts: 8468
Location: Midwestern USA
Failing to account for both VDA and VPA can lead to some strange situations, depending on how the circuit has been designed. Also, I don't believe in closing the door to possibly-useful circuit conditions. I merely logically OR the VDA and VPA signals into a single signal called VADR.

In any design that wait-states ROM and I/O accesses but not RAM, VPA may become important. When VDA && VPA = 0 it is possible bogus ROM or I/O addresses might appear on A0-A23 and result in a wait-state during a time when the MPU is busy with internal stuff. Qualifying with both VDA and VPA instead of VDA alone prevents such a condition from occurring.

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


Top
 Profile  
Reply with quote  
PostPosted: Fri Sep 24, 2021 5:46 pm 
Offline
User avatar

Joined: Thu Dec 11, 2008 1:28 pm
Posts: 10971
Location: England
J64C wrote:
I was trying to get my head around the significance VDA and VPA.
What's and example where you'd need to check the state of these pins?


J64C, it's worth noting that BDD takes a particularly conservative line in his designs, and in his corresponding advice. Others do otherwise, and if their code and designs avoid certain rare circumstances, all is well. As BDD got burnt by one of these rare circumstances, he is very cautious.


Top
 Profile  
Reply with quote  
PostPosted: Fri Sep 24, 2021 6:22 pm 
Offline
User avatar

Joined: Thu May 28, 2009 9:46 pm
Posts: 8468
Location: Midwestern USA
BigEd wrote:
J64C wrote:
I was trying to get my head around the significance VDA and VPA.
What's and example where you'd need to check the state of these pins?

J64C, it's worth noting that BDD takes a particularly conservative line in his designs, and in his corresponding advice. Others do otherwise, and if their code and designs avoid certain rare circumstances, all is well. As BDD got burnt by one of these rare circumstances, he is very cautious.

Not so, Ed. Please re-read what I said about the possibility of inadvertent wait-states during so-called dead cycles.

During my timing analysis of POC V1.2, I foresaw that possibility, and when Jeff and I adapted his single-chip wait-stating clock generator to V1.2, that I had fully qualified chip selects with VDA and VPA was indeed fortunate. The MPU was able to run at full speed during the dead cycles, yet slow down during ROM accesses. The only way it was possible to achieve that was with full qualification. It was not a "rare circumstance" I was encountering. Any system that uses ROM and also wait-states on ROM access is a candidate for the same situation.

I think a common oversight is that VPA matters in subtle ways, since only it is asserted during opcode fetches. If your glue logic doesn't account for both VDA and VPA but generates wait-states during ROM accesses, how would the wait-state enable logic know when ROM is being read during the opcode fetch of the execution cycle? It wouldn't and since it would only know what VDA is doing, a fetch from ROM would not be wait-stated. This might not matter in a system running at 4-6 MHz, but will definitely matter at 16-20 MHz.

I don't understand why everyone is so resistant to using these signals to qualify chip selects. Use of VDA and VPA effaces the 816's NMOS-like bus characteristics and prevents dummy accesses that can cause varying trouble, up to and including corrupted RAM.

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


Top
 Profile  
Reply with quote  
PostPosted: Fri Sep 24, 2021 7:33 pm 
Offline
User avatar

Joined: Fri Dec 11, 2009 3:50 pm
Posts: 3367
Location: Ontario, Canada
BigDumbDinosaur wrote:
I don't understand why everyone is so resistant to using these signals to qualify chip selects.
I can't speak for "everyone" but it's my own conclusion that VPA is usually best ignored... depending on one's priorities, of course. Usually there's a degree of tradeoff involved. But most of us have priorities that favor logic that's simple and fast.

It's true that, in the case you mention, ORing VPA with VDA prevents the occurrence of an un-necessary wait state if a dead cycle occurs while the '816 is executing code from ROM. If you run a lot of code from wait-stated ROM then the advantage of bringing VPA into the picture begins to become significant. At a guess, I'd say it could reap a 10% speedup.

Unfortunately, the OR gate used to bring VPA into the picture not only adds complexity to the logic but its prop. delay of about 5 ns probably has a direct impact on the maximum achievable clock speed. If you're running at 20 MHz then a 5 ns slowdown is 10%.

I prefer to keep an open mind, myself. I can accept that ORing VPA with VDA will make sense in certain circumstances. Invariably there's a penalty, which may be large or small. But before accepting even a small penalty, my default attitude is, "First let's see if we can find a way to just avoid doing that."

    :arrow: And usually there is a way to avoid bringing VPA into the picture.

There's more I could say, but I'll cut it short by saying WDC's doc on the subject of VDA and VPA is irrelevant in some ways (caches?? really??) and woefully under-elaborated in others.

BTW: nice work on the summary in your post, kernelthread.

-- Jeff

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


Last edited by Dr Jefyll on Fri Sep 24, 2021 8:21 pm, edited 1 time in total.

Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 18 posts ]  Go to page 1, 2  Next

All times are UTC


Who is online

Users browsing this forum: No registered users and 27 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: