How To Quickly Get A 6502 CPU Chip Running:

First things first: The 6502 needs power, so hook it up to a nice clean 5
volt DC power supply. Connect the positive end to the CPU's pin 8, and the
negative (ground) end to pins 1 and 21. (The 6502 has two ground pins.)

Like most CPUs, the 6502 also needs a good clean clock signal to run. It is
beyond the scope of this quick-start guide to describe how to make your own
clock circuit, but once you have one, connect its output to pin 37. (The 6502
has two other "clock" pins, but they are outputs. Pin 37 is the only clock
input.) When working with the 6502, remember that unlike the Z80, which has
no minimum clock speed and can actually be hand-clocked through a push-button
circuit, the 6502 has a minimum clock rate and will crash if its clock input
is below a certain frequency threshold. The reason for this is because some
of its internal data registers are dynamic rather than static, meaning they
will decay if they are not maintained at a certain refresh level (much as
DRAM memory decays if it is not constantly refreshed). The exact minimum
clock rate for the 6502 varies depending on which source you ask... It is
variously cited as anywhere from 50 KHz to 500 KHz.

Some of the 6502's control pins must also be set for the CPU to run.
Specifically, pin 2 (RDY), 4 (IRQ), and 6 (NMI) should be kept high. If they
are left low, they may interfere with the CPU and stop it from running. RDY
can be connected directly to the positive end of the power supply, but IRQ
and NMI both require 3,000 ohm pull-up resistors. Use a 3Kohm resistor to
connect each of those two pins to the positive end of the power supply.

Also like most CPUs, the 6502 must be reset when it is turned on before it
will work correctly. Therefore, you must devise a way to make the RESET pin
(which is pin 40, and is active-low) go low for a moment, then go high again.
The CPU will reset itself while the pin is low, and then begin running once
the pin goes high. There are many ways to make a simple reset circuit. You
could hook up a timer which maintains the reset signal for a specific amount
of time, or you could simply attach a push-button switch to the RESET pin to
connect it to ground momentarily. Exactly how long you need to keep the RESET
line active varies, but in general, one or two full seconds should be more
than enough.

Although not completely necessary, you should take a moment to add a
capacitor to the CPU. It is standard practice, when wiring up CPUs, to place
a fast capacitor (from 0.1 to 4.7 microfarads, and preferably ceramic)
between the positive and negative voltage pins on the CPU, as close to the
CPU as possible. This is to ensure that the DC feed line has a very low AC
impedance. (This is called a decoupling capacitor.) Generally, none of the
other CPU pins should require a capacitor.

Remember, NEVER leave inputs on a CPU unconnected to anything. If you do so,
they will fluctuate intermittently or "float", producing erratic results.

Your 6502 is now ready to run. If you plug in your power supply and activate
the reset line (if you haven't rigged up an automatically-triggered reset
circuit), the 6502 will probably begin running right away. However, there are
two problems here: First of all, you have no way of seeing if the CPU is
actually doing something or not. Secondly, the CPU has no instructions, so it
will probably execute random code based on the "floating" voltages it is
receiving on the data bus pins.

To make a "real" computer, you must first send the CPU some instructions via
its data bus. You can do this by hooking it up to a ROM, but if all you want
to do is test the CPU quickly, you can simply connect the 6502's data bus
pins directly to the positive or negative end of the power supply. (The use
of a gentle resistor, say about 500 ohms, is recommended on each pin to
protect the CPU, but this is not absolutely necessary.) A positive voltage
equals a logical 1, and a non-voltage equals a logical 0. The 6502's opcode
for NOP (no operation, a do-nothing instruction and the simplest instruction
in every CPU) is 11101010. To create this instruction, connect data bus pins
D0, D2, and D4 to ground, and the other five to the positive voltage. (The
data bus pins are numbered left-to-right from 7 to 0, so D7 is the first bit
of an instruction and D0 is the last.) This will make the CPU execute NOP
instructions repeatedly.

If you have done all this, the 6502 is now executing NOP instructions at a
rapid rate. You can watch the CPU in action by hooking up some LEDs to the
address bus pins. The LEDs will flicker as the CPU busily sends out memory
address signals to RAM or ROM chips which it believes it is getting all these
NOPs from. If you see the LEDs flickering, congratulations, your 6502 is
working. If not, it may be that you have the LED on a pin that is triggering
too quickly. On A0, the lowest address bus pin, the LED would probably be
flashing many times every second, and it may be too fast for the naked eye to
perceive as flashing. Try moving the LED up higher. Pin A6 should flash half
as quickly as A5, and pin A7 should flash half as quickly as A6, and so on.

From here, you can connect the 6502 to a ROM chip with some bootstrap code in
it, and add some RAM for temporary storage space. Have fun!

    Source: geocities.com/siliconvalley/2072

               ( geocities.com/siliconvalley)