Subversion Repositories NedoOS

Rev

Rev 8 | Details | Compare with Previous | Last modification | View Log

Rev Author Line No. Line
8 dimkam 1
on_int
2
        push af
3
        push bc
4
        push de
5
        push hl
6
        push ix
7
        push iy
8
        ex af,af'
9
        push af
10
        ld a,(_frameready)
11
        or a
12
        jr z,on_int_notready
13
	ld hl,(_readyattrbuf) ;_attrbuf
14
	ld de,0x5800
15
	ld bc,768
16
	ldir
17
        xor a
18
        ld (_frameready),a
19
on_int_notready
20
        call PLAY
21
	ld hl,(_timer)
22
	inc hl
23
	ld (_timer),hl
24
        pop af
25
        ex af,af'
26
        pop iy
27
        pop ix
28
        pop hl
29
        pop de
30
        pop bc
31
        pop af
32
        ei
33
        ret
34
 
35
border
36
border.A.=$+1
37
        ld a,0
38
        out (0xfe),a
39
        ret
40
 
41
halter
42
        halt
43
        ret
44
 
45
random
46
seed=$+1
47
        ld hl,0x0564;0x0562
48
        ld bc,0x0305
49
        add hl,bc
50
        ld a,(hl)
51
        inc h
52
        rrca
53
        rrca
54
        rrca
55
        rrca
56
        xor (hl)
57
        inc h
58
        rrca
59
        xor (hl)
60
        res 5,h
61
        ld (seed),hl
62
        ret
63
 
64
pokenet
65
pokenet.A.=$+2 ;row
66
pokenet.B.=$+1 ;col
67
        ld hl,0
68
        ld bc,_netaddr
69
        add hl,bc
70
pokenet.C.=$+1 ;data
71
        ld (hl),0
72
        ret
73
 
74
peeknet
75
peeknet.A.=$+2 ;row
76
peeknet.B.=$+1 ;col
77
        ld hl,0
78
        ld bc,_netaddr
79
        add hl,bc
80
        ld a,(hl)
81
        ret
82
 
83
pokenetcolor
84
pokenetcolor.A.=$+2 ;row
85
pokenetcolor.B.=$+1 ;col
86
        ld hl,0
87
        ld bc,_netcoloraddr
88
        add hl,bc
89
pokenetcolor.C.=$+1 ;data
90
        ld (hl),0
91
        ret
92
 
93
peeknetcolor
94
peeknetcolor.A.=$+2 ;row
95
peeknetcolor.B.=$+1 ;col
96
        ld hl,0
97
        ld bc,_netcoloraddr
98
        add hl,bc
99
        ld a,(hl)
100
        ret
101
 
102
prch
103
prch.A.=$+1 ;addr
104
        ld de,0
105
prch.B.=$+1 ;ch
106
        ld hl,0
107
	ld bc,font;-32
108
	add hl,bc
109
        ;add a,a
110
        ;ld l,a
111
        ;ld h,15
112
        ;add hl,hl
113
        ;add hl,hl
114
        ld b,8
115
prch0.
116
        ld a,(hl)
117
        ;rrca
118
        ;or (hl)
119
        ld (de),a
120
        inc h;l
121
        inc d
122
        djnz prch0.
123
        ret
124
 
125
;юяЁхфхы хь ЎтхЄ ш фтшурхь _row (_col)
126
;хёыш hgt==_curhgt, Єю яюы ш _row++ (_col--)
127
;хёыш hgt>_curhgt, Єю ёЄхэр
128
;хёыш hgt<_curhgt, Єю _row++ (_col--) ш ъЁєЄшьё 
129
;_row,_col єърч√тр■Є эр Єю, ўЄю ь√ тшфшь т ¤Єющ ъыхЄъх, шыш эр  ьє
130
;c=rowstep
131
;b=curcolor
132
;a=curhgt
133
;hl=rowcol
134
testcube.crosscolnc
135
;curhgt > hgt ; ьр
136
        inc h;row
137
	dec c ;rowstep=TRUE
138
testcube.crossrow
139
;\ - яхЁхёхўхэшх _row, фры№°х шф╕ь яю _col
140
;rowstep == TRUE
141
        cp (hl);hgt
142
;curhgt <= hgt ;ёЄхэр яхЁхёхўхэшх row
143
	LD b,_clRed ;curcolor
144
	ret z
145
	ret c
146
;curhgt > hgt ; ьр
147
        dec l;col
148
	inc c ;rowstep=FALSE
149
        dec a;d;curhgt
