Thanks for the review and comments. I still have a lot to consider. In answer to your questions:
BigDumbDinosaur wrote:
What is the purpose of the CLKB output?
It provides the inverted clock signal needed by the bank address latch and data bus buffer. Using the PLD for this saves a chip in my build. I've attached an image of the breadboard version (btw - I got the 64k, 12 ns RAM version of this up to 10 MHz before I started seeing stability issues). Ultimately I plan on a small handheld unit.
BigDumbDinosaur wrote:
- Implementing Adrien's optimizations should help reduce your logic’s “footprint,” making it easier to fit the design to the 22V10. WinCUPL tries to “de Morganize” logic as much as possible. However, more succinct logic statements are preferable to relying on an internal optimization.
I've tried a number of ways to express the logic but the second method was the only one I got to work for a single page of ROM at the end of bank 0. I could get the wider ROM range of $F000-$FFFF to work with RAM of $0000-$EFFF, but I don't need that much ROM in bank 0. I'll see if some of Adrien's other suggestions work though. I'm definitely a novice on WINCUPL.
BigDumbDinosaur wrote:
- If possible, negative logic should not be used to drive outputs. If an output is considered true when low, declare the pin as inverted, e.g.:
Code:
Pin 20 = !OE;
...and:
Code:
OE = CLK & RW;
In other words, let the PLD's hardware do the output negation and write your logic as positive. This form will use fewer product terms than the way you’ve got it.
Looks like I picked up some bad coding practices on the web. I guess it's easy to do. There are so few examples of concise coding for address decoders. Lots of bad stuff though, like where they do all of WINCUPL work on a spreadsheet and then import it.
BigDumbDinosaur wrote:
Quote:
Some of my I/O is interrupt driven.
Some? Why not all of it? The 816, like the 8-bit 6502 family, has excellent interrupt performance. Why not take advantage of that?
I'm using the 65C51 and the transmitter can't be interrupt driven.
BigDumbDinosaur wrote:
Quote:
My ISR is in ROM located in the page $FF00.
That only gives you 256 bytes in which to stuff the ISR, along with the hardware vectors, and the reset front end. I think you will regret that choice once you get serious about writing reasonably-comprehensive firmware.
My reset front end is in bank 1. I long jump to it from page $FF00. As I've seen you advise, my ISR is short.
BigDumbDinosaur wrote:
Something else to consider is this: if an application is running in any bank other than the one in which the firmware is visible and if the firmware API is accessed as a set of subroutines, the application will be using JSL — RTL to call APIs. Those two are some of the slowest instructions in the 816's ISA. The alternative method for calling APIs, and the one I am using, is to use COP and an API index as COP’s signature, a method that is bank-agnostic and as fast as JSL — RTL.
Thanks. I'll keep this in mind. Right now I'm very far from fully using much of either bank 1 or 2. My 6502 hardware and Forth primitives use less than 9k of ROM and my Forth code and dictionary probably use an equal amount of RAM. I expect that to go down with the 65816.
BigDumbDinosaur wrote:
Quote:
I placed I/O in bank 2 because that's where I'm currently placing RW data. Thus, by setting the data bank register to 2 I can address both my data and I/O with 16-bit absolute address.
Yes, that will work. However, if you decided to use the 816’s stack relative addressing mode, it will be accessing bank
$00—the data bank register (
DB) will not be a factor in generating the effective address.
Yes, I still have a lot to think about along those lines.
BigDumbDinosaur wrote:
Quote:
I figured I'd use another address mode for banks above that, but I'll admit I haven't given it much thought. At this point even three banks of memory seems like a luxury. Honestly, I have on my to do list some of your posts on the subject, so I have a lot more learning to do.
While use of a PLD in place of discrete logic does confer flexibility, as well as greatly reduce chip count, the 816 itself knows nothing about all that. You should arrange the memory map to minimize cross-bank accesses as much as possible. When cross-bank accesses become necessary, the
[<dp>] and
[<dp>],Y addressing modes are your friend.
I think I was hoping to rely on one of the busted myths form your
65816 Facts and Myths post, that the 65816 banks could be addressed as a whole. I haven't considered it much beyond that, so it's currently just an idea (hope?) that I'm hanging onto right now.