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

Subversion Repositories thor

[/] [thor/] [trunk/] [software/] [boot_tb/] [DisplayChar.asm] - Blame information for rev 23

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

Line No. Rev Author Line
1 5 robfinch
; ============================================================================
2
;        __
3
;   \\__/ o\    (C) 2015  Robert Finch, Stratford
4
;    \  __ /    All rights reserved.
5
;     \/_//     robfinch@finitron.ca
6
;       ||
7
;
8
;
9
; This source file is free software: you can redistribute it and/or modify
10
; it under the terms of the GNU Lesser General Public License as published
11
; by the Free Software Foundation, either version 3 of the License, or
12
; (at your option) any later version.
13
;
14
; This source file is distributed in the hope that it will be useful,
15
; but WITHOUT ANY WARRANTY; without even the implied warranty of
16
; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17
; GNU General Public License for more details.
18
;
19
; You should have received a copy of the GNU General Public License
20
; along with this program.  If not, see .
21
;
22
; ============================================================================
23
;
24
;------------------------------------------------------------------------------
25
; Display a character on the screen device
26
;------------------------------------------------------------------------------
27
;
28 12 robfinch
public VBDisplayChar:
29
                addui   r31,r31,#-40
30
                sws             c1,zs:[r31]
31
                sws             pregs,zs:8[r31]
32
                sw              r2,zs:16[r31]
33
                sw              r3,zs:24[r31]
34
                sw              r4,zs:32[r31]
35 5 robfinch
                ldi             r2,#8
36
                sc              r2,$FFDC0600
37
                zxb             r1,r1
38
                lb              r2,EscState
39
                tst             p0,r2
40
p0.lt   br              processEsc
41
                cmpi    p0,r1,#BS
42
p0.eq   br              doBackSpace
43
                cmpi    p0,r1,#$91      ; cursor right
44
p0.eq   br              doCursorRight
45
                cmpi    p0,r1,#$93      ; cursor left
46
p0.eq   br              doCursorLeft
47
                cmpi    p0,r1,#$90      ; cursor up
48
p0.eq   br              doCursorUp
49
                cmpi    p0,r1,#$92      ; cursor down
50
p0.eq   br              doCursorDown
51
                cmpi    p0,r1,#$99      ; delete
52
p0.eq   br              doDelete
53
                cmpi    p0,r1,#CR
54
p0.eq   br              doCR
55
                cmpi    p0,r1,#LF
56
p0.eq   br              doLF
57
                cmpi    p0,r1,#$94      ; cursor home
58
p0.eq   br              doCursorHome
59
                cmpi    p0,r1,#ESC
60
p0.ne   br              _0003
61
                ldi             r1,#1
62
                sb              r1,EscState
63
exitDC:
64 12 robfinch
                lws             c1,zs:[r31]
65
                lws             pregs,zs:8[r31]
66
                lw              r2,zs:16[r31]
67
                lw              r3,zs:24[r31]
68
                lw              r4,zs:32[r31]
69
                addui   r31,r31,#40
70 5 robfinch
                rts
71
_0003:
72 12 robfinch
                ldi             r4,#10
73
                sc              r4,$FFDC0600
74
                bsr             VBAsciiToScreen
75 5 robfinch
                lhu             r2,NormAttr
76 12 robfinch
                andi    r2,r2,#-1024
77 5 robfinch
                or              r1,r1,r2
78
                lcu             r3,VideoPos
79
                lhu             r2,Vidptr
80
                sh              r1,hs:[r2+r3*4]
81
                lcu             r1,CursorX
82
                addui   r1,r1,#1
83
                lcu             r2,Textcols
84
                cmp             p0,r1,r2
85
p0.ltu  br              .0001
86
                sc              r0,CursorX
87
                lcu             r1,CursorY
88
                addui   r1,r1,#1
89
                lcu             r2,Textrows
90
                cmp             p0,r1,r2
