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

Subversion Repositories z80soc

[/] [z80soc/] [branches/] [RonivonCosta/] [S3E/] [rom/] [SoC_PS2.z8a] - Blame information for rev 18

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

Line No. Rev Author Line
1 18 rrred
 
2
           ld          sp,7FFFh          ; Put Stack on top of memory
3
inicio:
4
           ld          a,0AAh
5
           out         (01h),a
6
           ld          hl,3FE0h
7
           ld          de,lcdtxt
8
           call        printmsg
9
           call        clear
10
           ld          hl,2032h
11
           ld          de,Text1
12
           call        printmsg
13
           ;call        read_key0
14
           ld          hl,205Ah
15
           ld          de,Text2
16
           call        printmsg
17
           ;call        read_key0
18
           call        Border
19
           ;call        read_key0
20
           ld          hl,2146h
21
           ld          de,Text3
22
           call        printmsg
23
           ;call        read_key0
24
           ld          hl,2196h
25
           ld          de,Text4
26
           call        printmsg
27
           ;call        read_key0
28
           ld          hl,21E6h
29
           ld          de,Text5
30
           call        printmsg
31
           ;call        read_key0
32
           ld          hl,236h
33
           ld          de,Text6
34
           call        printmsg
35
           ;call        read_key0
36
           ld          hl,225Eh
37
           ld          de,Text7
38
           call        printmsg
39
           ;call        read_key0
40
setDelay:
41
 
42
           in a,(20h)           ; Read SW(7-0)
43
           ld (7E00h),a         ; Stores delay multiplier
44
                                ; to be used in Delay routine
45
                                ; This value it is set only when
46
                                ; Z80 is reset
47
 
48
 
49
setprint:
50
           ld          de,8918
51
           ld          b,30
52
loopprint:
53
           call        read_kbd
54
           cp          41h
55
           jr          z,go_on
56
           out         (01h),a
57
           ld          (de),a
58
           inc         de
59
           djnz        loopprint
60
           jr          setprint
61
go_on:
62
           ld hl,4000h          ; RAM Address
63
           ld a,0               ; Value to store in memory
64
loop1:
65
           ld (hl),a            ; Store A into Memory (HL)
66
           inc hl               ; Point to next memory location
67
           inc a                ; Add 1 to value to store in memory
68
           jr nz,loop1          ; If A not equal 0 continue loop1
69
                                ; When A=FFh, and we make A=A+1 ...
70
                                ; A becomes 100h
71
                                ; But, A is an 8 bits register, and
72
                                ; can only store the two last hex digits,
73
                                ; that is, 8 bits.
74
           ld          a,1
75
           out         (01h),a
76
           call        delay
77
           call        delay
78
           call        delay
79
           call        read_key0       ; Wait until KEY0 is pressed
80
           call        delay
81
           call        read_key0
82
                                ;
83
           ld hl,4000h          ; Get back the start RAM address
84
loop2:
85
           ld a,(hl)            ; Read back the values stored in loop1
86
           out (01h),a          ; Send to Green Leds
87
           call delay           ; Call sub-routine to delay some time
88
           inc hl               ; Add 1 to the memory location
89
           ld a,(hl)            ; Read the value in the memory
90
           cp 0FFh               ; check if equal 255
91
           jr nz,loop2          ; If not equal 255, continue loop2
92
                                ; end of First execution
93
           ld a,00h             ;
94
           out (01h),a          ; Turn off leds
95
           call read_key0       ; Wait until KEY0 is pressed
96
           jP inicio            ; Restart program
97
read_key0:
98
loop3:
99
           call delay
100
           in a,(30h)           ; Read KEYs (all 4 KEYs)
101
           out (01h),a
102
           cp 01h               ; check if returns "00001110"
103
           jr nz,loop3          ; KEY0 not pressed, continue checking
104
           ret
105
iodelay:
106
           ld a,(7E00h)         ; Read the number of times to loop
107
loop4:
108
           dec a                ; Start counting backwards
109
           jr nz,loop4          ; If A greather than 0, continue loop
110
           ret                  ; return to calling program
111
delay:
112
           ld a,(7E00h)         ; Read the delay mulpitplier
113
loop5:
114
           PUSH af
115
           ld a,ffh             ; Every delay has at least 255 loops
116
loop6:
117
           dec a                ; Start counting backwards
118
           jr nz,loop6          ; If A greather than 0, continue loop
119
           pop af               ; Get multiplier back
120
           dec a                ;
121
           jr nz,loop5
122
           ret                  ; return to calling program
123
clear:
124
        ld      hl,2000h
125
        ld      de,1200
126
clean_loop:
127
        ld      a,20h
128
        ld      (hl),a
129
        inc     hl
130
        dec     de
131
        ld      a,d
132
        or      e
133
        jr      nz,clean_loop
134
        ret
135
printmsg:
136
 
137
ploop:
138
 
139
        ld      a,(de)
140
        or      a
141
        ret     z
142
        ld      (hl),a
143
        inc     hl
144
        inc     de
145
        jr      ploop
146
read_kbd:
147
         call   delay
148
         in     a,(80h)
149
         or     a
150
         jr     z,read_kbd
151
         ret
152
Border:
153
           ld        de,Lineu
154
           ld        hl,20F5h
155
           call      printmsg
156
           ld        hl,211Dh
157
           ld        a,10
158
brdloop:
159
           ld        de,Column
160
           push      af
161
           push      hl
162
           call      printmsg
163
           pop       hl
164
           pop       af
165
           ld        bc,40
166
           add       hl,bc
167
           dec       a
168
           jr        nz,brdloop
169
           ld        de,Lined
170
           call      printmsg
171
           ret
172
Text1:
173
           db                   "Z80 SYSTEM ON CHIP"
174
           db                   0
175
Text2:
176
           db                   "RONIVON COSTA 2008"
177
           db                   0
178
Text3:
179
           db                   "  |!#$%&/()=?*`+´ç~^,.;:\<>"
180
           db                   0
181
Text4:
182
           db                   "  ABCDEFGHIJKLMNOPQRSTUVWXYZ"
183
           db                   0
184
Text5:
185
           db                   "  abcdefghijklmnopqrstuvwxyz"
186
           db                   0
187
Text6:
188
           db                   "         0123456789"
189
           db                   0
190
Text7:
191
           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
192
           db                   0
193
Lineu:
194
           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
195
           db                   0
196
Lined:
197
           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
198
           db                   0
199
 
200
Column:
201
           db                   186
202
           db                   "                              "
203
           db                   186
204
           db                   0
205
lcdtxt:
206
           db                   "   Z80 SYSTEM   "
207
           db                   " RONIVON  COSTA "
208
           db                   0

powered by: WebSVN 2.1.0

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