150
	;JP testcube.crosscol
151
testcube_s
152
;backslash==FALSE
153
	;inc c;SUB c;[_rowstep.]
154
	;dec c
155
	;ret nz ;ў╕ЄэюёЄ№ эх ёююЄтхЄёЄтєхЄ, Єръ ўЄю уЁрэшЎ√ эх сєфхЄ
156
testcube.crosscol
157
;/ - яхЁхёхўхэшх _col, фры№°х шф╕ь яю _row
158
;rowstep == FALSE
159
	cp (hl);hgt
160
	jr NZ,testcube.crosscolnz
161
;curhgt == hgt ;яюы (Єюы№ъю яЁш яЁртшы№эющ ў╕ЄэюёЄш!)
162
        set 7,l
163
        ld b,(hl);curcolor
164
        res 7,l
165
        inc h;row
166
	dec c ;rowstep=TRUE
167
	ret
168
testcube.crosscolnz
169
	jr NC,testcube.crosscolnc
170
;curhgt < hgt ;ёЄхэр яхЁхёхўхэшх _col
171
        inc a;d;curhgt ;ЄхяхЁ№ ў╕ЄэюёЄ№ _rowstep эх ёююЄтхЄёЄтєхЄ _backslash!
172
	LD b,_clBlue ;curcolor
173
        ret
174
 
175
testcube_bs.crossrownc
176
;curhgt > hgt ; ьр
177
        dec l;col
178
	inc c ;rowstep=FALSE
179
testcube_bs.crosscol
180
;/ - яхЁхёхўхэшх _col, фры№°х шф╕ь яю _row
181
;rowstep == FALSE
182
	cp (hl);hgt
183
;curhgt <= hgt ;ёЄхэр яхЁхёхўхэшх _col
184
	LD b,_clBlue ;curcolor
185
	ret z
186
	ret c
187
;testcube_bs.ba
188
;curhgt > hgt ; ьр
189
        inc h;row
190
	dec c ;rowstep=TRUE
191
        dec a;d;curhgt
192
	;JP testcube_bs.crossrow
193
testcube_bs
194
;backslash==TRUE
195
	;inc c;SUB c;[_rowstep.]
196
	;dec c
197
	;ret z ;ў╕ЄэюёЄ№ эх ёююЄтхЄёЄтєхЄ, Єръ ўЄю уЁрэшЎ√ эх сєфхЄ
198
testcube_bs.crossrow
199
;\ - яхЁхёхўхэшх _row, фры№°х шф╕ь яю _col
200
;rowstep == TRUE
201
        cp (hl);hgt
202
	jr NZ,testcube_bs.crossrownz
203
;curhgt == hgt ;яюы (Єюы№ъю яЁш яЁртшы№эющ ў╕ЄэюёЄш!)
204
        set 7,l
205
        ld b,(hl);curcolor
206
        res 7,l
207
        dec l;col
208
	inc c ;rowstep=FALSE
209
	ret
210
testcube_bs.crossrownz
211
	jr NC,testcube_bs.crossrownc
212
;curhgt < hgt ;ёЄхэр яхЁхёхўхэшх row
213
        inc a;d;curhgt ;ЄхяхЁ№ ў╕ЄэюёЄ№ _rowstep эх ёююЄтхЄёЄтєхЄ _backslash!
214
	LD b,_clRed ;curcolor
215
	ret
216
 
217
cubecolumn
218
;lx=y
219
;hx=oldcolor
220
;b=curcolor
221
;c=rowstep
222
;hl=rowcol
223
;de=addr
224
        ld hl,(_col)
225
        ld a,(_row)
226
        add a,_netaddr>>8
227
        ld h,a
228
	;ld hx,0x07;oldcolor
229
	ld b,0x07;curcolor
230
	LD A,[_addr]
231
	AND 0x02
232
	JR Z,cubecolumn_bs.
233
	LD c,0;[_rowstep],A
234
	xor a ;curhgt
235
	LD lx,+(_hgt-_scrhgt)/2 ;y
236
cubecolumn0
237
	inc c
238
	dec c
239
	CALL z,testcube_s
240
	LD hx,b;oldcolor=curcolor
241
	inc c
242
	dec c
243
	CALL nz,testcube_bs
244
	LD hx,b;oldcolor=curcolor
245
	dec lx ;y
246
	JP NZ,cubecolumn0
247
	LD de,[_addr]
248
	LD lx,_scrhgt/2 ;y
249
cubecolumn1
250
	inc c
