OpenCores
URL https://opencores.org/ocsvn/eco32/eco32/trunk

Subversion Repositories eco32

[/] [eco32/] [trunk/] [monitor/] [monitor/] [common/] [display.s] - Blame information for rev 262

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 59 hellwig
;
2
; display.s -- a memory-mapped alphanumerical display
3
;
4
 
5
;***************************************************************
6
 
7
        .set    dspbase,0xF0100000      ; display base address
8
 
9
        .export dspinit                 ; initialize display
10
        .export dspoutchk               ; check for output possible
11
        .export dspout                  ; do display output
12
 
13
;***************************************************************
14
 
15
        .code
16
        .align  4
17
 
18
        ; initialize display
19
dspinit:
20
        sub     $29,$29,4
21
        stw     $31,$29,0
22
        jal     clrscr
23
        add     $8,$0,scrrow
24
        stw     $0,$8,0
25
        add     $8,$0,scrcol
26
        stw     $0,$8,0
27
        jal     calcp
28
        jal     stcrs
29
        ldw     $31,$29,0
30
        add     $29,$29,4
31
        jr      $31
32
 
33
        ; check if a character can be written
34
dspoutchk:
35
        add     $2,$0,1
36
        jr      $31
37
 
38
        ; output a character on the display
39
dspout:
40
        sub     $29,$29,8
41
        stw     $31,$29,4
42
        stw     $16,$29,0
43
        and     $16,$4,0xFF
44
        jal     rmcrs
45
        add     $8,$0,' '
46
        bltu    $16,$8,dspout2
47
        add     $8,$0,scrptr
48
        ldw     $9,$8,0
49
        or      $16,$16,0x07 << 8
50
        stw     $16,$9,0
51
        add     $9,$9,4
52
        stw     $9,$8,0
53
        add     $8,$0,scrcol
54
        ldw     $9,$8,0
55
        add     $9,$9,1
56
        stw     $9,$8,0
57
        add     $10,$0,80
58
        bne     $9,$10,dspout1
59
        jal     docr
60
        jal     dolf
61
dspout1:
62
        jal     stcrs
63
        ldw     $16,$29,0
64
        ldw     $31,$29,4
65
        add     $29,$29,8
66
        jr      $31
67
 
68
dspout2:
69
        add     $8,$0,0x0D
70
        bne     $16,$8,dspout3
71
        jal     docr
72
        j       dspout1
73
 
74
dspout3:
75
        add     $8,$0,0x0A
76
        bne     $16,$8,dspout4
77
        jal     dolf
78
        j       dspout1
79
 
80
dspout4:
81
        add     $8,$0,0x08
82
        bne     $16,$8,dspout5
83
        jal     dobs
84
        j       dspout1
85
 
86
dspout5:
87
        j       dspout1
88
 
89
        ; do carriage return
90
docr:
91
        sub     $29,$29,4
92
        stw     $31,$29,0
93
        add     $8,$0,scrcol
94
        stw     $0,$8,0
95
        jal     calcp
96
        ldw     $31,$29,0
97
        add     $29,$29,4
98
        jr      $31
99
 
100
        ; do linefeed
101
dolf:
102
        sub     $29,$29,4
103
        stw     $31,$29,0
104
        add     $8,$0,scrrow
105
        ldw     $9,$8,0
106
        add     $10,$0,29
107
        beq     $9,$10,dolf1
108
        add     $9,$9,1
109
        stw     $9,$8,0
110
        jal     calcp
111
        j       dolf2
112
dolf1:
113
        jal     scrscr
114
dolf2:
115
        ldw     $31,$29,0
116
        add     $29,$29,4
117
        jr      $31
118
 
119
        ; do backspace
120
dobs:
121
        sub     $29,$29,4
122
        stw     $31,$29,0
123
        add     $8,$0,scrcol
124
        ldw     $9,$8,0
125
        beq     $9,$0,dobs1
126
        sub     $9,$9,1
127
        stw     $9,$8,0
128
        jal     calcp
129
dobs1:
130
        ldw     $31,$29,0
131
        add     $29,$29,4
132
        jr      $31
133
 
134
        ; remove cursor
135
rmcrs:
136
        add     $8,$0,scrptr
137
        ldw     $8,$8,0
138
        add     $9,$0,scrchr
139
        ldw     $10,$9,0
140
        stw     $10,$8,0
141
        jr      $31
142
 
143
        ; set cursor
144
stcrs:
145
        add     $8,$0,scrptr
146
        ldw     $8,$8,0
147
        add     $9,$0,scrchr
148
        ldw     $10,$8,0
149
        stw     $10,$9,0
150
        add     $10,$0,(0x87 << 8) | '_'
151
        stw     $10,$8,0
152
        jr      $31
153
 
154
        ; calculate screen pointer based on row and column
155
calcp:
156
        add     $9,$0,dspbase
157
        add     $8,$0,scrrow
158
        ldw     $10,$8,0
159
        sll     $10,$10,7+2
160
        add     $9,$9,$10
161
        add     $8,$0,scrcol
162
        ldw     $10,$8,0
163
        sll     $10,$10,0+2
164
        add     $9,$9,$10
165
        add     $8,$0,scrptr
166
        stw     $9,$8,0
167
        jr      $31
168
 
169
        ; clear screen
170
clrscr:
171
        add     $11,$0,(0x07 << 8) | ' '
172
        add     $8,$0,dspbase
173
        add     $9,$0,30
174
clrscr1:
175
        add     $10,$0,80
176
clrscr2:
177
        stw     $11,$8,0
178
        add     $8,$8,4
179
        sub     $10,$10,1
180
        bne     $10,$0,clrscr2
181
        add     $8,$8,(128-80)*4
182
        sub     $9,$9,1
183
        bne     $9,$0,clrscr1
184
        jr      $31
185
 
186
        ; scroll screen
187
scrscr:
188
        add     $8,$0,dspbase
189
        add     $9,$0,29
190
scrscr1:
191
        add     $10,$0,80
192
scrscr2:
193
        ldw     $11,$8,128*4
194
        stw     $11,$8,0
195
        add     $8,$8,4
196
        sub     $10,$10,1
197
        bne     $10,$0,scrscr2
198
        add     $8,$8,(128-80)*4
199
        sub     $9,$9,1
200
        bne     $9,$0,scrscr1
201
        add     $11,$0,(0x07 << 8) | ' '
202
        add     $10,$0,80
203
scrscr3:
204
        stw     $11,$8,0
205
        add     $8,$8,4
206
        sub     $10,$10,1
207
        bne     $10,$0,scrscr3
208
        jr      $31
209
 
210
;***************************************************************
211
 
212
        .bss
213
        .align  4
214
 
215
scrptr:
216
        .word   0
217
 
218
scrrow:
219
        .word   0
220
 
221
scrcol:
222
        .word   0
223
 
224
scrchr:
225
        .word   0

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.