Joystick port and input buffer added.
Reading data from one of the 256 mapped address locations is just as important as writing since several of the functions such as the Sprite Engine and Video Frame Generator also send fata to the 6502 to signal certain events. The Video Generator for instance will tell the 6502 when the vertical blanking period has started so that the dual frame buffers can be swapped at a time when there will be no visible artifacts on the screen. Even the Sound Generator has some output to let the running program know when a sound sample has finished playing.
To test the inputting of 8 bit data to the 6502, a 9 pin joystick port was temporarily wired to the input side of a 74HC245 8 bit buffer that has its output enable line mapped to location 520, which is the first address on the second 74HC138, or what I call Block Two. I consider each of the 128 demultiplexers to be blocks, so there are 128 blocks available, each with its own 8 IO lines.
What is interesting about the method I am using to decode addresses is that the 6502 Read Write line (R/W) is not used. What this means is that I can put inputs or outputs at any one of the 128 locations without having to route R/W to that location at all, just connect any of the negative logic lines from any 74HC138 to either a buffer or a latch, and that’s all. Of course, this does mean that the program has to be considerate of what is at that location or a bus collision will occur.
Decode section showing both input and output.
Looking at the schematic fragment shown above, you can see how the hardware does not consider the R/W line of the 6502 in either input or output decoded addresses. If the address of 512 (Block 1, Bit 0)is read, then the 74HC245 at that location feeds its data onto the 6502 Data Bus, which in this example becomes the data read from Joystick Port One. If the address of 530 (Block 3, Bit 2) is written to, then the 74HC574 lathes that 8 bit data. In this case, it is called Sprite Alpha Color.
As long as the programmer doesn’t try to write to the read location, then no bus collision will ever occur. A read from the write location will do nothing but return invalid data. Now since this is not a home computer “for the masses, not the classes”, then I doubt a program will ever be written that would attempt to write to a read only location, at least not by me on a good day!
Reading and displaying joystick data on the LEDs.
To make sure data was flowing in both directions from the memory mapped IO segment, I recoded the LED chaser program to read the joystick data and then move the LED in the direction that the joystick was pointing. Pressing the fire button made all of the LEDs turn on at once. I won’t bother posting the 6502 program code as it isn’t much different, and to read the joystick data, you need only one line of code, “LDA 520”, which tells the 6502 to load the accumulator with whatever data is present at address location 520, in this case the 8 bits of joystick data.
Unlike the C64 or VIC20, I decided to go with positive logic on my joystick ports as this is easier to figure out when you are programming. To achieve this, I just fed the common line of the joystick port to VCC and then tied the input lines low though 10K resistors. When any joystick switch is engaged, then that bit goes high rather than low as it was in the original 1980’s game consoles and computer systems.
So now my IO decode section is fully tested, and the 6502 has proven to boot and have the ability to speak with the hardware. It is now time start working on the NTSC Video Frame Generator so Vulcan-74 can really start to come alive.
Updated : MAY 18 2019 – More to come very soon!
I work on this project on spare weekends when my homesteading chores are done for the day. This blog will grow to hundreds of photos before the end, and Vulcan-74 will evolve and adapt until it is the exact machine I dreamed of creating way back in 1980!
Do you want to follow this project?
If you would like to receive email updates, please join our DIY Forum and follow this thread…
I plan on working on the Video Generator this fall.
Farming chores steal away all my time during the hot months!