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

Subversion Repositories z80soc

[/] [z80soc/] [trunk/] [V0.6/] [DE1/] [ROM/] [SoC_DE1.z8a] - Blame information for rev 40

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 40 rrred
           ld          sp,(7FDEh)          ; Put Stack on top of memory
2
inicio:
3
           ld          a,(7FDDH)
4
           or          a
5
           jr          z,inic1
6
 
7
           call        set_lcd           ; Is Z80soc-s3e
8
inic1:
9
           call        clear
10
           ld          de,4034h
11
           ld          hl,Text1
12
           call        printmsg
13
           ld          de,405Ch
14
           ld          hl,Text2
15
           call        printmsg
16
           call        Border
17
           ld          de,4146h
18
           ld          hl,Text3
19
           call        printmsg
20
           ld          de,4196h
21
           ld          hl,Text4
22
           call        printmsg
23
           ld          de,41E6h
24
           ld          hl,Text5
25
           call        printmsg
26
           ld          de,4236h
27
           ld          hl,Text6
28
           call        printmsg
29
           ld          de,425Eh
30
           ld          hl,Text7
31
           call        printmsg
32
           ; check soz version
33
           ld          hl,DE1_Version
34
           ld          a,(7FDDH)
35
           or          a
36
           jr          z,print_v
37
           ld          hl,S3E_Version
38
print_v:
39
           ld          de,4087h
40
           call        printmsg
41
setprint:
42
           ld          de,42D6h
43
           ld          bc,30
44
loopprint:
45
           push        bc
46
           push        de
47
           call        delay
48
           call        rotate
49
           ld          a,(7FDDH)
50
           or          a
51
           jr          z,looppr2
52
           call        s3e_routine       ; Is Z80-S3E
53
looppr2:
54
           pop         de
55
           pop         bc
56
           call        read_kbd
57
           or          a
58
           jr          z,loopprint
59
           cp          41h
60
           jr          z,go_on
61
           out         (01H),a
62
           ld          l,a
63
           ld          a,(7FDDh)           ; get z80soc version
64
           or          a
65
           jr          nz,looppr3
66
           ld          a,l
67
           out         (11h),a             ; Use HEX display if DE1
68
looppr3:
69
           ld          a,l
70
           ld          (de),a
71
           inc         de
72
           dec         bc
73
           ld          a,b
74
           or          c
75
           jr          z,setprint
76
           jr          loopprint
77
go_on:
78
           ld          hl,8000h          ; RAM Address
79
           ld          a,0               ; Value to store in memory
80
loop1:
81
           ld          (hl),a            ; Store A into Memory (HL)
82
           inc         hl               ; Point to next memory location
83
           inc         a                ; Add 1 to value to store in memory
84
           jr          nz,loop1          ; If A not equal 0 continue loop1
85
                                ; When A=FFh, and we make A=A+1 ...
86
                                ; A becomes 100h
87
                                ; But, A is an 8 bits register, and
88
                                ; can only store the two last hex digits,
89
                                ; that is, 8 bits.
90
           call        read_key0       ; Wait until KEY0 is pressed
91
                                ;
92
           ld          hl,8000h          ; Get back the start RAM address
93
loop2:
94
           ld          a,(7FDDh)           ; get z80soc version
95
           or          a
96
           jr          nz,skip2_de1
97
           ld          a,h
98
           out         (11h),a
99
           ld          a,l
100
           out         (10h),a
101
skip2_de1:
102
           ld          a,(hl)             ; Read back the values stored in loop1
103
           out         (01h),a            ; Send to Green Leds
104
           call        delay              ; Call sub-routine to delay some time
105
           inc         hl                 ; Add 1 to the memory location
106
           ld          a,(hl)             ; Read the value in the memory
107
           cp          FFh               ; check if equal 255
108
           jr          nz,skip2_de1       ; If not equal 255, continue loop2
109
           ; end of First execution
