Attempt at '816
Attempt at '816
I went through some resources, including Garth's "65816 myths", an SBC by mike42, and some threads on this forum, and I think I have a general understanding of how to do the address decoding with '816.
Still, I'd like to get some inputs in case I'm doing something wrong, plus some questions.
My address demux looks like this:
'573 looks clear to me.
However:
- I saw somewhere on the forums (update: found the link - viewtopic.php?f=4&t=2438) that main purpose of '245 is to make sure there's no data bus contention if the slave is too slow to release the data lines once Ф2 goes low - is it correct? Or are there any additional reasons for '245?
- VPA/VDA: Mike (https://mike42.me/blog/2022-02-65c816-c ... -prototype) seems to ignore them in his address decoder, but from the previous thread I learned that they can be OR'ed to ensure that A16..A23 doesn't accidentally latch onto a wrong address during "dummy" cycles. Does that mean I can leave VPA/VDA out of my chip selection logic if I'm not worried about accidental reads from my I/O chips? Or is it possible that R/W will be low during dummy cycles and accidental writes may happen?
Another issue I have is with the datasheet (I heard WDC messes up their datasheets from time to time): Seems like the highlighted timing is tBH (BA0-BA7 hold time) - is my assumption correct?
Still, I'd like to get some inputs in case I'm doing something wrong, plus some questions.
My address demux looks like this:
'573 looks clear to me.
However:
- I saw somewhere on the forums (update: found the link - viewtopic.php?f=4&t=2438) that main purpose of '245 is to make sure there's no data bus contention if the slave is too slow to release the data lines once Ф2 goes low - is it correct? Or are there any additional reasons for '245?
- VPA/VDA: Mike (https://mike42.me/blog/2022-02-65c816-c ... -prototype) seems to ignore them in his address decoder, but from the previous thread I learned that they can be OR'ed to ensure that A16..A23 doesn't accidentally latch onto a wrong address during "dummy" cycles. Does that mean I can leave VPA/VDA out of my chip selection logic if I'm not worried about accidental reads from my I/O chips? Or is it possible that R/W will be low during dummy cycles and accidental writes may happen?
Another issue I have is with the datasheet (I heard WDC messes up their datasheets from time to time): Seems like the highlighted timing is tBH (BA0-BA7 hold time) - is my assumption correct?
/Andrew
deck65 - 6502 slab with screen and keyboard | ПК-88 - SBC based on KM1810VM88 (Ukrainian i8088 clone) | leo80 - simple Z80 SBC
nice65 - 6502 assembly linter | My parts, footprints & 3D models for KiCad/FreeCAD
deck65 - 6502 slab with screen and keyboard | ПК-88 - SBC based on KM1810VM88 (Ukrainian i8088 clone) | leo80 - simple Z80 SBC
nice65 - 6502 assembly linter | My parts, footprints & 3D models for KiCad/FreeCAD
Re: Attempt at '816
Yes, I think that's tBH.
- akohlbecker
- Posts: 282
- Joined: 24 Jul 2021
- Contact:
Re: Attempt at '816
You can look at what the CPU does for all cycles of every instruction in the datasheet starting at page 36 (Instruction Operation). I haven't tested it in hardware, but based on that table I don't believe a case where RWB, VDA and VPA are all low simultaneously exists.
There is no need to insert VDA||VPA in the bank address latching logic, it does not matter there.
You could insert VDA||VPA either into address decoding (I/O chip select) or into bus control (read / write pulses going into chip enable / write enable, and for WDC devices, feed it directly to the active high chip select). I chose to do the latter in my system, so an external device that takes the CPU off the bus does not have to worry about this signal. Some folks also only use VDA, because you're probably never going to intentionally execute code from an I/O register, and it saves the propagation delay of the OR gate.
EDIT: Forgot to answer the main question, yes if you're not worried about spurious reads, feel free to ignore this signal. Though I think you probably should worry about reads, at least for future-proofing. In most I/O devices (the VIA, most(all?) UARTs, etc) reads have side effects.
There is no need to insert VDA||VPA in the bank address latching logic, it does not matter there.
You could insert VDA||VPA either into address decoding (I/O chip select) or into bus control (read / write pulses going into chip enable / write enable, and for WDC devices, feed it directly to the active high chip select). I chose to do the latter in my system, so an external device that takes the CPU off the bus does not have to worry about this signal. Some folks also only use VDA, because you're probably never going to intentionally execute code from an I/O register, and it saves the propagation delay of the OR gate.
EDIT: Forgot to answer the main question, yes if you're not worried about spurious reads, feel free to ignore this signal. Though I think you probably should worry about reads, at least for future-proofing. In most I/O devices (the VIA, most(all?) UARTs, etc) reads have side effects.
Re: Attempt at '816
akohlbecker wrote:
Some folks also only use VDA, because you're probably never going to intentionally execute code from an I/O register, and it saves the propagation delay of the OR gate.
In my case I'll probably need to route it to '22, '51, and my LCD (I'm using a 240x64 LCD powered by T6963C controller that's sitting directly on the bus, so accidental reads might mess up LCD RAM pointers.)
Conveniently, both '22 & '51 have CS1 as active-high, so VDA can go there directly.
akohlbecker wrote:
EDIT: Forgot to answer the main question, yes if you're not worried about spurious reads, feel free to ignore this signal. Though I think you probably should worry about reads, at least for future-proofing. In most I/O devices (the VIA, most(all?) UARTs, etc) reads have side effects.
/Andrew
deck65 - 6502 slab with screen and keyboard | ПК-88 - SBC based on KM1810VM88 (Ukrainian i8088 clone) | leo80 - simple Z80 SBC
nice65 - 6502 assembly linter | My parts, footprints & 3D models for KiCad/FreeCAD
deck65 - 6502 slab with screen and keyboard | ПК-88 - SBC based on KM1810VM88 (Ukrainian i8088 clone) | leo80 - simple Z80 SBC
nice65 - 6502 assembly linter | My parts, footprints & 3D models for KiCad/FreeCAD
- akohlbecker
- Posts: 282
- Joined: 24 Jul 2021
- Contact:
Re: Attempt at '816
Sounds like a reasonable plan! Good luck with your project 
Re: Attempt at '816
Isn't the '573 OE input negative active?
If so, connecting /RES to it only enables it during reset, and disables it afterwards, the opposite of what should be.
For such a design I tend to use a '273 that actually has a /RES input, and always outputs the value to A16-A23
I don't think tri-stating A16-A23 is necessary. It may even produce strange selects during reset because of floating A16-A23
André
If so, connecting /RES to it only enables it during reset, and disables it afterwards, the opposite of what should be.
For such a design I tend to use a '273 that actually has a /RES input, and always outputs the value to A16-A23
I don't think tri-stating A16-A23 is necessary. It may even produce strange selects during reset because of floating A16-A23
André
Author of the GeckOS multitasking operating system, the usb65 stack, designer of the Micro-PET and many more 6502 content: http://6502.org/users/andre/
- GARTHWILSON
- Forum Moderator
- Posts: 8773
- Joined: 30 Aug 2002
- Location: Southern California
- Contact:
Re: Attempt at '816
akohlbecker wrote:
EDIT: Forgot to answer the main question, yes if you're not worried about spurious reads, feel free to ignore this signal. Though I think you probably should worry about reads, at least for future-proofing. In most I/O devices (the VIA, most(all?) UARTs, etc) reads have side effects.
http://WilsonMinesCo.com/ lots of 6502 resources
The "second front page" is http://wilsonminesco.com/links.html .
What's an additional VIA among friends, anyhow?
The "second front page" is http://wilsonminesco.com/links.html .
What's an additional VIA among friends, anyhow?
Re: Attempt at '816
fachat wrote:
Isn't the '573 OE input negative active?
If so, connecting /RES to it only enables it during reset, and disables it afterwards, the opposite of what should be.
For such a design I tend to use a '273 that actually has a /RES input, and always outputs the value to A16-A23
I don't think tri-stating A16-A23 is necessary. It may even produce strange selects during reset because of floating A16-A23
André
If so, connecting /RES to it only enables it during reset, and disables it afterwards, the opposite of what should be.
For such a design I tend to use a '273 that actually has a /RES input, and always outputs the value to A16-A23
I don't think tri-stating A16-A23 is necessary. It may even produce strange selects during reset because of floating A16-A23
André
/Andrew
deck65 - 6502 slab with screen and keyboard | ПК-88 - SBC based on KM1810VM88 (Ukrainian i8088 clone) | leo80 - simple Z80 SBC
nice65 - 6502 assembly linter | My parts, footprints & 3D models for KiCad/FreeCAD
deck65 - 6502 slab with screen and keyboard | ПК-88 - SBC based on KM1810VM88 (Ukrainian i8088 clone) | leo80 - simple Z80 SBC
nice65 - 6502 assembly linter | My parts, footprints & 3D models for KiCad/FreeCAD
- akohlbecker
- Posts: 282
- Joined: 24 Jul 2021
- Contact:
Re: Attempt at '816
You don't need to reset the latch, as the cpu goes through a few internal cycles before accessing the reset vector and starting the program execution. Even though the latch powers up in an undefined state, its value will become known during the first internal clock cycle.
Re: Attempt at '816
akohlbecker wrote:
You don't need to reset the latch, as the cpu goes through a few internal cycles before accessing the reset vector and starting the program execution. Even though the latch powers up in an undefined state, its value will become known during the first internal clock cycle.
RAM may be already there for example. I'd rather be on the safe side.
Author of the GeckOS multitasking operating system, the usb65 stack, designer of the Micro-PET and many more 6502 content: http://6502.org/users/andre/
- akohlbecker
- Posts: 282
- Joined: 24 Jul 2021
- Contact:
Re: Attempt at '816
Why would a bank address of 0 be safer than any other value during power up?
Also, a 273 is not recommended because it is a D flip flop, meaning the bank address only appears after the clock rising edge. You want a transparent latch so the bank address is already present, and the select logic has already propagated, before the clock rises! That's important for WDC I/O chips for example.
Also, a 273 is not recommended because it is a D flip flop, meaning the bank address only appears after the clock rising edge. You want a transparent latch so the bank address is already present, and the select logic has already propagated, before the clock rises! That's important for WDC I/O chips for example.
- akohlbecker
- Posts: 282
- Joined: 24 Jul 2021
- Contact:
Re: Attempt at '816
Really the circuit shown in the datasheet for demultiplexing the bank address is all you need, unless you want to use BE or RDY. For the latter I go into it in more detail in episodes 3, 5 and 6 of my YouTube series.
Re: Attempt at '816
A right the '273 is a d flipflop not a latch. Sorry my fault. You should use a transparent latch here.
Author of the GeckOS multitasking operating system, the usb65 stack, designer of the Micro-PET and many more 6502 content: http://6502.org/users/andre/
Re: Attempt at '816
Just to add another data-point:
In my ruby 816 system, I use a GAL to latch the upper N address bits and no separate data bus buffer. Works for me, but I only have one peripheral - a 65C22 and simple address decoding done in another GAL to allow for 512KB of RAM and the VIA.
-Gordon
In my ruby 816 system, I use a GAL to latch the upper N address bits and no separate data bus buffer. Works for me, but I only have one peripheral - a 65C22 and simple address decoding done in another GAL to allow for 512KB of RAM and the VIA.
-Gordon
--
Gordon Henderson.
See my Ruby 6502 and 65816 SBC projects here: https://projects.drogon.net/ruby/
Gordon Henderson.
See my Ruby 6502 and 65816 SBC projects here: https://projects.drogon.net/ruby/
Re: Attempt at '816
akohlbecker wrote:
Why would a bank address of 0 be safer than any other value during power up?
Also, a 273 is not recommended because it is a D flip flop, meaning the bank address only appears after the clock rising edge. You want a transparent latch so the bank address is already present, and the select logic has already propagated, before the clock rises! That's important for WDC I/O chips for example.
Also, a 273 is not recommended because it is a D flip flop, meaning the bank address only appears after the clock rising edge. You want a transparent latch so the bank address is already present, and the select logic has already propagated, before the clock rises! That's important for WDC I/O chips for example.
akohlbecker wrote:
Really the circuit shown in the datasheet for demultiplexing the bank address is all you need, unless you want to use BE or RDY. For the latter I go into it in more detail in episodes 3, 5 and 6 of my YouTube series.
EDIT: In the datasheet, on the page with address demux curcuit, what does the square rotated by 45° mean? Is it some sort of buffer?
drogon wrote:
Just to add another data-point:
In my ruby 816 system, I use a GAL to latch the upper N address bits and no separate data bus buffer. Works for me, but I only have one peripheral - a 65C22 and simple address decoding done in another GAL to allow for 512KB of RAM and the VIA.
-Gordon
In my ruby 816 system, I use a GAL to latch the upper N address bits and no separate data bus buffer. Works for me, but I only have one peripheral - a 65C22 and simple address decoding done in another GAL to allow for 512KB of RAM and the VIA.
-Gordon
/Andrew
deck65 - 6502 slab with screen and keyboard | ПК-88 - SBC based on KM1810VM88 (Ukrainian i8088 clone) | leo80 - simple Z80 SBC
nice65 - 6502 assembly linter | My parts, footprints & 3D models for KiCad/FreeCAD
deck65 - 6502 slab with screen and keyboard | ПК-88 - SBC based on KM1810VM88 (Ukrainian i8088 clone) | leo80 - simple Z80 SBC
nice65 - 6502 assembly linter | My parts, footprints & 3D models for KiCad/FreeCAD