251
	dec c
252
	CALL z,testcube_s
253
	ex af,af'
254
	LD A,b;[_curcolor]
255
	add a,a
256
	add a,a
257
	add a,a
258
	ADD A,hx;oldcolor
259
	LD [de],A
260
	inc e
261
	LD [de],A
262
        res 5,e
263
	LD hx,b;oldcolor=curcolor
264
	ex af,af'
265
	inc c
266
	dec c
267
	CALL nz,testcube_bs
268
	ex af,af'
269
	LD A,b;[_curcolor]
270
	add a,a
271
	add a,a
272
	add a,a
273
	ADD A,hx;oldcolor
274
	LD [de],A
275
	dec e
276
	LD [de],A
277
	ld a,e
278
	sub 0x20
279
	ld e,a
280
	jr nc,$+3
281
	dec d
282
	LD hx,b;oldcolor=curcolor
283
	ex af,af'
284
	dec lx ;y
285
	JP NZ,cubecolumn1
286
	RET 
287
 
288
cubecolumn_bs.
289
	LD c,0xff;[_rowstep],A
290
	xor a ;curhgt
291
	LD lx,+(_hgt-_scrhgt)/2 ;y
292
cubecolumn_bs0
293
	inc c
294
	dec c
295
	CALL nz,testcube_bs
296
	LD hx,b;oldcolor=curcolor
297
	inc c
298
	dec c
299
	CALL z,testcube_s
300
	LD hx,b;oldcolor=curcolor
301
	dec lx ;y
302
	JP NZ,cubecolumn_bs0
303
	LD de,[_addr]
304
	LD lx,_scrhgt/2 ;y
305
cubecolumn_bs1
306
	inc c
307
	dec c
308
	CALL nz,testcube_bs
309
	ex af,af'
310
	LD A,b;[_curcolor]
311
	add a,a
312
	add a,a
313
	add a,a
314
	ADD A,hx;oldcolor
315
	LD [de],A
316
	inc e
317
	LD [de],A
318
        res 5,e
319
	LD hx,b;oldcolor=curcolor
320
	ex af,af'
321
	inc c
322
	dec c
323
	CALL z,testcube_s
324
	ex af,af'
325
	LD A,b;[_curcolor]
326
	add a,a
327
	add a,a
328
	add a,a
329
	ADD A,hx;oldcolor
330
	LD [de],A
331
	dec e
332
	LD [de],A
333
	ld a,e
334
	sub 0x20
335
	ld e,a
336
	jr nc,$+3
337
	dec d
338
	LD hx,b;oldcolor=curcolor
339
	ex af,af'
340
	dec lx ;y
341
	JP NZ,cubecolumn_bs1
342
	RET 
343
 
344
getayreg
345
getayreg.A.=$+1
346
	ld a,0x00
347
getayrega.
348
	ld bc,0xfffd
349
	out (c),a
350
	in a,(c)
351
	ret
352
 
353
jumpay
354
jumpay.A.=$+1
355
jumpay.tonereg=$+1
356
	LD A,0
357
	CALL getayrega.
358
	LD L,A
359
	LD A,[jumpay.tonereg]
360
	inc a
361
	CALL getayrega.
362
	LD h,A
363
	push hl;LD [jumpay.frq],hl
364
	LD A,0x07 ;tone/noise mask reg
365
	CALL getayrega.
366
	cpl
367
jumpay.C.=$+1
368
jumpay.mask=$+1
369
	AND 0
370
	JP Z,jumpay.e. ;both masked
371
jumpay.B.=$+1
372
jumpay.volreg=$+1
373
	LD A,0
374
	CALL getayrega.
375
	LD lx,A
376
	cp 0x10
377
	JP C,jumpay.g.
378
	LD lx,0x04
379
	JP jumpay.h.
380
jumpay.g.
381
	cp 0x0f
382
	JP NZ,jumpay.i.
383
	LD lx,0x06
384
	JP jumpay.j.
385
jumpay.i.
386
	cp 0x0e
387
	JP NZ,jumpay.k.
388
	LD lx,0x05
389
	JP jumpay.l.
390
jumpay.k.
391
	cp 0x0d
392
	JP NZ,jumpay.m.
393
	LD lx,0x04
394
	JP jumpay.n.
395
jumpay.m.
396
	cp 0x0c
397
	JP NZ,jumpay.o.
398
	LD lx,0x03
399
	JP jumpay.p.
400
jumpay.o.
401
	cp 0x0b
402
	JP NZ,jumpay.q.
