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

Subversion Repositories z80soc

[/] [z80soc/] [branches/] [RonivonCosta/] [ROM/] [SoC_PS2.z8a] - Blame information for rev 31

Details | Compare with Previous | View Log

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

powered by: WebSVN 2.1.0

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