110
           call         read_key0       ; Wait until KEY0 is pressed
111
           jP           inicio            ; Restart program
112
read_key0:
113
loop3:
114
           call         delay
115
           in           a,(30h)           ; Read KEYs (all 4 KEYs)
116
           cp           1               ; check if returns "00001110"
117
           jr           nz,loop3          ; KEY0 not pressed, continue checking
118
           ret
119
iodelay:
120
           in           a,(20h)           ; Read SW(7-0)
121
           or           a
122
           jr           nz,loop4
123
           ld           a,1       ; Read the number of times to loop
124
loop4:
125
           dec          a                ; Start counting backwards
126
           jr           nz,loop4          ; If A greather than 0, continue loop
127
           ret                  ; return to calling program
128
delay:
129
           in           a,(20h)           ; Read SW(7-0)
130
           or           a
131
           jr           nz,loop5
132
           ld           a,1
133
loop5:
134
           push  af
135
           ld    bc,5000             ; Every delay has at least 255 loops
136
loop6:
137
           dec   bc                ; Start counting backwards
138
           ld    a,b
139
           or    c
140
           jr    nz,loop6          ; If A greather than 0, continue loop
141
           pop   af               ; Get multiplier back
142
           dec   a                ;
143
           jr    nz,loop5
144
           ret                  ; return to calling program
145
clear:
146
        ld      a,0
147
        out     (91h),a      ; video cursor x = 0
148
        out     (92h),a      ; video cursor y = 0
149
        ld      bc,1200
150
clean_loop:
151
        ld      a,2Eh
152
        out     (90h),a      ; print character to video
153
                             ; cursor x,y is automatically updated
154
                             ; by hardware
155
        dec     bc
156
        ld      a,b
157
        or      c
158
        jr      nz,clean_loop
159
        ret
160
printmsg:
161
 
162
ploop:
163
 
164
           ld          a,(hl)
165
           or          a
166
           ret         z
167
           ld          (de),a
168
           inc         hl
169
           inc         de
170
           jr          ploop
171
read_kbd:
172
           in          a,(80h)
173
           ret
174
Border:
175
           ld          hl,Lineu
176
           ld          de,40F5H
177
           call        printmsg
178
           ld          de,411DH
179
           ld          a,10
180
brdloop:
181
           ld          hl,Column
182
           push        hl
183
           push        af
184
           push        de
185
           call        printmsg
186
           pop         de
187
           pop         af
188
           ld          hl,40
189
           add         hl,de
190
           ld          d,h
191
           ld          e,l
192
           pop         hl
193
           dec         a
194
           jr          nz,brdloop
195
           ld          hl,Lined
196
           call        printmsg
197
           ret
198
rotate:
199
           ; save first line of box
200
           ld          hl,411Eh
201
           ld          de,B000h
202
           ld          bc,30
203
           ldir
204
           ; move all lines up
205
           ld          hl,4146h ; this is second line of box
206
           ld          de,411Eh ; this is first line of box
207
           ld          b,9
208
loop_rotate:
209
           push        bc
210
           push        hl
211
           push        de
212
           ld          bc,30
213
           ldir
214
           pop         de
215
           ld          hl,40
216
           add         hl,de
217
           ld          d,h
218
           ld          e,l
219
           pop         hl
220
           ld          bc,40
221
           add         hl,bc
222
           pop         bc
223
           djnz        loop_rotate
224
           ; now get back the first line saved in 9000h
225
           ; and put on the last line of box
226
           ld          hl,B000h
227
           ld          bc,30
228
           ldir
229
           ret
230
s3e_routine:
231
           ; print message in LCD display
232
           ; Check of Rotary Knob is moving
233
           call        read_rot
234
           ; Is it rotating to the right ?
235
           cp          1
236
           jr          nz,check_left
237
           call        roll_lcd_right
238
           ld          a,1
239
           jr          printlcd