403
	LD lx,0x02
404
	JP jumpay.r.
405
jumpay.q.
406
	cp 0x09
407
	JP C,jumpay.s.
408
	LD lx,0x01
409
	JP jumpay.t.
410
jumpay.s.
411
	LD lx,0x00
412
jumpay.t.
413
jumpay.r.
414
jumpay.p.
415
jumpay.n.
416
jumpay.l.
417
jumpay.j.
418
jumpay.h.
419
	JP jumpay.f.
420
jumpay.e.
421
	LD lx,0x00
422
jumpay.f.
423
	;LD A,[jumpay.volreg]
424
	;SUB 0x09
425
	;JP Z,jumpay.u.
426
	LD A,lx
427
	ADD A,a
428
	LD lx,A
429
jumpay.u.
430
	pop hl;LD HL,[jumpay.frq]
431
	LD DE,8
432
	ADD HL,DE
433
	;LD [jumpay.frq],HL
434
	;LD A,0x02
435
	LD hx,0x02;[jumpay.y],A
436
	;LD HL,[jumpay.frq]
437
jumpay.w.
438
	LD DE,1000
439
	LD A,L
440
	SUB E
441
	LD A,H
442
	SBC A,D
443
	JP NC,jumpay.x.
444
        ld d,h
445
        ld e,l
446
        srl d
447
        rr e
448
        srl d
449
        rr e
450
	ADD HL,DE
451
	;LD HL,jumpay.y
452
	;INC [HL]
453
        inc hx;y
454
	JP jumpay.w.
455
jumpay.x.
456
	LD A,[jumpay.volreg]
457
	SUB 0x08
458
	JP NZ,jumpay.y.
459
	LD A,hx;[jumpay.y]
460
        srl a
461
        srl a
462
	LD L,A
463
	LD H,0
464
	XOR A
465
	SUB L
466
	LD L,A
467
	SBC A,H
468
	SUB L
469
	LD H,A
470
	LD [jumpay.x],HL
471
	JP jumpay.ba.
472
jumpay.y.
473
	LD A,[jumpay.volreg]
474
	SUB 0x0a
475
	JP NZ,jumpay.bb.
476
	LD A,hx;[jumpay.y]
477
        srl a
478
        srl a
479
	LD L,A
480
	LD H,0
481
	LD [jumpay.x],HL
482
	JP jumpay.bc.
483
jumpay.bb.
484
	LD HL,-0
485
	LD [jumpay.x],HL
486
jumpay.bc.
487
jumpay.ba.
488
	LD a,[jumpay.x]
489
	add a,hx;[jumpay.y]
490
	LD [_row],A
491
	LD E,hx;y
492
	LD D,0
493
	LD BC,[jumpay.x]
494
	LD A,E
495
	SUB C
496
	LD E,A
497
	LD A,D
498
	SBC A,B
499
	LD D,A
500
	LD A,0x19
501
	SUB E
502
	LD [_col],A
503
	LD [peeknet.B.],A
504
	LD A,[_row]
505
	LD [peeknet.A.],A
506
	CALL peeknet
507
	SUB lx
508
	ret nc
509
	LD A,[_row]
510
	LD [pokenet.A.],A
511
	LD A,[_col]
512
	ADD A,0x40
513
	LD [pokenet.B.],A
514
	LD A,lx
515
	LD [pokenet.C.],A
516
	jp pokenet
517
jumpay.x
518
        dw 0
519
 
520
decay
521
;ёярфхэшх рэрышчрЄюЁр 80000 ЄръЄют (+ эшцх ъюяшЁютрэшх)
522
;ьюцэю єёъюЁшЄ№ т 2 Ёрчр, яюЄюьє ўЄю яюыютшэр эх яюярфрхЄ т ¤ъЁрэ (эю ёыюцэр  ЇюЁьр)
523
	ld h,0x01+(_netaddr>>8)
524
	ld c,0x15
525
decay0
526
	ld l,0x41
527
        ld d,h
528
        ld e,l
529
        set 7,e
530
	ld b,0x19
531
decay00
532
	ld a,(hl)
533
	inc a
534
	inc h
535
	cp (hl)
536
	dec h
537
	jr C,decaypoke ;up
538
	dec l
539
	cp (hl)
540
	inc l
541
	jr C,decaypoke ;up
542
	dec h
543
	cp (hl)
544
	inc h
545
	jr C,decaypoke ;up
546
	inc l
547
	cp (hl)
548
	dec l
549
	jr C,decaypoke ;up