91
p0.ltu  sc              r1,CursorY
92
p0.ltu  bsr             SyncVideoPos    ; wont affect p0
93
p0.ltu  br              exitDC
94
                bsr             SyncVideoPos
95
                bsr             ScrollUp
96
                br              exitDC
97
.0001:
98
                sc              r1,CursorX
99
                bsr             SyncVideoPos
100
                br              exitDC
101
 
102
doCR:
103
                sc              r0,CursorX
104
                bsr             SyncVideoPos
105
                br              exitDC
106
doLF:
107
                lcu             r1,CursorY
108
                addui   r1,r1,#1
109
                lcu             r2,Textrows
110
                cmp             p1,r1,r2
111
p1.ge   bsr             ScrollUp
112
p1.ge   br              exitDC
113
                sc              r1,CursorY
114
                bsr             SyncVideoPos
115
                br              exitDC
116
 
117
processEsc:
118 12 robfinch
                ldi             r4,#22
119
                sc              r4,$FFDC0600
120 5 robfinch
                lb              r2,EscState
121
                cmpi    p0,r2,#-1
122
p0.ne   br              .0006
123
                cmpi    p0,r1,#'T'      ; clear to EOL
124
p0.ne   br              .0003
125
                lcu             r3,VideoPos
126
                lcu             r2,CursorX
127
                addui   r2,r2,#1
128
.0001:
129
                lcu             r1,Textcols
130
                cmp             p0,r2,r1
131
p0.ge   br              .0002
132
                ldi             r1,#' '
133
                lhu             r4,NormAttr
134
                or              r1,r1,r4
135
                lhu             r4,Vidptr
136
                sh              r1,hs:[r4+r3*4]
137
                addui   r2,r2,#1
138
                addui   r3,r3,#1
139
                br              .0001
140
.0002:
141
                sb              r0,EscState
142
                br              exitDC
143
 
144
.0003:
145
                cmpi    p0,r1,#'W'
146
p0.eq   sb              r0,EscState
147
p0.eq   br              doDelete
148
                cmpi    p0,r1,#'`'
149
p0.eq   ldi             r1,#-2
150
p0.eq   sb              r1,EscState
151
p0.eq   br              exitDC
152
                cmp             p0,r1,#'('
153
p0.eq   ldi             r1,#-3
154
p0.eq   sb              r1,EscState
155
p0.eq   br              exitDC
156
.0008:
157
                sb              r0,EscState
158
                br              exitDC
159
.0006:
160
                cmpi    p0,r2,#-2
161
p0.ne   br              .0007
162
                sb              r0,EscState
163
                cmpi    p0,r1,#'1'
164
p0.eq   bsr             CursorOn
165
p0.eq   br              exitDC
166
                cmpi    p0,r1,#'0'
167
p0.eq   bsr             CursorOff
168
                br              exitDC
169
.0007:
170
                cmpi    p0,r2,#-3
171
p0.ne   br              .0009
172
                cmpi    p0,r1,#ESC
173
p0.ne   br              .0008
174
                ldi             r1,#-4
175
                sb              r1,EscState
176
                br              exitDC
177
.0009:
178
                cmpi    p0,r2,#-4
179
p0.ne   br              .0010
180
                cmpi    p0,r1,#'G'
181
p0.ne   br              .0008
182
                ldi             r1,#-5
183
                sb              r1,EscState
184
                br              exitDC
185
.0010:
186
                cmpi    p0,r2,#-5
187
p0.ne   br              .0008
188
                sb              r0,EscState
189
                cmpi    p0,r1,#'4'
190
p0.ne   br              .0011
191
                lhu             r1,NormAttr
192
                mov             r2,r1
193
                shli    r1,r1,#9
194
                andi    r1,r1,#%111111111_000000000_00_00000000
195
                shrui   r2,r2,#9
196
                andi    r2,r2,#%000000000_111111111_00_00000000
