-
Notifications
You must be signed in to change notification settings - Fork 1
/
main.s
118 lines (88 loc) · 2.37 KB
/
main.s
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
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
PORTB = $6000
PORTA = $6001
DDRB = $6002
DDRA = $6003
E = %10000000
RW = %01000000
RS = %00100000
.export reset
reset:
ldx #$ff ; Reset Stack Pointer
txs
;lda #$ff
;sta DDRB ; Set All Control pins to outputs
stx DDRB ; Set All Control pins to outputs
lda #$E0
sta DDRA ; Set 3 high pins to outputs
; SET MODE
lda #%00111000 ; Set 8-bit, 2-line, 5x8 font mode
jsr LCD_CONTROL_A
; DISPLAY ON
lda #%00001110 ; Display on, Cursor on, Blink Off
jsr LCD_CONTROL_A
; Increment mode
lda #%00000110 ; Set display mode to auto incremetn to the right
jsr LCD_CONTROL_A
; Clear Display
lda #%00000001 ; Set display mode to auto incremetn to the right
jsr LCD_CONTROL_A
; Print character
lda #'H'
jsr LCD_OUTPUT_A
; Print character
lda #'e'
jsr LCD_OUTPUT_A
; Print character
lda #'l'
jsr LCD_OUTPUT_A
; Print character
lda #'l'
jsr LCD_OUTPUT_A
; Print character
lda #'o'
jsr LCD_OUTPUT_A
; Print character
lda #','
jsr LCD_OUTPUT_A
; Print character
lda #' '
jsr LCD_OUTPUT_A
; Print character
lda #'W'
jsr LCD_OUTPUT_A
; Print character
lda #'o'
jsr LCD_OUTPUT_A
; Print character
lda #'r'
jsr LCD_OUTPUT_A
; Print character
lda #'l'
jsr LCD_OUTPUT_A
; Print character
lda #'d'
jsr LCD_OUTPUT_A
; Print character
lda #'!'
jsr LCD_OUTPUT_A
END:
jmp END
;brk
LCD_OUTPUT_A:
sta PORTB
lda #RS ; Clear LCD control bits And Toggle Enable bit
sta PORTA ; Keep RS set to select output register (vs control)
lda #(E|RS)
sta PORTA
lda #RS
sta PORTA
rts
LCD_CONTROL_A:
sta PORTB
lda #0 ; Clear LCD control bits And Toggle Enable bit
sta PORTA ; Keep RS clear to select control register (vs ouput)
lda #E
sta PORTA
lda #0
sta PORTA
rts