I finally had a few days off over the holiday weekend and was able to follow along with Ben Eater’s 6502 computer series on youtube.
The videos series is well done and the build was pretty straight forward.
The schematic for the final computer is below.
I didn’t take too many pictures of the build process. I did start out with a different breadboard layout, but it was getting a bit cramped, so I built out the address and data buses down one side of the breadboard which made things much easier.
I also bought some of the actual busboard brand breadboards this time. My last few breadboard computers were plagued with flaky connections, but so far the busboard breadboards have been working great.
The arduino mega was used as a poor man’s logic analyzer and was really helpful during troubleshooting.
I started out with the 555 clock module from my other breadboard computer.
The final computer is shown below with a 1MHz can oscillator.
The computer is programmed with 6502 assembly. The code for the hello world program is below.
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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
|
PORTB = $6000
PORTA = $6001
DDRB = $6002
DDRA = $6003
E = %10000000
RW = %01000000
RS = %00100000
.org $8000
reset:
ldx #$ff
txs
lda #%11111111 ; Set all pins on port B to output
sta DDRB
lda #%11100000 ; Set top 3 pins on port A to output
sta DDRA
lda #%00111000 ; Set 8-bit mode; 2-line display; 5x8 font
jsr lcd_instruction
lda #%00001110 ; Display on; cursor on; blink off
jsr lcd_instruction
lda #%00000110 ; Increment and shift cursor; don't shift display
jsr lcd_instruction
lda #$00000001 ; Clear display
jsr lcd_instruction
ldx #0
print:
lda message,x
beq loop
jsr print_char
inx
jmp print
loop:
jmp loop
message: .asciiz "Hello, world!"
lcd_wait:
pha
lda #%00000000 ; Port B is input
sta DDRB
lcdbusy:
lda #RW
sta PORTA
lda #(RW | E)
sta PORTA
lda PORTB
and #%10000000
bne lcdbusy
lda #RW
sta PORTA
lda #%11111111 ; Port B is output
sta DDRB
pla
rts
lcd_instruction:
jsr lcd_wait
sta PORTB
lda #0 ; Clear RS/RW/E bits
sta PORTA
lda #E ; Set E bit to send instruction
sta PORTA
lda #0 ; Clear RS/RW/E bits
sta PORTA
rts
print_char:
jsr lcd_wait
sta PORTB
lda #RS ; Set RS; Clear RW/E bits
sta PORTA
lda #(RS | E) ; Set E bit to send instruction
sta PORTA
lda #RS ; Clear E bits
sta PORTA
rts
.org $fffc
.word reset
.word $0000
|