-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathhelloWorld.asm
More file actions
115 lines (87 loc) · 1.85 KB
/
helloWorld.asm
File metadata and controls
115 lines (87 loc) · 1.85 KB
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
; set cursor stuff:
ldi xr #0E ; Display on, cursor on, blink off : 00001110
stw xr #FE ; store to port B
ldi xr #0 ; clear RS/RW/E bits
stw xr #FF ; store to port A
ldw xr enable ; enable write to lcd
stw xr #FF ; store to port A
ldi xr #0 ; clear RS/RW/E bits
stw xr #FF ; store to port A
; entry mode set
ldi xr #06 ; Increment and shift curosr, don't shift display, 00000110
stw xr #FE ; store to port B
ldi xr #0 ; clear RS/RW/E bits
stw xr #FF ; store to port A
ldw xr enable ; enable write to lcd
stw xr #FF ; store to port A
ldi xr #0 ; clear RS/RW/E bits
stw xr #FF ; store to port A
; write Hello,world to lcd
ldw xr charH ;
stw xr #FE ; store to port B
jmp writeChar
ldw xr chari ;
stw xr #FE ; store to port B
jmp writeChar
ldw xr char, ;
stw xr #FE ; store to port B
jmp writeChar
ldw xr charW ;
stw xr #FE ; store to port B
jmp writeChar
ldw xr charo ;
stw xr #FE ; store to port B
jmp writeChar
ldw xr charr ;
stw xr #FE ; store to port B
jmp writeChar
ldw xr charl ;
stw xr #FE ; store to port B
jmp writeChar
ldw xr chard
stw xr #FE ; store to port B
jmp writeChar
ldw xr char!
stw xr #FE ; store to port B
jmp writeChar
loop:
jmp loop
writeChar:
ldw xr rs ; set register select
stw xr #FF ; store to port A
ldw xr enrs ; enable write to lcd
stw xr #FF ; store to port A
ldw xr rs ; clear RS/RW/E bits
stw xr #FF ; store to port A
ret
.org #$70 ; place following code at address 0x1E
porta:
.word #FF ; place literal 0x5 at this address
portb:
.word #FE ; place literal 15 at this address
enable:
.word #80 ; store 10000000
rw:
.word #40 ; store 01000000
rs:
.word #20 ; store 00100000
enrs:
.word #A0
charH:
.word 'H'
chari:
.word 'i'
charl:
.word 'l'
char,:
.word ','
charW:
.word 'W'
charo:
.word 'o'
charr:
.word 'r'
chard:
.word 'd'
char!:
.word '!'