Rather strange first build
Posted: Fri Jan 03, 2020 7:56 am
Well my first 6502 build is rather strange. It's going to get put in a display case in my ECE Department for people to see. My plan is to have it just send the SL train animation to a terminal over UART. SL is actually written in C, so I'm not going to be running that, or porting it to 6502 assembly. What I have done is captured the output using putty session logging so that I have the series ascii commands that produce it. At full screen width on a monitor the size/resolution that I'll be running this on, and after cleaning up the couple of bash command lines from it, it is 53kB. This means I'm going to have a rather ROM heavy build. The plan is that I'll store that as an array in ROM, then just write the minimal code to set up the 6551, and loop through the array, sending it out the UART to a raspberry pi connected to a monitor. I could use the raspberry pi's build in UART, or use a FTDI USB cable on the pi. Then just let the old 6502 just loop that all day long.
The memory map I have planned out is:
ROM: 0x1000 to 0xffff
6551: 0x0800 to 0x08ff......really i think it ends up going to 0x09ff, but it doesn't matter
RAM: 0x0000 to 0x07ff
This is about 60kB of ROM, so that should fit the 53kB of data, and leave me 7kB of program space, and vectors, which should be way more than I need for such a simple application.
It's probably just going to run on a solderless breadboad from a 1mhz clock. The 6551 will have the 1.8... clock that the baud rate generator requests in the datasheet. I plan to run the baud rate at 19200. So the bug in the wdc 6551 has. Since I'm not going to have a 6522, that T2 work around isn't going to be practical for me. Should I rig up something with a decade counter? Or should I just put in some wait states in my loop, and try to tune it for as little waiting without losing bytes? Can I connect the baud rate oscillator to the RxC pin, and set the control register to 0000, and get 115,200 baud? I'm thinking the faster I can get the UART going, the better/smoother the animation will be.
For memory decoding, as you can see from the map, if any of pins a12-a15 are high, then the ROM need to be enabled. An the RAM and 6551 also have to be aware of that as well. A 4-input NOR gate is super convenient for this on a12-a15, then using its output to enable/disable the ROM, as well as a 3-8 decoder. The 74AC138 has 3 enables, one of which is active high, so I can use that. If I use a 2-4 74AC139 it has only 2 enables, and they are both active low, so I would need to add an inverter in between the NOR gate and the decoder. The 138 and 139 otherwise have the same propagation delays, so I figure why not just use the 138 so I can skip adding another layer of propagation in the form of an inverter. But the real time hog here is that you cannot buy fast 4 input NOR gates. The only one I can find is a CD4002B, and its propagation delay is 125-250ns. I'm going to run my clock slow (1MHz), and it will always be enabled, so I don't think it'll be a problem for this application. The problem is my weird memory map for this build. I have so many address pins that will indicate ROM. Do you think this will be a problem with this particular application? If I really have to, I can just do a CPLD to decode the whole thing. Part of what drew me into the build was that it was going to be so strange.
Just to be clear, the 6502 is not going to be reading anything from the UART. This is just going to be outputting the train animation with no user interaction. Later if this computer generates any excitement, and I come up with another idea for this, I may remap the memory, rebuild the machine a bit different, and do something else.
The memory map I have planned out is:
ROM: 0x1000 to 0xffff
6551: 0x0800 to 0x08ff......really i think it ends up going to 0x09ff, but it doesn't matter
RAM: 0x0000 to 0x07ff
This is about 60kB of ROM, so that should fit the 53kB of data, and leave me 7kB of program space, and vectors, which should be way more than I need for such a simple application.
It's probably just going to run on a solderless breadboad from a 1mhz clock. The 6551 will have the 1.8... clock that the baud rate generator requests in the datasheet. I plan to run the baud rate at 19200. So the bug in the wdc 6551 has. Since I'm not going to have a 6522, that T2 work around isn't going to be practical for me. Should I rig up something with a decade counter? Or should I just put in some wait states in my loop, and try to tune it for as little waiting without losing bytes? Can I connect the baud rate oscillator to the RxC pin, and set the control register to 0000, and get 115,200 baud? I'm thinking the faster I can get the UART going, the better/smoother the animation will be.
For memory decoding, as you can see from the map, if any of pins a12-a15 are high, then the ROM need to be enabled. An the RAM and 6551 also have to be aware of that as well. A 4-input NOR gate is super convenient for this on a12-a15, then using its output to enable/disable the ROM, as well as a 3-8 decoder. The 74AC138 has 3 enables, one of which is active high, so I can use that. If I use a 2-4 74AC139 it has only 2 enables, and they are both active low, so I would need to add an inverter in between the NOR gate and the decoder. The 138 and 139 otherwise have the same propagation delays, so I figure why not just use the 138 so I can skip adding another layer of propagation in the form of an inverter. But the real time hog here is that you cannot buy fast 4 input NOR gates. The only one I can find is a CD4002B, and its propagation delay is 125-250ns. I'm going to run my clock slow (1MHz), and it will always be enabled, so I don't think it'll be a problem for this application. The problem is my weird memory map for this build. I have so many address pins that will indicate ROM. Do you think this will be a problem with this particular application? If I really have to, I can just do a CPLD to decode the whole thing. Part of what drew me into the build was that it was going to be so strange.
Just to be clear, the 6502 is not going to be reading anything from the UART. This is just going to be outputting the train animation with no user interaction. Later if this computer generates any excitement, and I come up with another idea for this, I may remap the memory, rebuild the machine a bit different, and do something else.