-
Notifications
You must be signed in to change notification settings - Fork 0
/
devast40.z80
2985 lines (2632 loc) · 192 KB
/
devast40.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
;+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
; +
; DEWAST 40 (LOW) +
; +
; MONITOR - DEBUGGER for SAM Coupe +
; +
; The work at this program - start 17.december 1993 14:00 +
; +
; - end 22.DECEMBER 1993 12:21 +
; +
;+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
; -5 : OPTION 0 - DISA LINE SPACE
; -4 : MYVMPR 1 - L FEED
; flag: -3 : prn 2 - F FEED
; -2 : LMPR
; -1 : VMPR
START: EQU &4000
VRAM: EQU &C000
DUMP 14,&0000
ORG START
DI
PUSH AF
PUSH HL
IN A,(251)
LD (QUIT+1+16384),A
AND 31
DEC A
JR NZ,NOPA
LD HL,NOPA+16384
JP &5C ; pokial nieje page 0
NOPA: IN A,(252) ; uloz vram
LD (VR+1+16384),A
LD A,(FLAG+16380)
AND A
JR NZ,NOVIDEO
IN A,(251) ; a vypocitaj novu
OR &60
AND &FE
NOVIDEO: OUT (252),A ; nastav ju
LD (FLAG+16380),A
IN A,(250) ; schovaj si aj LMPR
LD (Q2+1+16384),A
IN A,(251)
AND 31
DEC A
OR 32
OUT (250),A
JP $+3
LD A,(FLAG-2) ; a nastav standardny
OUT (251),A
POP HL
POP AF
LD (STC+1),SP
REST: DI ; uloz registre
LD (STACK),SP
LD SP,REGS
EXX
EX AF,AF'
PUSH AF
PUSH HL
PUSH DE
PUSH BC
PUSH IY
PUSH IX
EXX
EX AF,AF'
PUSH AF
PUSH HL
PUSH DE
PUSH BC
LD A,I
LD H,A
LD A,R
LD L,A
PUSH HL
ST2: LD SP,MYSP
LD IY,FLAG
LD A,&E8
DEFB 195
VECT: DEFW MONIT
TREG: DEFM "SPIRBCDEHLAFIXIYB'D'H'A'NZZ NCC POPEP M DI"
DEFM "EI"
KLAVESY: DEFB 0,&FD,"!",&C0,12,"@",&C9,"r",&C3,"X"
DEFB &2E,&3A,34,&2B,10,&C8,&C5,&C2,"X"
DEFB &2C,&3B,&3D,&2D," ",&C7,&C4,&C1,9
DEFM "bhy65tgv"
DEFB 8
DEFM "nju74rfc"
DEFB 10
DEFM "mki83edx"
DEFB 11
DEFM "Xlo92wszX "
DEFB 13
DEFM "p01qa\"
KLAV2: DEFB 0,&FE,"!",&CA,14,"@",&D3,&D0,205
DEFM "X.:"
DEFB 42,9,011,&CF,&CC
DEFM "X,;_/ "
DEFB &D1,&CE,&CB,9
DEFM "BHY&%TGV"
DEFB 8
DEFM "NJU'$RFC"
DEFB 10
DEFM "MKI(#EDX"
DEFB 11
DEFM "XLO)@WSZX "
DEFB 13
DEFM "P~!QA\"
L40E0: DEFW BLOP
DEFB &10
DEFW LZF
DEFB &18
DEFW HALTUJ
DEFB &76
DEFW HARDS
DEFB &C3
DEFW HARDC
DEFB &CD
DEFW JPHL
DEFB &E9
DEFW ZAKAZ
DEFB &F3
DEFW POVOL
DEFB &FB
DEFW L4F49
DEFB &C9
DEFB 0,0,0
L40F4: DEFW L4E6A
DEFB &C0
DEFW PSKOK
DEFB &C2
DEFW KROKCALL
DEFB &C4
DEFW FAST
DEFB &C7
DEFB 0,0,0
TABCOM: DEFW MOVE
DEFB "i"
DEFW RETURN
DEFB "C"
DEFW LMPR
DEFB "r"
DEFW BASE
DEFB &C3
DEFW OPTION
DEFB &C2
DEFW MYSCR
DEFB &C1
DEFW COMPARE
DEFB "j"
DEFW COMPARE+1
DEFB "J"
DEFW CHANGE
DEFB &C9
DEFW CHANGE1
DEFB &C8
DEFW EXCH
DEFB "E"
DEFW THIRD
DEFB &C5
DEFW READ
DEFB "R"
DEFW WRITE
DEFB "W"
DEFW PRN
DEFB &C7
DEFW MOVE1
DEFB "I"
DEFW QUIT
DEFB "Q"
DEFW REGISTR
DEFB "N"
DEFW POKE
DEFB 13
DEFW DPOKE
DEFB " "
DEFW BASE
DEFB "#"
DEFW TEXTV1
DEFB "o"
DEFW TEXTV
DEFB "O"
DEFW DISAV
DEFB "v"
DEFW DISAV1
DEFB "$"
DEFW DUMPV1
DEFB "l"
DEFW DUMPV
DEFB "L"
DEFW FILL
DEFB "p"
DEFW FILL1
DEFB "P"
DEFW CALC
DEFB "A"
DEFW FIND
DEFB "g"
DEFW HLADAJ
DEFB "n"
DEFW WIEWF
DEFB "G"
DEFW SLOW
DEFB "Z"
DEFW FAST
DEFB "X"
DEFW TSLOW
DEFB "V"
DEFW TFAST
DEFB "B"
DEFW VELKE
DEFB "@"
DEFW MENEJ
DEFB 11
DEFW NEXT
DEFB 10
DEFW SCHOVAJ
DEFB 9
DEFW SCHOVAJ+3
DEFB "m"
DEFW WIEWMEM
DEFB "q"
DEFW WIEWSP
DEFB "u"
DEFW SCREEN
DEFB "s"
DEFW MODE
DEFB "S"
DEFW SETPOINT
DEFB "w"
DEFW BREAKPOINT
DEFB "U"
DEFW VOLAJ
DEFB "H"
DEFW JUMP
DEFB "T"
DEFW EDITOR
DEFB "t"
DEFW SKAC
DEFB &C4
DEFW CALUJ
DEFB 8
DEFB 0,0,0
LINE: CALL CLL
PUSH IX
CALL P_BYTE
CALL STRING
DEFB 128
POP HL
DEFB &DD
LD A,L
SUB L
LD (LENINS),A
LD B,A
AND A
RET Z
CALL NUMBER
CALL SPC
PBY: LD A,(HL)
INC HL
CALL HEX_8+4
DJNZ PBY
RET
CHAR: EX (SP),HL
PUSH AF
LD A,(HL)
INC HL
CALL PRINT
POP AF
EX (SP),HL
RET
PRB: DEFS 43
LPT: PUSH AF
CP 1
JR Z,CRLF
CP " "
JR C,NFF
LD A,(POS)
LD C,0
ODC: AND A
JR Z,POZ
SUB 3
INC C
JR ODC
POZ: LD HL,PRB
LD A,C
AND 31
LD C,A
LD B,0
ADD HL,BC
POP AF
LD (HL),A
RET
PUSH AF
CRLF: LD HL,PRB
LD B,32
LD A,(HL)
LD (HL)," "
INC HL
CALL PRT
DJNZ CRLF+5
LD A,13
CALL PRT
LD A,10
BIT 1,(IY-5)
CALL NZ,PRT
DEC (HL)
JR NZ,NFF
LD A,12
BIT 2,(IY-5)
CALL NZ,PRT
LD A,62
LD (HL),A
NFF: POP AF
RET
PRT: PUSH BC
PUSH AF
CALL ESCA
LD BC,&1E9
IN A,(C)
RRCA
JR C,PRT+2
POP AF
DEC C
OUT (C),A
INC C
OUT (C),B
DEC B
NOP
OUT (C),B
POP BC
RET
ESCA: LD A,&7F
IN A,(&FE)
RRCA
RET C
POP AF
POP AF
POP BC
RET
L412B: LD HL,L59E5
LD A,(HL)
INC HL
PUSH AF
CALL TAB
NOP
POP AF
LD B,A
AND A
JR Z,CUR
L3D: CALL DEFROMHL
EX DE,HL
CALL NUMBER
EX DE,HL
CALL STRING
DEFB &DC
DJNZ L3D
CUR: LD A,">"+128
JR PRINT
LF: LD A,1
JR PRINT
SPC: LD A," "
PRINT:
PUSH AF
EXX
BIT 1,(IY-3)
CALL NZ,LPT
PUSH AF
IN A,(251)
LD (ENP+1),A
LD A,(FLAG-4)
AND 31
OUT (251),A
POP AF
LD HL,POS
CP 1
JR NZ,PRT2
LD (HL),0
INC HL
LD A,(HL)
ADD 4
CP 4*8
LD (HL),A
JR C,ENP
LD (HL),&1C
; scroll up 1
LD HL,(ADRV)
LD D,H
LD E,L
INC H
INC H
INC H
INC H
LD B,7*8
SLOP: PUSH BC
LD A,12
M1: LDI
LDI
LDI
LDI
LDI
LDI
LDI
LDI
DEC A
JR NZ,M1
LD BC,&20
ADD HL,BC
EX DE,HL
ADD HL,BC
EX DE,HL
POP BC
DJNZ SLOP
EX DE,HL
LD BC,&6008
LD DE,32
M2: PUSH BC
LD (HL),0
INC HL
DJNZ M2+1
POP BC
ADD HL,DE
DEC C
JR NZ,M2
ENP: LD A,00
OUT (251),A
POP AF
EXX
RET
PRT2: CP " "
JR C,SETP
SUB " "
PUSH HL
DEFB 17
POS: DEFW 0
DEFB 33
ADRV: DEFW VRAM
ADD HL,DE
RES 0,H
RES 1,H
RES 7,L
EX DE,HL
BIT 7,A
RES 7,A
LD L,A
PUSH AF
ADD A
ADD L
LD L,A
LD H,0
RL H
ADD HL,HL
ADD HL,HL
ADD HL,HL
LD BC,FONT
ADD HL,BC
POP AF
LD C,0
JR Z,$+4
LD C,255
LD B,8
PLOP: PUSH BC
LD A,(HL)
XOR C
LD (DE),A
INC HL
INC E
LD A,(HL)
XOR C
LD (DE),A
INC HL
INC E
LD A,(HL)
XOR C
LD (DE),A
LD BC,128-2
EX DE,HL
ADD HL,BC
EX DE,HL
INC HL
POP BC
DJNZ PLOP
POP HL
LD A,(HL)
ADD 3
JR SETP+3
SETP: LD E,A
ADD A
ADD E
LD (HL),A
JR ENP
STRING: EX (SP),HL
PUSH AF
CALL TOKEN0
POP AF
EX (SP),HL
RET
HEX_8: CALL CHAR
DEFB "#"
PUSH AF
RRCA
RRCA
RRCA
RRCA
CALL HEX
POP AF
HEX: AND 15
ADD &90
DAA
ADC 64
DAA
JP PRINT
HEX_16: LD A,H
CALL HEX_8
LD A,L
JR HEX_8+4
ONEIX: LD A,(IX+0)
INC IX
RET
FROMIX: LD L,(IX+0)
INC IX
LD H,(IX+0)
INC IX
RET
NUMBERIX: PUSH IX
POP HL
JR NUMBER
CISLO: CALL PRINT
CALL HEX_16
CALL STRING
DEFB 32,160
JR NUMBER+6
NUMBERFROMIX: CALL FROMIX
NUMBER: BIT 0,(IY+0) ;TEST NA BASE
JR Z,HEX_16
PUSH DE
PUSH HL
LD DE,-10000
CALL NUMS
LD DE,-1000
CALL NUMS
NUM8: LD DE,-100
CALL NUMS
LD DE,-10
CALL NUMS
LD E,-1
CALL NUMS
POP HL
POP DE
RET
NUMS: LD A,"0"-1
ODR: INC A
ADD HL,DE
JR C,ODR
SBC HL,DE
JP PRINT
DEFB 3,0,0,1,254
FLAG: DEFB 8,16,0,0
TEXT: LD A,(HL)
AND 127
CP 20
JR NZ,INVR
SET 3,(IY+1)
INVR: CALL CHAR
DEFB 15
CALL TOKEN
CALL CHAR
DEFB 20
RET
TOKEN: PUSH HL
LD HL,L582B
TT: AND A
JR Z,PT
BIT 7,(HL)
INC HL
JR Z,TT+3
DEC A
JR NZ,TT
PT: CALL TOKEN0
POP HL
RET
TOKEN0: LD A,(HL)
AND 127
PUSH AF
CP "a"
JR C,$+4
TOUPPER: XOR 0
CALL PRINT
POP AF
XOR (HL)
INC HL
JR Z,TOKEN0
RET
P_BYTE: SET 3,(IY+1)
BIT 7,(IY+1)
JR Z,OTH
SET 5,(IY+1)
RES 7,(IY+1)
BYTE0: LD A,20
CALL TEXT+1
L4282: CALL ONEIX
BIT 0,(IY+0)
JP Z,HEX_8
PUSH DE
PUSH HL
LD L,A
LD H,0
JP NUM8
OTH: BIT 6,(IY+1)
JR Z,OTH0
CALL BYTE0
LD A,(IX-1)
CP 56
RET NZ
RES 6,(IY+1)
RET
OTH0: BIT 5,(IY+1)
JR Z,INSTR
RES 5,(IY+1)
BIT 0,(IY-5)
JR Z,INSTR
LD BC,&2020
JR CLL+3
CLL: LD BC,&2A20
LD A,C
CALL PRINT
DJNZ $-3
RET
INSTR: LD (IY+2),0
RES 3,(IY+1)
LD (ADR+2),IX
LD A,(IX+2)
LD (L444D),A
CALL ONEIX
LD DE,L599C
CP &ED
LD HL,L44F4
JR Z,POED
CP &DD
JR NZ,NODD
LD (IY+2),1
JR OTH1
NODD: CP &FD
JR NZ,OTH1+3
LD (IY+2),2
OTH1: CALL ONEIX
CP &CB
JR Z,POCB
LD HL,L452D
AND A
JR Z,NOPP
PUSH HL
LD HL,L44E3
CALL PORO
POP HL
JR NZ,NOPP
SET 5,(IY+1)
NOPP: LD DE,L597E
JR OTH2
POCB: LD HL,L44E9
LD A,(IY+2)
AND A
JR Z,POED
LD A,(IX+1)
INC IX
JR OTH2
POED: CALL ONEIX
OTH2: LD C,A
LD B,(HL)
INC B
JR Z,NAS0
CP (HL)
INC HL
JR NZ,NAS1
CALL TEXT
BIT 7,(HL)
RET Z
LD DE,L59AE
PUSH DE
PUSH DE
JR OTH3
NAS1: BIT 7,(HL)
INC HL
JR Z,OTH2+1
INC HL
JR OTH2+1
NAS0: LD A,C
INC HL
LD B,(HL)
INC B
JR NZ,OTH4
ADR: LD IX,0
JP BYTE0
OTH4: AND (HL)
INC HL
XOR (HL)
INC HL
JR Z,OTH5
BIT 7,(HL)
INC HL
JR Z,NAS0
INC HL
JR NAS0
OTH5: PUSH DE
PUSH DE
LD A,(HL)
AND 127
CP (HL)
JR Z,OTH3-3
INC HL
LD D,A
LD A,(HL)
LD E,C
RRC E
ADD " "
JR NC,$-4
AND E
ADD D
CALL TEXT+1
OTH3: INC HL
SET 4,(IY+1)
LD A,(HL)
POP HL
PUSH AF
RRCA
RRCA
RRCA
RRCA
AND 15
CALL OTH6
POP AF
POP HL
AND 15
RET Z
BIT 4,(IY+1)
JR Z,OTH6
CALL CHAR
DEFB ","
OTH6: ADD A
RET Z
LD E,A
LD D,0
ADD HL,DE
CALL DEFROMHL
LD A,D
AND A
LD A,E
JP Z,TOKEN
EX DE,HL
LD A,C
JP (HL)
DEFROMHL: LD E,(HL)
INC HL
LD D,(HL)
INC HL
RET
L43A7:
INE: LD A,81
ADD (IY+2)
JP TOKEN
L43AF: LD B,&4F
JR OTH7
L43B3: AND 16
LD A,&5F
JP Z,TOKEN
INC A
JP TOKEN
L43BC: LD B,80
OTH7: RRCA
RRCA
RRCA
RRCA
AND 3
CP 2
JR Z,INE
ADD &4D
CP 80
JP NZ,TOKEN
LD A,B
JP TOKEN
L43D1: CALL ONEIX
PUSH IX
POP DE
LD L,A
RLA
SBC A
LD H,A
ADD HL,DE
JP NUMBER
L43DF: CALL LAVA
CALL INE
CALL CHAR
DEFB ")"
RET
L43E7: AND &38
CP C
JR C,$+4
AND &18
RRCA
RRCA
RRCA
ADD 84
JP TOKEN
L43F5: AND &38
CP " "
JR NC,L44
CP 16
LD A,&4C
JP NZ,TOKEN
L44: RES 4,(IY+1)
RET
L4406: CALL LAVA
CALL BYTE0+5
PRAVA: CALL CHAR
DEFB ")"
RET
LAVA: CALL CHAR
DEFB "("
RET
L4416: CALL LAVA
CALL NUMBERFROMIX
JR PRAVA
L441E: AND &38
CALL BYTE0+8
LD A,C
AND &38
CP &28
JR NZ,$+7
SET 6,(IY+1)
RET
CP 8
RET NZ
SET 7,(IY+1)
RET
L4437: RRCA
RRCA
RRCA
L443A: AND 7
CP 6
JR NZ,OTH9