homebrew 6502 computer – part 1

After building Ben Eater’s 6502 computer, I wanted to try my hand at my own version. I wanted to utilize the full 32k of ram and use a real monitor as the display.

I started with a W65C02 processor and an AT28C16 eeprom. I filled the eeprom with nop instructions and set the eeprom to the top of the memory map.

/images/6502_1_web.jpg

I’m using the same slow clock module and Arduino sketch from Ben Eater to view the address and data buses in real time. You can see the initialization in the screen shot below. The reset vector points to $f800 which is the eeprom full of ea instructions.

/images/6502_2_web.jpg

I quickly realized that 2k would not be big enough for the ROM. I want to eventually try to get basic running on here. I switched the AT28C16 for an AT28C256. That is a 32k eeprom, but I’m only going to use half of it for 16k.

I then wired up a 62256 32k static ram chip and set up the address decoding. At this point, my memory map looks like:

RAM $0000 – $7FFF
ROM $C000 – $FFFF

/images/6502_3_web.jpg

 

/images/6502_4_web.jpg

In the image below, you can see the reset vector at $fffc and $fffd launching the start of the rom at $c000.

I’m using the following code to write 0x55 to address $2000 and then reading it back again. Then I write 0xAA to $2001 and read it back to verify that ram is working correctly.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
  .org $c000

reset:
  ldx #$ff
  txs

  lda #$55
  sta $2000
  nop
  nop
  lda $2000
  nop
  nop

  lda #$aa
  sta $2001
  nop
  nop
  lda $2001
  nop
  nop

loop:
  jmp loop

  .org $fffc
  .word reset
  .word $0000

 

/images/6502_5_web.jpg

So now that ram is working, I started looking at the display. I settled on using an MC6847 as the display chip. It has a built in character generator and I can get composite video out. It is relatively simple to interface and I had two in the junk box.

Instead of trying to set up some form of ram sharing, I used a AM2130-10PC 1k dual port ram chip as the video ram. I put it just after ram in the memory map.

RAM  $0000 – $7FFF
VRAM $8000 – $83FF
ROM	 $C000 – $FFFF

 

/images/6502_9_web.jpg

The image below shows writing 0x11 to $8000 and 0x22 to $83FF and reading the values back to verify that VRAM is working.

/images/6502_11_web-scaled.jpg

Now that I have working vram, I wired up the MC6847.

/images/6502_14_web.jpg

I wired the second port of the VRAM to the MC6847, then I built a 2 transistor amplifier for the video signal.

/images/6502_18_web.jpg

Next I built a 3.579 MHz clock module using a color burst crystal and a 74hc04. I also added a 1MHz can oscillator as the main system clock.

/images/6502_17_web.jpg

Once it is all wired together, I have a display that can output 512 characters in 32 columns x 16 rows. Each byte of VRAM maps to one character on the screen. The top left character is at address $8000 and the bottom right is $83FF.

I can now write text to the screen. In the image below, the garbage on the rest of the screen is just the default garbage that was in ram at boot.

/images/6502_12_web.jpg

I tweaked the code a little to fill the rest of the screen with blank characters. 

/images/6502_13_web.jpg

The address decoding so far is in the image below.

/images/6502_16_web.jpg

Next, I’d like to write some display handling code. I also need to add a keyboard interface to make this thing somewhat useful.

/images/6502_15_web.jpg