-
Notifications
You must be signed in to change notification settings - Fork 0
/
misc.z80
1599 lines (1594 loc) · 17.4 KB
/
misc.z80
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
;Other options+
;Songlist Editor+
;Setup Routine+
;File erasing Routine
anz:
equ 14
font:
equ #d00
hadr:
equ #12c0
instab:
equ #4000
ornta:
equ #4060
snam:
equ #4b10
inams:
equ #4b18
patts:
equ #4ad0
higt:
equ #4ba0
sped:
equ #4bfb
loot:
equ #4bfc
leng:
equ #4bfd
heig:
equ #4bfe
panz:
equ #4bff
cls:
equ #8003
decz:
equ #8006
derr:
equ #800c
rjp:
equ #8010
loc:
equ #9000
chr:
equ #9005
text:
equ #9008
maus:
equ #900b
hex:
equ #900e
out:
equ #9011
noten:
equ #9014
cler:
equ #9017
taus:
equ #901a
sync:
equ #901d
swi:
equ #9020
wahl:
equ #9023
chos:
equ #9026
init:
equ #9029
stasi:
equ #902c
prins:
equ #902f
ddr:
equ #9032
pnam:
equ #9035
jupp:
equ #9038
sure:
equ #903b
maxi:
equ #903e
waitk:
equ #bb18
kbd:
equ #bb1b
atab:
equ #bef0
heli:
equ #c280
;
;ent #9002
org #2400
jp anal
jp oth
jp clg
jp nam
jp pedit
jp setup
jp font1
jp eras
jp help
jp lset
;Ab #241e Textzeiger
defw ented
defw arped
defw envne
oth:
call taus
ld hl,top+1
ld b,8
topl:
push bc
ld d,(hl)
inc hl
ld e,(hl)
inc hl
ld (loc),de
ld a,32
call chr
ld b,(hl)
inc hl
call nam1
ld a,32
call chr
inc hl
inc hl
pop bc
djnz topl
call cls
ld hl,(block)
ld de,top
ld (hl),e
inc hl
ld (hl),d
xor a
call init
dlop:
call sync
call kbd
cp #fc
jr z,die
call wahl
call z,chos
jr dlop
die:
ld hl,(block)
ld de,(menu)
ld (hl),e
inc hl
ld (hl),d
ld hl,#501
ld (loc),hl
ld hl,(mess1)
call text
call cls
ld a,8
call init
jp cler
sname:
ld hl,tuff
call text
call namin
cp #fc
jp z,cls
ld hl,name
ld de,snam
ld bc,8
ldir
call pnam
jp cls
iname:
call insin
cp #fc
jp z,cls
ld (ins),a
call namin
cp #fc
jp z,cls
ld a,(ins)
ld h,0
ld l,a
add hl,hl
add hl,hl
add hl,hl
ld de,inams
add hl,de
ex de,hl
ld hl,name
ld bc,8
ldir
warte:
ld hl,pres
call text
call cler
call waitk
jp cls
copi:
call insin
cp #fc
jp z,cls
ld (ins),a
call desti
cp #fc
jp z,cls
ld (ins1),a
ld b,a
ld a,(ins)
cp b
jp z,cls
call rech
push hl
pop ix
ld a,(ins1)
call rech
push hl
pop iy
ld l,(ix+2)
ld h,(ix+3)
ld e,(iy+2)
ld d,(iy+3)
ld bc,130
ldir
jp warte
clri:
call insin
cp #fc
jp z,cls
call rech
ld b,130
inc hl
inc hl
call clir
jp warte
clir:
ld e,(hl)
inc hl
ld d,(hl)
inc hl
ex de,hl
clix:
ld (hl),0
inc hl
djnz clix
ret
copo:
call ornin
cp #fc
jp z,cls
ld (ins),a
call desti
cp #fc
jp z,cls
ld (ins1),a
ld b,a
ld a,(ins)
cp b
jp z,cls
ld a,(ins)
call rech1
push hl
ld a,(ins1)
call rech1
ex de,hl
pop hl
ld bc,32
ldir
jp warte
clro:
call ornin
cp #fc
jp z,cls
call rech1
ld b,32
call clix
jp warte
desti:
ld hl,copt
jr input
insin:
ld hl,meld1
jr input
ornin:
ld hl,meld2
input:
call text
call maus
inlop:
call sync
call kbd
cp #fc
ret z
jr nc,inlop
cp 48
jr c,inlop
cp #3b
jr c,otto
res 5,a
cp "A"
jr c,inlop
cp "G"
jr nc,inlop
sub 7
otto:
sub 48
push af
call out
pop af
ret
namin:
ld hl,namt
call text
call maus
ld b,8
ld ix,name
nam:
ld a,b
ld (del+2),a
call nclr
namlo:
push bc
call kbd
pop bc
jr nc,namlo
cp #fc
ret z
cp 13
jr z,nend
cp 127
call z,del
cp 45
jr z,wix
cp 46
jr z,wix
cp "0"
jr c,namlo
cp #3a
jr c,wix
res 5,a
cp "A"
jr c,namlo
cp "Z"+1
jr nc,namlo
wix:
ld c,a
ld a,b
or a
jr z,namlo
ld a,c
ld (ix),a
inc ix
push bc
call chr
call maus
pop bc
dec b
jp namlo
nend:
ld a,32
call chr
ret
del:
ld a,b
cp 8
jr z,nodel
inc b
dec ix
ld a,32
ld (ix),a
push bc
ld hl,(loc)
dec h
ld (loc),hl
call chr
ld a,32
call chr
ld hl,(loc)
dec h
dec h
ld (loc),hl
call maus
pop bc
nodel:
xor a
ret
nclr:
push ix
push bc
ncl1:
ld (ix),32
inc ix
djnz ncl1
pop bc
pop ix
ret
about:
ld hl,atex
call text
call cler
call waitk
jp cls
quit:
ld hl,qtex
call text
ld hl,#10c
call sure
jp nz,cls
di
ld bc,#7f89
out (c),c
rst 0
rech:
add a,a
ld b,a
add a,a
add a,b
ld d,0
ld e,a
ld hl,instab
add hl,de
ret
rech1:
add a,a
ld d,0
ld e,a
ld hl,ornta
add hl,de
ld e,(hl)
inc hl
ld d,(hl)
ex de,hl
ret
nam1:
ld a,(hl)
push hl
call chr
pop hl
inc hl
djnz nam1
ret
anal:
ld ix,(#b000)
call getvol
ld ix,(#b002)
call getvol
ld ix,(#b004)
call getvol
call clg
ld hl,#fa21
ld de,atab+1
ld b,anz
call loop
ld hl,atab
ld b,15
decl:
ld a,(hl)
or a
jr z,nodec
dec (hl)
nodec:
inc hl
djnz decl
ret
getvol:
ld e,(ix)
ld d,(ix+1)
ld a,(ix+9)
push af
ld bc,0
call ana1
ld hl,atab
ld b,0
add hl,bc
pop bc
ld a,(hl)
cp b
ret nc
ld (hl),b
ret
ana1:
ld ix,tonta
ld b,anz
anap:
ld l,(ix)
ld h,(ix+1)
and a
sbc hl,de
ret z
ret c
inc ix
inc ix
inc c
djnz anap
ret
loop:
ld a,(de)
or a
jr z,kiff
push bc
push de
push hl
ld de,-#800
ld bc,-#c050
loop2:
ld (hl),1
add hl,de
bit 6,h
jr nz,pyrk
add hl,bc
pyrk:
dec a
jr nz,loop2
pop hl
pop de
pop bc
kiff:
inc hl
inc de
djnz loop
ret
clg:
di
ld (sta),sp
ld hl,#c9d2+14
ld de,#f0f
ld bc,#800
ld a,15
clg1:
ld sp,hl
push de
push de
push de
push de
push de
push de
push de
push de
add hl,bc
jr nc,dea
ld bc,#c050
add hl,bc
ld bc,#800
dea:
dec a
jr nz,clg1
defb #31
sta:
defw 0
ei
ret
setup:
call cls
ld a,(maxp)
ld (oldm),a
ld hl,tex1
call text
call trans
ld hl,tex2
call text
call plen
ld hl,tex3
call text
call pal
setl:
call kbd
jr nc,setl
cp #fc
jr z,setx
cp #87
call z,decr
cp #88
call z,incr
cp #84
call z,subl
cp #85
call z,incl
cp #81
call z,pdn
cp #82
call z,pup
jr setl
setx:
ld a,(maxp)
ld hl,oldm
cp (hl)
call nz,korr
ld a,(leng)
ret
;
trans:
ld a,(heig)
jr tout
incr:
ld a,(heig)
cp 12
jr z,ente
inc a
jr tout
decr:
ld a,(heig)
cp -12
jr z,ente
dec a
tout:
ld (heig),a
ld b,"+"
cp 128
jr c,plus
ld b,"-"
ld c,a
xor a
sub c
plus:
push af
ld hl,#c09
ld (loc),hl
ld a,b
call chr
pop af
call decz
ente:
xor a
ret
;
plen:
ld a,(leng)
jr lout
incl:
ld a,(leng)
cp 80
ret z
add a,8
jr lout
subl:
ld a,(leng)
cp 16
ret z
sub 8
lout:
push af
ld hl,#f0b
ld (loc),hl
call decz
pop af
lou1:
ld (leng),a
srl a
srl a
srl a
sub 2
ld d,0
ld e,a
ld hl,pztb
add hl,de
ld a,(hl)
ld (maxp),a
ret
korr:
ld hl,patts
ld b,64
ld a,(maxp)
ld d,a
korl:
ld a,(hl)
cp d
jr c,koro
ld (hl),0
koro:
inc hl
djnz korl
kent:
ld a,(leng)
ld b,a
ld a,(maxp)
ld (max1),a
jp maxi
lset:
ld a,(leng)
call lou1
jr kent
;
pal:
ld a,(paln)
jr ppal
pup:
ld a,(paln)
cp 6
ret z
inc a
jr ppal
pdn:
ld a,(paln)
or a
ret z
dec a
ppal:
ld (paln),a
push af
ld hl,#a0d
ld (loc),hl
call decz
pop af
add a,a
add a,a
ld ix,palt
ld d,0
ld e,a
add ix,de
ld b,(ix)
ld c,b
push bc
call #bc38
pop bc
xor a
call #bc32
ld b,(ix+1)
ld c,b
ld a,1
call #bc32
ld b,(ix+2)
ld c,b
ld a,2
call #bc32
ld b,(ix+3)
ld c,b
ld a,3
call #bc32
xor a
ret
;
tx3:
ld b,3
ld a,(hl)
call chr
inc hl
djnz tx3+2
ret
;
eras:
ld hl,snam
ld de,kull
ld bc,8
ldir
call cls
ld hl,tex4
call text
call maus
call nami
jp cls
nami:
call cler
call #bb06
cp #fc
ret z
res 5,a
cp "S"
jr z,song
cp "E"
jr nz,nami
call chr
ld b,12
ld hl,#10b
ld ix,deln
call innam
cp #fc
ret z
ld a,12
sub b
jr dele
song:
call chr
ld hl,snam
ld de,deln
ld bc,8
ldir
ld hl,ext
ld bc,4
ldir
ld a,12
dele:
ld ix,para
ld (ix),a
ld hl,deln
ld a,(hl)
cp 32
jp z,cls
ld (ix+1),l
ld (ix+2),h
ld hl,para
ld ix,#af20
ld (ix),l
ld (ix+1),h
ld hl,#10d
call sure
call z,del1
jp cls
del1:
ld hl,del1
ld (rjp),hl
ld a,1
ld ix,#af20
call namo
rst #18
defw exec
call nc,derr
ret
namo:
push af
ld hl,meld
call text
ld a,(#a700)
add a,65
call chr
ld a,":"
call chr
ld l,(ix)
ld h,(ix+1)
ld b,(hl)
inc hl
ld e,(hl)
inc hl
ld d,(hl)
naml:
ld a,(de)
call chr
inc de
djnz naml
pop af
ret
;
help:
ld hl,(hadr)
plop:
ld a,(hl)
or a
ret z
cp 22
jr nz,char
inc hl
ld a,(hl)
ld (posi),a
inc hl
ld a,(hl)
ld (posi+1),a
inc hl
ld a,(hl)
char:
push hl
sub 32
ld h,0
ld l,a
add hl,hl
add hl,hl
add hl,hl
ld bc,font
add hl,bc
ld de,(posi)
ld b,8
ld c,b
zeich:
ld a,(hl)
ld (de),a
ld a,d
add a,c
ld d,a
inc hl
djnz zeich
ld hl,(posi)
inc hl
ld (posi),hl
and a
ld bc,#c7d0
sbc hl,bc
jr c,next
ld hl,#c000
ld (posi),hl
next:
pop hl
inc hl
jp plop
;
font1:
ld hl,#1c00
ld de,#200
ld bc,#5ff
push de
push bc
ldir
pop de
pop hl
fonl:
ld a,(hl)
rra
rra
rra
rra
or (hl)
ld (hl),a
inc hl
dec de
ld a,d
or e
jr nz,fonl
ret
;Name-Inputroutine:
;IX=Address of String
;HL=X/Y-Location
;B=Len.of String
innam:
ld (loc),hl
push ix
push bc
ld hl,tex5
call text
call maus
pop bc
pop ix
jp nam
;
pedit:
pop hl
push hl
inc hl
inc hl
ld de,ex1
ld bc,12
ldir
call cls
ld hl,tex
call text
xor a
ld (pos),a
ld (line),a
ld hl,patts
call bild
ld hl,patts
ld (adr1),hl
ld hl,higt
ld (adr2),hl
ld hl,0
ld (xpos),hl
call printe
lop:
call kbd
jr nc,lop
cp #fc
jr z,pend
cp 13
call z,send
cp 127
call z,null
cp #88
call z,inc1
cp #87
call z,dec1
cp #85
call z,inc2
cp #84
call z,dec2
cp #82
call z,inc3
cp #81
call z,dec3
cp 240
call z,up
cp 241
call z,down
cp 242
call z,left
cp 243
call z,rigt
cp 244
call z,adde
cp 245
call z,sube
cp 246
call z,delp
cp 247
call z,insp
jr lop
pend:
ld hl,(patn)
ld a,(hl)
call jupp
jp help
left:
ld a,(xpos)
or a
ret z
call era
ld a,(xpos)
ld b,a
dec a
ld (xpos),a
ld a,b