240
 
241
check_left:
242
           ; Is it rotating to the left?
243
           cp          2
244
           jr          nz,dec_jump
245
           call        roll_lcd_left
246
           ld          a,128
247
printlcd:
248
           out         (01h),a
249
           ld          de,7FE0h
250
           ld          hl,9100h
251
           call        printmsg
252
dec_jump:
253
           ret
254
set_lcd:
255
           ld          de,9100h
256
           ld          hl,lcdtxt
257
           ld          bc,33
258
           ldir
259
           ld          de,7FE0h
260
           ld          hl,9100h
261
           ld          bc,32
262
           ldir
263
             ret
264
read_rot:
265
           ;CALL        DELAY_MULT
266
           ;LD          A,0
267
           ;RET         NZ
268
           IN          A,(70H)
269
           RET
270
 
271
DELAY_ROT:
272
           LD          A,(9200H)
273
           DEC         A
274
           LD          (9200H),A
275
           RET
276
DELAY_MULT:
277
           LD          A,(9201H)
278
           DEC         A
279
           JR          NZ,DLY_M1
280
           LD          A,10H
281
DLY_M1:
282
           LD          (9201H),A
283
           RET
284
 
285
roll_lcd_left:
286
           ; save the first char on the left, for every line
287
           ld        a,(9100h)
288
           ld        (9202H),a
289
           ld        a,(9110h)
290
           ld        (9203H),a
291
           ld        HL,9101H
292
           ld        de,9100h
293
           ld        bc,31
294
           ldir
295
           ld        a,(9202h)
296
           ld        (910Fh),a
297
           ld        a,(9203h)
298
           ld        (911Fh),a
299
           ret
300
roll_lcd_right:
301
           ; save the first char on the left, for every line
302
           ld        a,(910Fh)
303
           ld        (9202H),a
304
           ld        a,(911Fh)
305
           ld        (9203H),a
306
           ld        HL,911EH
307
           ld        de,911Fh
308
           ld        bc,31
309
           lddr
310
           ld        a,(9202h)
311
           ld        (9100h),a
312
           ld        a,(9203h)
313
           ld        (9110h),a
314
           ret
315
Text1:
316
           db                   "Z80 SYSTEM ON CHIP"
317
           db                   0
318
Text2:
319
           db                   "RONIVON COSTA 2008"
320
           db                   0
321
Text3:
322
           db                   "  |!#$%&/()=?*`+´ç~^,.;:\<>"
323
           db                   0
324
Text4:
325
           db                   "  ABCDEFGHIJKLMNOPQRSTUVWXYZ"
326
           db                   0
327
Text5:
328
           db                   "  abcdefghijklmnopqrstuvwxyz"
329
           db                   0
330
Text6:
331
           db                   "         0123456789"
332
           db                   0
333
Text7:
334
           db                   2,3,4,11,12,13,14,18,24,25,26,27,232,233,235,187,188,138,134,135,129,128,1,6,7,8,9,10,29,31
335
           db                   0
336
Lineu:
337
           db                   201,205,205,205,205,205,205,205,205,205,205,205,205,205,205,205,205,205,205,205,205,205,205,205,205,205,205,205,205,205,205,187
338
           db                   0
339
Lined:
340
           db                   200,205,205,205,205,205,205,205,205,205,205,205,205,205,205,205,205,205,205,205,205,205,205,205,205,205,205,205,205,205,205,188
341
           db                   0
342
 
343
Column:
344
           db                   186
345
           db                   "                              "
346
           db                   186
347
           db                   0
348
lcdtxt:
349
           db                   "   Z80 SYSTEM   "
350
           db                   " RONIVON  COSTA "
351
           db                   0
352
DE1_Version:
353
           db                   "DE1 Version"
354
           db                   0
355
S3E_Version:
356
           db                   "S3E Version"
357
           db                   0

powered by: WebSVN 2.1.0

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