Rick
New Member
Posts: 2
|
Post by Rick on Dec 16, 2004 9:20:30 GMT -5
Hi anybody knows if it's possible to add a user-port? I happened to need one for a project of mine.
Don't know if anybody realised this, but this tiny but o so familiar machine seems to be an ideal candidate to serve as a brain for an autonomous robot to me! And: easy to program at a very low cost.
Would have great potential if possible.
I have some very nice idea's already..
Anybody??
Greetz, Rick
|
|
|
Post by NetSamurai on Dec 16, 2004 10:21:16 GMT -5
You could memory map one in using the information I provided in the reverse engineering thread. There is a portion of the user port on the CPU core, but they are not routed out to the board. I am also not sure if they are even functional, they are definitely not complete.
If you just want to control a robot with this, you have access to all address and data lines. You should be able map in whatever hardware you want. By mapping it into the upper 64K of RAM, you probably won't break any compatability. This has the added benefit of using A16-A20 of the address bus to map in whatever registers you need, thus reducing the complexity of an address decoder. You would just use one of the top address lines for CS, RS, etc... look for information on PIAs and how they are mapped into memory. I might type up a tutorial on this at a later time.
I said probably above, because we really need a full memory map to be sure. As MagerValp has said, color RAM is at $D800. But, we need to look for any mirroring as well.
Scott McDonnell
|
|
Rick
New Member
Posts: 2
|
Post by Rick on Dec 16, 2004 11:20:19 GMT -5
(Thnx for the quick reply) Well, that all is sounding fine and promissing, but also slightly complex at first site. Building a robot from a standard c64 isn't that difficult when you know a little bit about electronics, (already build one battery drivin), but diving inside a machine is quite a different mater. I mean I have just enough skill to attach and control basic I/O stuff to the user-port and joystick-ports like motors, sensors etc. but what you are suggesting requires a bit more in dept knowledge I guess. Just a little bit out of my reach for now probably.. (Or maybe I'm just a few steps away from a breakthru, who knows. ) Rick Nash
|
|
|
Post by alipapa on Dec 16, 2004 22:36:26 GMT -5
Hello, A long time ago I have seen an userport extension, somewhere I must have one but cannot find it at the moment. It had two or three extra connections,is that where you are looking for?
|
|
|
Post by NetSamurai on Dec 18, 2004 3:20:44 GMT -5
Alipapa, I probably shouldn't speak for Rick, but I am sure he is asking if it was possible to 'hack' in a userport on the DTV. It does not already have one built in, so an extension be of no use. That was what my answer was based on. Rick, Hang in there, because I do plan at some point in the near future to put up a simple tutorial for memory mapping hardware. It really isn't THAT difficult. It just requires a few prerequisites of understanding how the address bus works, and the steps a microprocessor takes to access the address and data buses. To give you an idea, this is a brief description: An I/O device like a PIA does not have an address bus like memory does. What it does have are a set of control lines. These would include things like Chip Selects (CS), Register Selects(RS), and R/W. These control lines are the equivalent of an address bus. By taking the address bus lines and mapping them to the control bus, you are able to select and control the device by just sending or reading data at the address you mapped in, just like you would with memory. Usually, you map in the CS at the high-bit of memory you wish to place the device at. Then, the bits beneath that would be used to access the separate registers. So, you control the device by addressing, and read and write to the registers on the data bus. If working properly, it would appear no different than just doing memory reads and writes. Of course, unless you connect up the IRQ, you would need to poll the device (meaning you need to select the device, see if there is any data ready, or any errors, at certain intervals.) With an IRQ, the device will tell the processor that an event has taken place (like new data is present) and then the processor would jump to the device and handle it. If no events have taken place, the processor is completely free to do other things, until the device asks for attention. Kinda like the difference between a baby and a grown kid. You have more free time for other tasks when the kid is older....so you get more done. Probably sounds confusing, but once it clicks, you will be surprised at how simple it really is. Scott McDonnell
|
|
|
Post by 87C751 on Dec 26, 2004 19:42:04 GMT -5
I'm also hoping for some general-purpose I/O access. Mapping into the address space requires glue logic. If I could have 4 lines (3 outs and an in), I could do a SPI interface (CS, CLK, DIN and DOUT) with no glue beyond a couple of resistors.
|
|
|
Post by NetSamurai on Dec 27, 2004 2:54:45 GMT -5
If you need only 4 general purpose control lines, why not use the joystick lines? If I recall correctly, these were capable of being outputs as well as inputs on the original C64 hardware (seems I remember building an LED interface once.) I have not checked if this is possible on the DTV, though. A logic probe (or LED) and a simple basic program should answer that question though. Other than that, you will need to grind down the cob material to expose the USR port pins if you want some general I/O. I have done this partially to mine (I have been lazy the last few days and haven't finished that project, yet.) Grinding it down won't be the hardest part, just time consuming. Reliably soldering on tiny wires to the contacts will be the hard part. Here is a picture of the contacts on the CPU core: home.comcast.net/~netsamurai/CPU.jpgHere is a list of the relevant pins you would want: 27 USR_0 28 USR_1 29 USR_2 30 USR_3 31 USR_4 32 VDD 33 VSS 34 USR_5 35 USR_6 36 NC 37 NC 38 USR_7 By grinding down just the one corner of the the CPU cob, you will get access to USR0-6, just a little more on the next corner and you will get USR7. Use the picture and C14 and C6 to get the orientation of the board in my photo. I used a dremel with #971 Alum. Ox. Grinding Stone to grind most of the material away. Work from the edge inward. Resist the tempation to grind down all the way. It takes less than a second to tear through the traces. Then use a #537 Brass Brush to finish grinding down to the contacts. Do this also from the edge-inward. As soon as you see the copper contacts stop! The contacts are not very big and the bonding wires from the core are attached there. They will rip up very easily. You only need a tiny bit to solder onto. Use 34AWG magnet wire or individual strands of 22AWG stranded wire to connect to the contacts. Route them on top of the cob and hot glue them in place. Then figure out how to connect some thicker, insulated wire to them that will be easier to work with. I have a bunch of female 20 pin LPC connectors, that I will probably just solder the magnet wire to directly. Then I can just push wire into them and work with them this way. Keep in mind, the simplest of mess ups, the slightest jerk of your hand, and you end up with a borken DTV. I am not to be held responsible for that All I can say is that what little I have done so far has worked out perfectly for me. I have pins 37 to 72 completely exposed. This gives me acccess to all joystick, paddles, and lightpen contacts. Other than exposing them, I have done nothing to them, yet. Scott McDonnell
|
|
|
Post by NetSamurai on Dec 27, 2004 2:57:33 GMT -5
BTW, if you do accomplish a SPI interface, please share your code with the rest of us! This could be very helpful.
Scott
|
|
|
Post by 87C751 on Dec 27, 2004 8:00:32 GMT -5
BTW, if you do accomplish a SPI interface, please share your code with the rest of us! This could be very helpful. I definitely plan to share whatever I manage to accomplish. The joystick idea might work if the DTV is sufficiently close to a real 64. According to the schematic (yeah, still have my old programmer's reference book), the joystick comes off the $DC00 CIA. But that would probably involve glue logic to switch between the joystick and the SPI bus. Otherwise, using the joystick in a game might confuse the SPI device.
|
|
|
Post by NetSamurai on Dec 27, 2004 14:04:23 GMT -5
Yep. And using the SPI interface would make the keyboard unusable as well, since it shares somes lines. If you absolutely abhor using any glue logic (which wouldn't have to be that difficult) then your only option would seem to be chipping away the cob and implementing the USR port.
First of all, if no CLK is present on the SPI, and the CS line isn't activated then SPI would probably just ignore things. If you are actually using the SPI interface, I doubt you would be able to run anything else at the same time anyway. The real problem would be if someone touched the keyboard or joystick while doing an SPI transaction. I would experiment if I were you. I don't think the glue logic would be much more than a single chip and one extra I/O line. If you need help figuring it out, let me know. Maybe you could use the function keys, somehow?
Scott
|
|
|
Post by 87C751 on Dec 27, 2004 14:40:57 GMT -5
Yep. And using the SPI interface would make the keyboard unusable as well, since it shares somes lines. If you absolutely abhor using any glue logic (which wouldn't have to be that difficult) then your only option would seem to be chipping away the cob and implementing the USR port. Abohr might be overstating it. But I want to minimize the glue and make the concept available to people without Dremel tooling. Good point about the keyboard. First of all, if no CLK is present on the SPI, and the CS line isn't activated then SPI would probably just ignore things. If you are actually using the SPI interface, I doubt you would be able to run anything else at the same time anyway. The real problem would be if someone touched the keyboard or joystick while doing an SPI transaction. I would experiment if I were you. I don't think the glue logic would be much more than a single chip and one extra I/O line. If you need help figuring it out, let me know. Maybe you could use the function keys, somehow? I'm not going to dive in very far until my other units arrive (later this week, I expect), but the function keys sound promising. As long as I can keep the CS line inactive, that should protect the SPI device. Hmmm... I do have one 64 mobo left around. Maybe the time for experimentation is closer than I thought. ;D
|
|
|
Post by NetSamurai on Dec 28, 2004 1:37:46 GMT -5
Here's some thoughts: If you end up using the joystick, try this idea: put the CLK on one of the control ports, and the CS on the other. The CS you would want on a line that was not shared with the keyboard. This way, to activate the CS AND create an accidental clock (a high-pass filter would probably keep joystick movement from clocking the SPI) both joysticks would need to be used at once. This is fairly unlikely. You can find the DTV schematic @ www.jbrain.com/vicug/gallery/c64dtv/IMG_1206?full=1Scott
|
|