197
                or              r1,r1,r2
198
                sh              r1,NormAttr
199
                br              exitDC
200
.0011:
201
                cmpi    p0,r1,#'0'
202
p0.ne   br              .0012
203
                ; Light grey on dark grey
204
                ldi             r1,#%001001001_011011011_00_00000000
205
                sh              r1,NormAttr
206
                br              exitDC
207
.0012:
208
                ; Light grey on dark grey
209
                ldi             r1,#%001001001_011011011_00_00000000
210
                sh              r1,NormAttr
211
                br              exitDC
212
 
213
doBackSpace:
214 12 robfinch
                ldi             r4,#23
215
                sc              r4,$FFDC0600
216 5 robfinch
                lc              r2,CursorX
217
                tst             p0,r2
218
p0.eq   br              exitDC          ; Can't backspace anymore
219
                lcu             r3,VideoPos
220
.0002:
221
                lh              r4,Vidptr
222
                lh              r1,hs:[r4+r3*4]
223
                addui   r3,r3,#-1
224
                sh              r1,hs:[r4+r3*4]
225
                addui   r3,r3,#2
226
                lc              r4,Textcols
227
                addui   r2,r2,#1
228
                cmp             p0,r2,r4
229
p0.ne   br              .0002
230
.0003:
231
                ldi             r1,#' '
232
                lh              r4,NormAttr
233
                or              r1,r1,r4
234
                lh              r4,Vidptr
235
                sh              r1,hs:[r4+r3*4]
236
                inc             CursorX,#-1
237
                bsr             SyncVideoPos
238
                br              exitDC
239
 
240
; Deleting a character does not change the video position so there's no need
241
; to resynchronize it.
242
 
243
doDelete:
244
                lc              r2,CursorX
245
                lh              r3,VideoPos
246
.0002:
247
                addui   r2,r2,#1
248
                lc              r4,Textcols
249
                cmp             p0,r2,r4
250
p0.ge   br              .0001
251
                addui   r2,r2,#-1
252
                addui   r3,r3,#1
253
                lh              r4,Vidptr
254
                lh              r1,hs:[r4+r3*4]
255
                addui   r3,r3,#-1
256
                sh              r1,hs:[r4+r3*4]
257
                addui   r3,r3,#1
258
                addui   r2,r2,#1
259
                br              .0002
260
.0001:
261
                ldi             r1,#' '
262
                lh              r2,NormAttr
263
                or              r1,r1,r2
264
                sh              r1,hs:[r4+r3*4]
265
                br              exitDC
266
 
267
doCursorHome:
268
                lcu             r1,CursorX
269
                tst             p0,r1
270
p0.eq   br              doCursor1
271
                sc              r0,CursorX
272
                bsr             SyncVideoPos
273
                br              exitDC
274
doCursorRight:
275
                lcu             r1,CursorX
276
                addui   r1,r1,#1
277
                lcu             r2,Textcols
278
                cmp             p0,r1,r2
279
p0.ge   br              exitDC
280
doCursor2:
281
                sc              r1,CursorX
282
                bsr             SyncVideoPos
283
                br              exitDC
284
doCursorLeft:
285
                lcu             r1,CursorX
286
                tst             p0,r1
287
p0.eq   br              exitDC
288
                subui   r1,r1,#1
289
                br              doCursor2
290
doCursorUp:
291
                lcu             r1,CursorY
292
                tst             p0,r1
293
p0.eq   br              exitDC
294
                subui   r1,r1,#1
295
                br              doCursor1
296
doCursorDown:
297
                lcu             r1,CursorY
298
                addui   r1,r1,#1
299
                lcu             r2,Textrows
300
p0.ge   br              exitDC
301
doCursor1:
302
                sc              r1,CursorY
303
                bsr             SyncVideoPos
304
                br              exitDC
305
 

powered by: WebSVN 2.1.0

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