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

Subversion Repositories socgen

[/] [socgen/] [trunk/] [Projects/] [opencores.org/] [Mos6502/] [sw/] [kim_2/] [kim_2.asm] - Blame information for rev 133

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

Line No. Rev Author Line
1 131 jt_eaton
 
2
 
3
          include  ../io_module/io_module.asm
4
 
5
 
6
 
7
 
8
 
9
str_1          = $c000
10
top            = $c010
11
 
12
 
13
                 * = $10
14
inl            db  0            ;
15
inh            db  0            ;
16
pointl         db  0            ;
17
pointh         db  0            ;
18
chksum         db  0            ;
19
chkhi          db  0            ;
20
eal            db  0            ;
21
eah            db  0            ;
22
sbd            db  0            ;
23
 
24
 
25
 
26
             * = $f000  ; assemble start
27
               code
28
 
29
.start             jsr .init
30
                   ldx #$fe
31
.dloop             jsr .delay
32
                   dex
33
                   bne .dloop
34
                   jsr .crlf
35
                   ldx #$04
36
                   jsr .prtst
37
                   jmp .show1
38
 
39
.space             jsr .open
40
.show              jsr .crlf
41
.show1             jsr .prtpnt
42
                   jsr .outsp
43
                   ldy #$00
44
                   lda (pointl),y
45
                   sta io_base+io_gpio_0
46
                   jsr .prtbyt
47
                   jsr .outsp
48
                   jmp .clear
49
 
50
.clear             lda #$00
51
                   sta inl
52
                   sta inh
53
.read              jsr .getch
54
                   cmp #$0d
55
                   beq .scan
56
                   jsr .outch
57
                   jsr .pack
58
                   jmp .scan
59
 
60
.scan              cmp #$20
61
                   beq .space
62
                   cmp #$0d
63
                   beq .rtrn
64
                   cmp #$2f
65
                   beq .feed
66
                   cmp #$2e
67
                   beq .modify
68
                   cmp #$51
69
                   beq .dumpv
70
                   cmp #$4C
71
                   beq .loadv
72
 
73
                   jmp .read
74
 
75
.rtrn              jsr .incpt
76
                   jmp .show
77
 
78
 
79
.dumpv             jmp .dump
80
.loadv             jmp .load
81
 
82
.feed              sec
83
                   lda  pointl
84
                   sbc #$01
85
                   sta  pointl
86
                   bcs .feed1
87
                   dec  pointh
88
.feed1             jmp .show
89
 
90
 
91
 
92
.modify            ldy #$00
93
                   lda inl
94
                   sta (pointl),y
95
                   jmp .rtrn
96
 
97
 
98
 
99
 
100
.load              jsr .getch
101
                   cmp #$3b
102
                   bne .load
103
.loads             lda #$00
104
                   sta chksum
105
                   sta chkhi
106
                   jsr .getbyt
107
                   tax
108
                   jsr .chk
109
                   jsr .getbyt
110
                   sta pointh
111
                   jsr .chk
112
                   jsr .getbyt
113
                   sta pointl
114
                   jsr .chk
115
                   txa
116
                   beq .load3
117
.load2            jsr .getbyt
118
                  sta (pointl),y
119
                  jsr .chk
120
                  jsr .incpt
121
                  dex
122
                  bne .load2
123
                  inx
124
.load3            jsr .getbyt
125
                  cmp chkhi
126
                  bne .loade1
127
                  jsr .getbyt
128
                  cmp chksum
129
                 bne .loader
130
                 txa
131
                 bne .load
132
.load7           ldx #$0c
133
.load8           lda #$27
134
                 sta sbd
135
                 jsr .prtst
136
                 jmp .start
137
.loade1          jsr .getbyt
138
.loader          ldx #$11
139
                 bne .load8
140
 
141
 
142
 
143
 
144
 
145
 
146
 
147
 
148
.dump               clc
149
                    lda inl
150
                    adc pointl
151
                    sta eal
152
                    lda inh
153
                    adc pointh
154
                    sta eah
155
 
156
                    lda #$00
157
                    sta inl
158
                    sta inh
159
.dump0              lda #$00
160
                    sta chkhi
161
                    sta chksum
162
.dump1              jsr .crlf
163
 
164
                    lda pointl
165
                    cmp eal
166
                    lda pointh
167
                    sbc eah
