Joined: Fri Aug 30, 2002 1:09 am Posts: 8433 Location: Southern California
|
There's kind of a lot here, so you might need to digest it a little bit at a time. What you're envisioning is more complex than you apparently anticipated; but none of it is insurmountable. You'll undoubtedly come up with more questions, and then we can help you sort it out and get going.Quote: - how I can connect the 9 Pins of a Serial Port to a 6522 Via's 8-Bit I/O pins?
First, this is definitely not ideal; but I'll get to that in a minute.
If you were to connect it to a VIA, you could connect the various signals to port I/O pins. Most of the pin choice will not be critical; but I would recommend connecting the RxD (receive data) to one of the CA or CB lines as well as a PA or PB pin, so that besides being able to read the pin, you can also get an interrupt if data starts coming in when you're not watching for it in a loop. Next, I would recommend that the PA or PB pin to which you connect the RxD be bit 6, since reading the port with the BIT instruction automatically puts bit 6 in the V flag which you then transfer to the C flag to shift into the byte you're building, or you can do a conditional branch on it.
If you're using the higher voltages of RS-232 (that's the common traditional name; the up-to-date language is "TIA-232") rather than TTL-level serial, you'll be going through line drivers and receivers to get from those higher voltages to TTL levels and vice-versa. Probably the most popular line driver and receiver IC is the MAX232; but there are many others. I've usually used the MC145406 (same thing as the SN75C1406), because I've always had the ±10V (actual voltage is very non-critical) power-supply voltages available on the board, and this IC takes less board space because it doesn't need external capacitors and the extra pins to connect to them for the charge pumps. The 16-pin DIP has three line drivers and three line receivers.
However:Quote: - Are there any Serial Interface ICs that's compatible with the 6502 CPU I should use instead of the 6522?
The 6522 and 65c22 have indeed been used to bit-bang asynchronous serial even at 57,600 bps; but it's definitely not ideal. Since timing is stringent, instruction cycle counts have to be exact, and nothing else can be allowed to interrupt during the process, and the processor can't be doing anything else during transmission or reception.
Traditionally, it has been the 6551 or 65c51 (ie, CMOS version) that have been put on the 6502's bus to get asynchronous serial communication. I've used the 65c51 for decades and never had any trouble with it. I could wish that a couple of the functions had been separated rather than being controlled by the same bit in the command register; but it hasn't been any real problem in my applications, and separating them would have required adding another register-select pin. The WDC W65C51 (which I have not used, but it's the only one still in production) has a serious bug in that the transmit-register-empty flag in the status register makes it look like it's always ready to accept another byte when you're transmitting. There are ways around it, including ways that are better than just doing a software delay loop. However, these, and possibly the absence of FIFOs (First-In, First-Out, multi-byte buffers) for transmit and receive [1], have caused it to fall out of favor, and other UARTs to become more popular. One of those has been the 28L92, which unfortunately has recently been discontinued—see viewtopic.php?f=4&t=7289 —but the topic gives alternatives that are partially compatible.
One UART I've exercised but not put to serious use yet is the 16-pin MAX3100 SPI-interfaced one that's available in a 14-pin DIP. So instead of
6502 --> 6551 ACIA --> line drivers & receivers --> RS-232 (TIA-232) you'd have (assuming you big-bang the SPI with a 6522):
6502 --> 6522 VIA --> (via SPI) --> MAX3100 UART --> line drivers & receivers --> RS-232 (TIA-232) (or different line drivers and receivers can get you to RS-422 or -485; or you can forgo the line drivers and receivers altogether if you just want TTL-level serial).
It may initially look pointless to go through a serial interface to get to an IC that gives you another serial interface. SPI however is synchronous serial, not asynchronous serial, so it is much, much easier to bit-bang, not having any timing requirements, let alone stringent ones like RS-232 has. Further, if you have SPI, you can simultaneously connect many other things to it as well, and there are hundreds, if not thousands, of ICs on the market that interface through SPI, for example A/D and D/A converters, flash memories, USB interfaces, programmable-gain amplifiers, signal generators, GPIO, etc.. There's sample working code to bit-bang SPI with a VIA, on my site.
It's not clear, Yoshi, in your head post (welcome, BTW), if you are familiar with the differences between synchronous and asynchronous serial. I try to give a concise description and comparison of the various popular serial interfaces at viewtopic.php?p=7606#p7606, and a more in-depth article, somewhat 6502/6551-oriented, on RS-232 (which is asynchronous serial), at http://wilsonminesco.com/RS-232/RS-232primer.html . My apologies—it's one of the very first articles I ever wrote, and is all text for the first half of it. Hopefully my writing has improved considerably since then, but hopefully also it will be plenty understandable.Quote: - The feature I want where I can directly send 6502 Assembly code into the CPU's ROM chip, Is that even Possible?
If you send it assembly language, your 6502 computer will need an assembler to translate that into machine language. There's basically a 1:1 relationship; but the assembly language is the human-readable source code (although much of what we see posted can hardly be called "readable," ), whereas the machine language is just a string of hexadecimal numbers which is ultimately the only thing the processor can use.
OTOH, if you have it already assembled on the PC and just want to put the hex numbers in memory, you'll need some overhead bytes to tell your 6502 computer what addresses to put these in. That, along with error-detection, is the purpose of Intel Hex, Motorola S-Record, and other such file types. Decoding that will take some software on your 6502 computer as well.
Next, you mention putting it in ROM. ROM is "Read-Only Memory," meaning the computer generally cannot write to it. There is however EEPROM (electrically erasable programmable read-only memory) which the computer can indeed write to in-circuit; but the writing is much much slower than writing to RAM, and you'll need software to control that process, too. You might do better starting with a separate, dedicated PROM / EPROM / EEPROM / flash programmer. You'll kind of need that anyway to get some sort of boot code onto the computer, as Ed and Alarm Siren said.
[1] I don't particularly think of the lack of a FIFO in the '51 to be a problem, because the 6502 has such good interrupt performance, and the interrupt overhead you have to go through for each byte received or transmitted is minimal, unlike the situation with many other processors that truly need the UART to have FIFOs.
_________________ 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?
|
|