550
        dec a
551
	jr Z,decaypoke ;as is
552
	dec a ;decay
553
decaypoke
554
	;set 7,l
555
        ;or a
556
        ;jr nz,$+3
557
        ;inc a
558
	ld (de),a
559
	;res 7,l
560
        inc e
561
	inc l
562
	djnz decay00
563
	inc h
564
	dec c
565
	jp nz,decay0
566
 
567
;ъюяшЁютрэшх 40000 ЄръЄют - ьюцэю єёъюЁшЄ№ т 2 Ёрчр, яюЄюьє ўЄю яюыютшэр эх яюярфрхЄ т ¤ъЁрэ (эю ёыюцэр  ЇюЁьр)
568
	ld h,0x01+(_netaddr>>8)
569
	ld hx,0x15
570
decaycopyback0
571
	ld l,0x41
572
	ld d,h
573
	ld e,l
574
	set 7,l
575
	ld bc,0x19
576
	ldir
577
        ld l,0x41
578
        ld e,0x01
579
        ld bc,0x193f
580
decaycopyback00
581
        ld a,(hl)
582
        rra;sra a
583
        rra;sra a
584
        and c ;0x3f
585
        inc a
586
        ld (de),a
587
        inc l
588
        inc e
589
        djnz decaycopyback00
590
	inc h
591
	dec hx
592
	jp nz,decaycopyback0
593
	ret
594
 
595
clearnet
596
        ld hl,_netaddr
597
        ld d,h
598
        ld e,l
599
        inc de
600
        ld bc,0x15ff
601
        ld (hl),l;0
602
        ldir
603
        ret
604
 
605
drawcubetexture
606
        ;halt
607
        ;ld hl,0x5800
608
        ;ld d,h
609
        ;ld e,l
610
        ;inc de
611
        ;ld bc,0x2ff
612
        ;ld (hl),l;0
613
        ;ldir
614
        ld hl,0x4000
615
        ld d,h
616
        ld e,l
617
        inc de
618
        ld bc,0x17ff
619
        ld (hl),l;0
620
        ldir
621
	;LD HL,0x4000
622
	;LD [drawcubetexture.addr],HL
623
	LD hx,0x00 ;y
624
drawcubetexture.j.
625
	LD A,hx;[drawcubetexture.y]
626
	cp _scrhgt
627
	JP NC,drawcubetexture.k.
628
	LD a,hx ;y
629
        add a,a
630
        add a,a
631
        add a,a
632
        add a,a
633
        add a,a
634
	LD L,A
635
	LD A,0x18
636
	AND hx ;y
637
        add a,0x40
638
	LD H,A
639
	LD [drawcubetexture.addry],hl
640
	LD lx,0x00 ;x
641
drawcubetexture.l.
642
	LD A,lx;[drawcubetexture.x]
643
	SUB _wid
644
	JP NC,drawcubetexture.m.
645
drawcubetexture.addry=$+1
646
	LD HL,0
647
	;LD A,[drawcubetexture.x]
648
	LD E,lx ;x
649
	LD D,0
650
	ADD HL,DE
651
	LD b,0x08
652
	LD A,lx;[drawcubetexture.x]
653
        rra
654
	XOR hx;[drawcubetexture.y]
655
	rra
656
	JP c,drawcubetexture.n.
657
	LD de,0x0001
658
drawcubetexture.p.
659
	LD [hl],d
660
        inc l
661
	LD [HL],E
662
        dec l
663
        scf
664
        rl e
665
        rl d
666
        scf
667
        rl e
668
        rl d
669
        inc h
670
	djnz drawcubetexture.p.
671
drawcubetexture.q.
672
	JP drawcubetexture.o.
673
drawcubetexture.n.
674
	LD de,0x8000
675
drawcubetexture.r.
676
        ld (hl),d
677
        inc l
678
	LD [HL],E
679
        dec l
680
        scf
681
        rr d
682
        rr e
683
        scf
684
        rr d
685
        rr e
686
        inc h
687
	djnz drawcubetexture.r.
688
drawcubetexture.o.
689
	;LD A,[drawcubetexture.x]
690
	;ADD A,0x02
691
	;LD [drawcubetexture.x],A
692
        inc lx ;x
693
        inc lx ;x
694
	JP drawcubetexture.l.
695
drawcubetexture.m.
696
	;LD HL,drawcubetexture.y
697
	;INC [HL]
698
        inc hx ;y
699
	JP drawcubetexture.j.
700
drawcubetexture.k.
701
        ret