168
                    bcc .dump4
169
 
170
                    jsr .crlf
171
 
172
                    jmp .clear
173
 
174
 
175
 
176
.dump4              lda #$10
177
                    tax
178
                    jsr .prtpnt
179
                    jsr .outsp
180
                    jsr .outsp
181
 
182
.dump2              ldy #$00
183
                    lda (pointl),y
184
                    sta io_base+io_gpio_0
185
                    jsr .prtbyt
186
                    jsr .outsp
187
 
188
                    jsr .incpt
189
                    dex
190
                    bne .dump2
191
 
192
                    inc inl
193
                    bne .dump3
194
                    inc inh
195
.dump3              jmp .dump0
196
 
197
 
198
 
199
 
200
 
201
 
202
 
203
 
204
 
205
 
206
.prtpnt           lda  pointh
207
                  jsr .prtbyt
208
                  jsr .chk
209
                  lda  pointl
210
                  jsr .prtbyt
211
                  jsr .chk
212
                  rts
213
 
214
 
215
 
216
.chk              clc
217
                  adc chksum
218
                  lda chkhi
219
                  adc #$00
220
                  sta chkhi
221
                  rts
222
 
223
 
224
 
225
 
226
.crlf             ldx #$01
227
.prtst            lda top,x
228
                  jsr .outch
229
                  dex
230
                  bpl .prtst
231
.prt1             rts
232
 
233
 
234
 
235
 
236
.incpt             inc pointl
237
                   bne .incpt2
238
                   inc pointh
239
.incpt2            rts
240
 
241
 
242
 
243
 
244
.getch             lda io_base+io_pic_int
245
                   and #$04
246
                   beq .getch
247
                   lda io_base+io_uart_rcv
248
                   rts
249
 
250
 
251
 
252
.getbyt            jsr   .getch
253
                   jsr   .pack
254
                   jsr   .getch
255
                   jsr   .pack
256
                   lda    inl
257
                   rts
258
 
259
 
260
 
261
 
262
.pack              cmp #$30
263
                   bmi .updat2
264
                   cmp #$47
265
                   bpl .updat2
266
.hexnum            cmp #$40
267
                   bmi .update
268
.hexalp            clc
269
                   adc #$09
270
.update            rol a
271
                   rol a
272
                   rol a
273
                   rol a
274
                   ldy #$04
275
.updat1            rol a
276
                   rol inl
277
                   rol inh
278
                   dey
279
                   bne .updat1
280
                   lda #$00
281
.updat2            rts
282
 
283
 
284
.open              lda inl
285
                   sta pointl
286
                   lda inh
287
                   sta pointh
288
                   rts
289
 
290
 
291
 
292
.init              lda #$c0
293
                   sta io_base+io_uart_cnt
294
                   ldx #$00
295
                   ldy #$00
296
                   lda #$fa
297
                   sta pointl
298
                   lda #$ff
299
                   sta pointh
300
                   lda #$00
301
                   sta eal
302
                   sta eah
303
                   rts
304
 
305
 
306
 
307
 
308
.outsp             lda #$20
309
.outch             pha
310
.outchl            lda io_base+io_pic_int
311
                   and #$08
312
                   beq .outchl
313
                   pla
314
                   sta io_base+io_uart_xmt
315
                   rts
316
 
317
 
318
 
319
.prtbyt            pha
320
                   lsr a
321
                   lsr a
322
                   lsr a
323
                   lsr a
324
                   jsr  .hexta
325
                   pla
326
.hexta             and #$0f
327
                   cmp #$0a
328
                   clc
329
                   bmi .hexta1
330
                   adc #$07
331
.hexta1            adc #$30
332
                   jmp .outch
333
 
334
 
335
 
336
 
337
.delay             lda #$ff
338
                   clc
339
                   adc #$01
340
                   bne .delay
341
                   rts
342
 
343
 
344
 
345
.irq_vec           pha
346
                   pla
347
                   rti
348
 
349
.nmi_vec           pha
350
                   pla
351
                   rti
352
 
353
 
354
             * = $fffa  ; vectors
355
 
356
 
357
     dw .nmi_vec               ;
358
     dw .start                 ;
359
     dw .irq_vec               ;
360
 
361
 code
362
 
363
 
364
 
365
 
366
 
367
 

powered by: WebSVN 2.1.0

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