-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathedipro.z80
7934 lines (7120 loc) · 198 KB
/
edipro.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
;***************************************************************
;
; EDI-PRO V 1.56 : 13.01.94 RUMSOFT
;
; FINISH : 26.07.95
;
;
;***************************************************************
DUMP 11,0
DB 201
DW PRINTV
DB 11
DS 2
DW MAIN
DUMP 11,&3370
ORG &3370
; 1-2-3 WORKSPACE
; 4-5 CLIPBOARD
; 6-7 HELPPAGE
; 3-4-5 START FONTS 2
; 8-9-10 FONTY
; 11-12 KOD
; 13 hudba
; 14-15 SCR & CODE
; 16-17-18-19-20-21-22-23-24-25 TEXT PAGES
MAXT: EQU 6
VERSION: EQU 157
CLIP: EQU 4
GLOBAL: EQU 5
TEXTP: EQU 16
LENSTYL: EQU 16
PRR: EQU &17
PCOL: EQU &55
STARTSTYL: EQU &C7
TAB: EQU &9F
KURZOR: EQU &E006
SROLUP: EQU &E009
SROLDO: EQU &E00C
SETS: EQU &E012
KURZOR0: EQU &E015
INDEX: EQU &E018
BITMAP: EQU &E01F
PRAV: EQU &8500
BREAK: EQU &403C
LSTYLE: EQU LENSTYL*10
INFOL: EQU 64+160+60+80
PBUF: EQU &D400
BUFIK: EQU &2000
LISTA: EQU &F600
RULER: EQU LISTA+1536
MFLAG: EQU &27
CPS: EQU &34
cx: EQU &E024
cy: EQU cx+2
DISK: EQU &33
MAIN: IN A,(252)
LD (VMPR+1),A
CALL INIT
CALL LOGO
CALL NEWS
CALL OPEN
RESTQ: JP EDITOR
DM " RUMSOFT 94-95"
ZMENA: DB 0
AKTUAL: DB 1 ; AKTUALNY FILE
CLIPF: NOP
CLIPSIZE: DW 0
INCLIP: DW 0
INBUF: DW 0
;------------------------------------------------
CANCLINE:
LD HL,(ALINE)
PUSH HL
CALL NEXTL
POP DE
RET C ; KONIEC SUBORU
LD A,(HL)
AND A
SBC HL,DE
LD C,L
LD B,H
EX DE,HL
LD (ALINE),HL
EX AF,AF'
LD A,(HL)
CALL ISSTYL
JR NC,CANC2
EX AF,AF' ; CIEL MA STYL
CALL ISSTYL
JR C,CANC2
INC HL
DEC BC
CANC2: CALL ZRUS1
JP SKOC
INSLINE:
LD A,(FLAG)
PUSH AF
RES 0,A
LD (FLAG),A
CALL CUP
CALL ENDLINE
LD IX,(ADLZ)
CALL SETIY
CALL RETURN
POP AF
LD (FLAG),A
RET
REFORMAT:
XOR A
LD (CLIPF),A
LD HL,32768
LD D,CLIP
LD C,251
EXX
CALL SETHL
INC HL
PUSH HL ; SAVE START POS
CALL ROZLOZ
POP DE
XOR A
SBC HL,DE
LD BC,50
SBC HL,BC
ADD HL,BC
RET C ; RET AK MENEJ AKO 50 ZNAKOV
PUSH DE
PUSH HL ; SAVE LENGHT
CALL KEEP ; KEEP(0)
CALL REFORM ; PREFORMATUJ ; HL = NEW LEN
EXX
RES 7,H
POP BC ;
AND A ; DE = ROZDIEL
PUSH HL
DEC BC
SBC HL,BC ; HL = START
POP BC
EX DE,HL ; BC = KOMPLET DLZKA
POP HL
CALL TEXP ; SET PAGEING RUTINE
LD A,D ; KOPIRUJ A PRKRESLI
OR E
LD (BUFIK-6),BC
LD (BUFIK-4),DE
LD (BUFIK-2),HL
JR Z,NEKOP
PUSH BC
PUSH HL
BIT 7,D
JR Z,PLUSB
PUSH HL
LD HL,0
AND A
SBC HL,DE
LD C,L
LD B,H
POP HL
CALL ZRUS1
JR COMFO
PLUSB: LD C,E
LD B,D
CALL PRID1
COMFO: POP HL
POP IX
LD B,0
LD A,(NEW+1)
BIT 6,H
RES 6,H
JR Z,$+3
INC A
LD C,A
EX DE,HL
LD A,CLIP-1
LD HL,32768
RST 40
DB MOV_LDIR
NEKOP: JP SKOC
REFORM: EXX
LD HL,32768
LD D,CLIP-1
EXX
LD A,CLIP
OUT (251),A
LD HL,32768
LD IX,BUFIK-3
X3: XOR A
LD (IX-3),A
LD (IX-2),A
LD (IX-1),A
LD IY,BUFIK
X4: LD (INCLIP),HL
LD (INBUF),IY
LD A,(HL)
AND A
RET Z
CALL GETWORD
JR C,JUST2 ; CY AK PRETECENIE
CP 13
DEC IY
LD (IX+0),1 ; NOJUSTIFY
LD (INCLIP),HL
JR Z,JUST2+4 ; NOVY RIADOK
INC IY
LD A,(IX-3)
LD (IX+0),A
LD DE,(BUFIK-5) ; INAK SU PLATNE DTA A ZNOVA
LD (BUFIK-2),DE
JR X4
JUST2: LD IY,(INBUF)
LD (IY+0),13
IN A,(251)
EXX
PUSH HL
PUSH BC
PUSH DE
EXX
PUSH AF
CALL TEXP
PUSH IX
LD A,(IX+0)
CP 2
CALL NC,ZAROVNAJ
POP IX
POP AF
OUT (251),A
EXX
POP DE
POP BC
POP HL
EXX
CALL COPIES
LD HL,(INCLIP)
LD A,(HL) ; PRESKOC MEDZERU
CP " "
JR NZ,X3
INC HL
JR X3
COPIES: LD HL,BUFIK
LD A,(HL)
INC HL
CALL KEEP
CP 13
JR NZ,COPIES+3
RET
GETWORD: CALL BIELE
CALL ZNAKS
LD A,95
SUB (IX-3)
RET C
PUSH HL
LD HL,(MAX+1)
LD E,(IX-2)
LD D,(IX-1)
INC DE
SBC HL,DE
POP HL
RET C
LD A,(IY-1)
RET
ZNAKS: LD A,(HL)
CP 13
JR Z,ENDCR
CP " "
JR C,CLE
RET Z
CP TAB
RET Z
ENDCR: LD (IY),A
INC IY
CP 13
CALL NZ,ADDCH
LD A,(HL)
INC HL
CP 13
RET Z
JR ZNAKS
CLE: LD (CPY+1),A
LD A,(HL)
LD (IY+0),A
INC IY
CALL ADDCH
LD A,(HL)
CPY: CP 0
INC HL
JR NZ,CLE+3
RET
BIELE: LD A,(HL)
CP TAB
JR Z,JEBIEL
CP " "
RET NZ
JEBIEL: INC HL
LD (IY+0),A
INC IY
CALL ADDCH
JR BIELE
ADDCH: EX AF,AF'
IN A,(251)
PUSH AF
IN A,(252)
AND 31
OUT (251),A
EX AF,AF'
INC (IX-3)
CALL ISCHAR
JR NC,REW2 ; skok ak znak
CP &C0 ; riadiaci kod ?
JR NC,RE2
EXX
PUSH BC
PUSH DE
PUSH HL
EXX
CALL &E003 ; zmen pismo
EXX
POP HL
POP DE
POP BC
EXX
JR RE2
REW2: CALL INDEX
ADD (IX-2)
LD (IX-2),A
JR NC,RE2
INC (IX-1)
RE2: POP AF
OUT (251),A
RET
GCH: LD D,A
LD A,(HL) ; D<A<E
INC HL ; (HL)
LD E,(HL)
RET
KEEP: EXX
IN E,(C)
OUT (C),D
LD (HL),A
INC HL
OUT (C),E
EXX
RET
ISCHAR: CP " " ; NC pre 32 - 159
RET C
CP &C0
CCF
RET
ISSPACE: CP &8F
RET Z
CP " "
RET Z
CP TAB
RET Z
CP 13
RET
ISSTYL: CP &C0
CCF
RET NC
CP &CA
RET
ROZLOZ: CALL GCH
CALL ISSPACE
JR NZ,DEFO
CALL KEEP
JR ROZLOZ
DEFO: AND A
RET Z ; END OF FILE
CALL ISSTYL
RET C ; NEW PARA
CP " "
JR NZ,NOSPC
CP D ; MULTISPACE
JR Z,SKIP
JR DLOOP
NOSPC: CP "-"
JR NZ,NOMINUS
LD A,E
CP 13
LD A,"-"
JR NZ,DLOOP
CALL GCH
CALL GCH
JR DLOOP
NOMINUS: CP 13 ; CR IF E OR D = CR
JR NZ,DLOOP
LD A,E
CP 13
JR Z,DLOOP
AND A ; IDE O NULL ZA ENTER
LD A,13
JR Z,DLOOP
LD A,E
CALL ISSTYL ;IDE O STYL ZA ENTER
LD A,13
CALL C,KEEP
JR C,SKIP
LD A,D
CP 13
JR Z,DLOOP
LD A," "
DLOOP: CALL KEEP
SKIP: CALL GCH
JR DEFO
SETHL: LD HL,(ALINE)
RST SCRF
LD A,(HL)
CALL ISSTYL
RET C ; RET IF STYL
HX: DEC HL
LD A,(HL)
CALL ISSTYL
RET C
JR HX
CALC: CALL TEXT
DB 22,15,0
DM "EVALUATE EXPRESSION : "
DB -1
LD A,40
LD HL,&100F
CALL COMPUT
LD DE,RULERS
PUSH DE
RET Z
CALL EVAL
CALL ASCII
RET
EVAL: PUSH HL
PUSH AF
CALL RULERS
POP AF
POP HL
RST 40
DB 10
CALL &127
RET
SET.STYLE: PUSH IX
PUSH IY
CALL OTVOR_OKNO
DW 2
DW &90A
DB &F5,1,22,2,1
DM " Set style "
DB -1
DW 3
DW &90A
DW STYLK
LD HL,&103
W11: PUSH HL
RST 40
DB AT
LD A,"F"
RST 16
POP HL
PUSH HL
LD A,"0"-3
ADD L
RST 16
LD A," "
RST 16
LD DE,STYLS+8
POP HL
PUSH HL
LD H,0
DEC L
DEC L
DEC L
ADD HL,HL
ADD HL,HL
ADD HL,HL
ADD HL,HL
ADD HL,DE
LD B,8
LD A,(HL)
INC HL
RST 16
DJNZ $-3
POP HL
INC L
LD A,L
CP 3+10
JR C,W11
CALL CURSOR
CP 10
PUSH AF
CALL ZATVOR_OKNO
POP AF
POP IY
POP IX
RET NC
ADD &C0
LD (ZMENA),A ; ZSTYL:
LD (LASTK),A
LD HL,(ABUF) ; inak zmen styl
LD A,(HL) ; JE TAM UZ NEJAKY STYL ?
CP &C0
JR NC,NOM ; ANO, NEPRENASAJ
INC (IX+0)
LD BC,94
LD D,H
LD E,L
INC DE
PUSH HL
CALL MOVE
POP HL
NOM: LD A,(LASTK)
LD (HL),A
CALL TOTXT
CALL LOOK2
CALL UKAZ_BUF
LD A,(LASTK)
JP SET_STYL
STYLK: DB 192,193,194,195,196,197,198
DB 199,200,201,-1
RULERS: RST SCRO
DB 62
RFLAG: NOP
AND A
LD HL,RULER
LD DE,&E000-&600
JR Z,NORUL
RULER2: LD A,16
RULER3: PUSH HL
LD BC,8
LDIR
POP HL
DEC A
JR NZ,RULER3
LD C,8
ADD HL,BC
LD A,D
CP &E0
JR C,RULER2
RST SCRF
RET
NORUL: EX DE,HL
LD E,L
LD D,H
INC DE
LD (HL),L
LD BC,&5FF
CALL PROPO.LDIR
RST SCRF
RET
DELINE: LD A,1
LD (ZMENA),A
LD (IX+0),A
DEC A
LD (IX+1),A
LD (IX+2),A
LD HL,(ABUF)
LD A,(HL)
CP &C0
JR C,THV
INC HL
INC (IX+0)
THV: LD (HL),13
INC HL
LD BC,94
LD E,0
CALL FILL
CALL CISTY
CALL RECAL
CALL TOTXT
RET
HIGH: LD (REGIY+2),IY
LD (ZMENA),A
CALL OTVOR_OKNO
DW &0F02
DW &2008
DB &F5,1,22,2,16
DM " Symbol Charset "
DB 255
DW &1003
DW &2008
DW 0
RST SCRO
LD HL,&128
LD A,36
LD (cy),A
LD E,160
EX AF,AF'
HIGH0: LD HL,128-2
LD (cx),HL
LD C,4
EX AF,AF'
HIGH1: LD B,4
LD A,(VZOR)
BIT 6,A
JR Z,HIGH4
LD B,2
HIGH4: LD A,E
CALL &E003
LD A,182
CALL &E003
DJNZ HIGH4
INC E
DEC C
JR NZ,HIGH1
LD A,(cy)
ADD 12
LD (cy),A
CP 36+96
JR C,HIGH0
RST SCRF
CALL CURSOR
CP 8
JP NC,ZATVOR_OKNO
LD A,H
RRCA
RRCA
RRCA
AND 3
PUSH AF
LD D,0
LD H,D
LD E,4
RST &28
DB MULTIPLY
POP AF
ADD A,L
AND 31
ADD 160
LD (LASTK),A
LD (INVF),A
CALL ZATVOR_OKNO
LD IX,(ADLZ)
CALL CISTY
REGIY: LD IY,0
RST SCRO
JP ELOP2
HTK: DB "S","M","R",255
HTW: DW SVM,LMA,RSM
SVM: LD DE,MAKRA
LD HL,(ENDMA)
AND A
SBC HL,DE
INC HL
RET Z
PUSH HL
CALL INAME
POP IX
RET Z
LD DE,HEADR2
LD BC,6
LDIR
LD C,12
LD DE,MAKRA+16384
LD A,19
LD HL,HEADR2
JP SAVE
HEADR2: DM "STAND .MAC"
LMA: CALL INAME
RET Z
LD DE,HEADR2
LD BC,6
LDIR
CALL FEND
LD B,0
LD C,12
EX DE,HL
SET 7,D
RES 6,D
LD A,19
LD HL,HEADR2
CALL LOAD_AT
JR C,RSM
CALL FEND
LD (ENDMA),HL
RET
RSM: LD HL,MAKRA+12
LD (ENDMA),HL
LD (HL),0
LD BC,10000
RST &28
DB CAKAJ
RET
FEND: LD HL,MAKRA
LD BC,-1
XOR A
CPIR
DEC HL
RET
MACRO: CALL OTVOR_OKNO
DW &1002
DW &803
DB &F5,1,22,2,17
DM " Macro "
DB 22,3,17,1
DM "Save"
DB 22,4,17,1
DM "Merge"
DB 22,5,17,1
DM "Reset"
DB 255
DW &1103
DW &803
DW HTK
CALL CURSOR
CP 3
LD HL,ZATVOR_OKNO
PUSH HL
RET NC
LD HL,HTW
JP RUNC
NASTAVM: PUSH IX
PUSH IY
CALL OTVOR_OKNO
DW 7
DW &3E02
DB &FA,1,22,7,2
DM " Macro recorder "
DB 22,8,1
DM "Press keys for macro, ESC for end or EDIT "
DM "for Cancel"
DB 22,9,1,-1
DW 0,0,0
VSTM: CALL ASCII
CP 7
JR Z,ABORT1
CP 16
JR Z,ABORT
POP IY
POP IX
INC (IX+0)
LD (IY+0),A
INC IY
PUSH IX
PUSH IY
CP " "
JR NC,$+4
LD A,"."
RST 16
JR VSTM
ABORT: CALL ZATVOR_OKNO
POP IY
POP IX
LD (IX+0),0
LD (IX-1),0
RET
ABORT1: CALL ZATVOR_OKNO
POP IY
POP IX
RET
SETM: PUSH IX
PUSH IY
LD A,(LASTK) ; BELOW SPACE
CP " "
JR C,ABORT1+3
CALL JEM
JP NC,UZJE
CALL OTVOR_OKNO
DW &1006
DW &1002
DB &F5,0,22,6,18
DM "Undefined key"
DB 22,7,18
DM "Key code = "
DB 22,8,18
DM "Define macro ? (Y/n)"
DB 255
DW 0,0,0
LD HL,&1A07
RST &28
DB AT
LD HL,(LASTK)
LD H,0
CALL NUM3
CALL ASCII
RES 5,A
CP "Y"
PUSH AF
CALL ZATVOR_OKNO
POP AF
POP IY
POP IX
RET NZ
CP 7
RET Z
LD A,(LASTK)
LD HL,(ENDMA)
LD (HL),A
INC HL
PUSH HL
PUSH HL
POP IX
POP IY
INC IY
LD (IX+0),0
CALL NASTAVM
LD A,(IX+0)
AND A
JR Z,NULL
LD (ENDMA),IY
LD (IY+0),0
RET
NULL: LD (IX-1),0
RET
JEM: LD HL,MAKRA
MLO: LD B,(HL)
INC HL
LD C,(HL)
INC HL
CP B
RET Z
INC B
DEC B
SCF
RET Z
LD B,0
ADD HL,BC
JR MLO
UZJE: LD A,C
LD (DLM),A
LD (STM),HL
POP IY
POP IX
RET
DLM: DB 0
STM: DW MAKRA
ENDMA: DW MAKRA+12
ASCII1: LD A,(DLM)
AND A
EI
JP Z,ASCII
DEC A
LD (DLM),A
LD HL,(STM)
LD A,(HL)
INC HL
LD (STM),HL
RET
OPEN: LD A,201
LD (OPEN),A
CALL RULERS
OPEN2: LD A,(AKTUAL)
ADD "0"
LD (MYNAME+5),A
CALL OTVOR_OKNO
DW &1006
DW &1E04
DB &5F,0,22,6,18
DM " Open a New File "
DB 22,8,18
DM "Enter a new file name (6 chars lenght)"
DB 22,9,18
DM "or >ESC< for "
MYNAME: DM "UNTIT1"
DM ".EDI ..."
DB 255
DW 0,0,0
LD A,5
LD DE,&A83F
CALL BUTON
LD HL,MYNAME
LD DE,FNAME
LD BC,6
LDIR
LD A,6
LD HL,&2809
CALL INPUT
JP Z,ZATVOR_OKNO
LD A,(HL)
CP " "
JP Z,ZATVOR_OKNO
LD DE,FNAME
LD BC,6
LDIR
LD A,19
LD HL,FNAME
CALL FILE.INFO
JR C,note
INC HL
CALL LOAD2
note: CALL ZATVOR_OKNO
JP LOGO
LOAD2: LD BC,6
LD DE,HEADR
LDIR
LD BC,(NEW+1)
LD DE,32768
LD A,19
LD HL,HEADR
CALL LOAD_AT
RET C
LD HL,32768
CALL TEXP
LD (ALINE),HL
XOR A
LD BC,32700
CPIR
DEC HL
LD (ENDTXT),HL
INC HL
LD DE,REMS
LD BC,INFOL
LDIR
CALL RESAUTO
LD A,(AKCENT)
LD C,A
LD A,(&2F)
ADD "C"
CP C
CALL NZ,WARNI
RET
VIEW: CALL ZATVOR_OKNO
CALL SAVE_ALL
RST SCRO