-
Notifications
You must be signed in to change notification settings - Fork 4
/
program.asm
11469 lines (11469 loc) · 213 KB
/
program.asm
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
org 00000H
;
L0000:
lxi sp,0BBFAH
mvi a,0FFH
L0005:
sta XBBFF
mvi a,04CH
sta XBBFE
mvi a,001H
sta XBBFB
mvi a,000H
sta XBBFC
mvi a,000H
sta XBBFD
jmp L03C5
;
db 0FFH, 0FFH, 0FFH, 0FFH
db 0FFH, 0FFH, 0FFH, 0FFH
db 0FFH, 0FFH, 0FFH, 0FFH
db 0FFH, 0FFH, 0FFH, 0FFH
db 0FFH, 0FFH, 0FFH, 0FFH
db 0FFH, 0FFH, 0FFH, 0FFH
db 0FFH, 0FFH, 0FFH, 0FFH
db 0FFH, 0FFH, 0FFH, 0FFH
db 0FFH
X0040:
db 003H
X0041:
db 002H, 004H, 004H, 001H
db 001H, 004H, 004H, 001H
db 001H, 002H, 002H, 001H
db 001H, 000H, 000H, 000H
db 000H, 000H, 000H, 000H
db 000H, 000H, 000H, 000H
db 000H, 000H, 000H, 000H
db 000H, 000H, 000H, 000H
db 000H, 000H
;
L0063:
lda X0041
mov c,a
mvi l,001H
L0069:
lda X0040
mov b,a
mvi h,001H
L006F:
push b
push h
lxi d,00062H
in 011H
call L4000
pop h
pop b
inr h
dcr b
jnz L006F
inr l
dcr c
jnz L0069
ret
;
L0086:
lda X0040
mov h,a
L008A:
lda X0041
mov l,a
L008E:
push h
push d
in 011H
call L4000
pop d
pop h
dcr l
jnz L008E
dcr h
jnz L008A
ret
;
L00A0:
push psw
L00A1:
push b
mvi b,011H
L00A4:
dcr b
jnz L00A4
pop b
dcx b
in 011H
mov a,b
ora c
jnz L00A1
pop psw
ret
;
L00B3:
push b
lxi b,003E8H
call L00A0
pop b
in 011H
dcr b
jnz L00B3
ret
;
db 07FH, 07FH, 015H, 07FH
db 07FH, 017H, 07FH, 07FH
db 004H, 07FH, 07FH, 017H
db 07FH, 07FH, 010H, 030H
db 07FH, 07FH, 017H, 07FH
db 07FH, 010H, 031H, 07FH
db 07FH, 017H, 07FH, 07FH
db 017H, 07FH, 07FH, 005H
db 07FH, 07FH, 017H, 05AH
db 03AH, 020H, 020H, 041H
db 03AH, 020H, 020H, 048H
db 009H, 053H, 04BH, 041H
db 04EH, 044H, 049H, 02EH
db 046H, 04EH, 054H, 020H
db 000H, 043H, 068H, 065H
db 063H, 06BH, 03AH, 020H
db 049H, 06EH, 069H, 074H
db 02EH, 020H, 04DH, 065H
db 06DH, 06FH, 072H, 079H
db 000H, 055H, 04CH, 041H
db 04DH, 02DH, 048H, 030H
db 047H, 009H, 056H, 03AH
db 032H, 037H, 02EH, 031H
db 030H, 02EH, 039H, 034H
db 000H, 020H, 000H, 054H
db 065H, 073H, 074H, 03AH
db 009H, 053H, 050H, 041H
db 020H, 020H, 020H, 000H
db 003H, 057H, 044H, 02DH
db 054H, 065H, 073H, 074H
db 03AH, 020H, 020H, 000H
db 017H, 000H, 001H, 017H
db 020H, 020H, 020H, 020H
db 020H, 020H, 000H, 017H
db 0B5H, 0B6H, 0B7H, 0B8H
db 0B7H, 0B8H, 000H, 017H
db 0B7H, 0B8H, 0B5H, 0B6H
db 0B7H, 0B8H, 000H, 017H
db 0B7H, 0B8H, 0B7H, 0B8H
db 0B5H, 0B6H, 000H, 017H
db 0B5H, 0B6H, 0B5H, 0B6H
db 0B7H, 0B8H, 000H, 017H
db 0B7H, 0B8H, 0B5H, 0B6H
db 0B5H, 0B6H, 000H, 017H
db 0B5H, 0B6H, 0B5H, 0B6H
db 0B5H, 0B6H, 000H, 017H
db 04DH, 048H, 045H, 04CH
db 053H, 017H, 040H, 049H
db 02EH, 017H, 040H, 045H
db 02BH, 02EH, 017H, 040H
db 045H, 02DH, 02EH, 017H
db 040H, 052H, 02EH, 017H
;
L0192:
dcx b
in 011H
xra a
cmp b
jnz L0192
cmp c
jnz L0192
ret
;
L019F:
ldax d
mov m,a
inx h
inx d
dcr c
rz
jmp L019F
;
L01A8:
ldax d
mov m,a
cpi 003H
rz
inx h
inx d
jmp L01A8
;
L01B2:
ldax d
mov m,a
inx h
inx d
cpi 017H
rz
jmp L01B2
;
L01BC:
mov a,b
ani 03FH
mov b,a
mvi a,040H
ora b
mov b,a
mvi a,00EH
ori 040H
out 040H
mov a,c
out 044H
mov a,b
out 045H
mvi a,00EH
ori 0C0H
out 040H
in 040H
ret
;
L01D9:
xra a
out 011H
out 011H
out 011H
out 011H
mvi a,040H
out 011H
mvi a,07AH
out 011H
mvi a,025H
out 011H
ret
;
L01EF:
mvi a,002H
sta XBECA
L01F4:
mvi a,037H
out 011H
xra a
sta XBEB1
in 011H
mov c,a
ani 002H
jz L0250
mov a,c
ani 038H
jz L0211
sta XBEB1
mvi a,037H
out 011H
L0211:
in 010H
ani 07FH
cpi 004H
rz
cmp d
jnz L024B
L021C:
cmp e
mov m,a
rz
cpi 004H
rz
inx h
dcr b
rz
L0225:
in 011H
mov c,a
ani 002H
jnz L0237
in 040H
ani 040H
jz L0225
jmp L0253
;
L0237:
mov a,c
ani 038H
jz L0244
sta XBEB1
mvi a,037H
out 011H
L0244:
in 010H
ani 07FH
jmp L021C
;
L024B:
dcr b
rz
jmp L01F4
;
L0250:
nop
stc
ret
;
L0253:
lda XBEC9
inr a
sta XBEC9
lda XBECA
dcr a
sta XBECA
jnz L0225
mvi a,040H
stc
ret
;
L0268:
lxi b,02200H
call L0192
L026E:
in 011H
ani 004H
jz L026E
mov a,m
cpi 017H
rz
out 010H
inx h
jmp L026E
;
L027F:
in 011H
in 021H
ani 004H
jz L027F
mov a,m
cpi 017H
rz
out 020H
inx h
jmp L027F
;
db 01AH, 0E6H, 00FH, 077H
db 023H, 013H, 00DH, 0C2H
db 092H, 002H, 0C9H, 01AH
db 0F6H, 030H, 077H, 023H
db 013H, 00DH, 0C2H, 09DH
db 002H, 0C9H
;
L02A8:
push b
lxi b,00002H
xra a
L02AD:
ldax d
mov b,a
mov a,m
sbb b
jp L02B7
adi 00AH
stc
L02B7:
mov m,a
dcx h
dcx d
dcr c
jnz L02AD
pop b
ret
;
db 01AH, 0FEH, 002H, 0C8H
db 077H, 023H, 013H, 000H
db 0C8H, 0C3H, 0C0H, 002H
;
L02CC:
push b
lxi b,005FFH
L02D0:
dcx b
in 011H
xra a
cmp b
jnz L02D0
cmp c
jnz L02D0
pop b
ret
;
L02DE:
mvi a,017H
cmp m
jz L02F4
ldax d
cpi 003H
rz
mov m,a
L02E9:
cmp m
jnz L02E9
inx h
inx d
dcr c
rz
jmp L02DE
;
L02F4:
mvi a,080H
ret
;
L02F7:
lxi d,01FFFH
lxi h,XC000
L02FD:
mvi a,065H
cmp m
jz L0308
mov m,a
L0304:
cmp m
jnz L0304
L0308:
in 011H
inx h
dcx d
mvi a,000H
cmp d
jnz L02FD
cmp e
jnz L02FD
ret
;
db 021H, 00AH, 0BDH, 00EH
db 040H, 036H, 040H, 023H
db 00DH, 0C2H, 01CH, 003H
db 0C9H
;
L0324:
mvi c,001H
L0326:
ldax d
cpi 017H
jz L0331
inx d
inr c
jmp L0326
;
L0331:
ldax d
mov m,a
call L02CC
dcx h
dcx d
dcr c
jnz L0331
ret
;
L033D:
mov a,m
cpi 017H
jz L0348
inx h
dcx d
jmp L033D
;
L0348:
lxi h,0017AH
L034B:
ldax d
cmp m
rnz
cpi 017H
rz
inx d
inx h
jmp L034B
;
L0356:
cpi 030H
jnz L036E
lda XBEC3
cpi 030H
jnz L036E
lhld XBEBD
shld XBEBF
mvi m,020H
jmp L03AE
;
L036E:
lhld XC004
L0371:
lxi d,XBEC1
mvi c,004H
L0376:
dcx h
mov a,m
cpi 002H
jz L0385
cpi 017H
jz L03B4
jmp L0376
;
L0385:
push h
inx h
L0387:
ldax d
cmp m
jnz L0395
inx h
inx d
dcr c
jnz L0387
jmp L0399
;
L0395:
pop h
jmp L0371
;
L0399:
nop
xchg
pop h
lhld XBEBD
shld XBEBF
L03A2:
ldax d
cpi 002H
jz L03AE
mov m,a
inx h
inx d
jmp L03A2
;
L03AE:
mvi m,000H
shld XBEBD
ret
;
L03B4:
lhld XBEBD
shld XBEBF
lxi d,XBEC3
mvi c,002H
call L019F
jmp L03AE
;
L03C5:
nop
xra a
out 011H
out 011H
out 011H
out 011H
mvi a,040H
out 011H
mvi a,07AH
out 011H
mvi a,025H
out 011H
xra a
out 021H
out 021H
out 021H
out 021H
mvi a,040H
out 021H
mvi a,04EH
out 021H
mvi a,025H
out 021H
mvi a,00EH
out 040H
mvi a,089H
out 033H
xra a
mvi c,000H
lxi h,0FFFFH
L03FE:
mov m,a
dcx h
dcr c
jnz L03FE
lxi h,0BE2FH
mvi m,002H
inx h
mvi c,012H
L040C:
mvi m,030H
inx h
dcr c
jnz L040C
mvi m,003H
mvi a,04CH
sta XBE37
mvi a,030H
sta XBEB2
sta XBEB3
sta XBEC5
sta XBEB9
sta XBEC6
sta XBEC7
sta XBEC9
mvi a,031H
sta XBEB8
call L0063
mvi a,0FFH
sta XBBFF
lxi h,00101H
lxi d,0010FH
in 011H
call L4000
in 011H
mvi b,032H
call L00B3
lxi h,0C001H
mvi c,005H
mov a,m
L0456:
inx h
xra m
dcr c
jnz L0456
lxi h,XC000
cmp m
jnz L0471
lxi h,0017AH
lxi d,0C00FH
call L033D
cpi 017H
jz L04DA
L0471:
mvi a,001H
sta XBBFB
mvi a,000H
sta XBBFC
sta XBBFD
lxi d,000FBH
lxi h,00101H
in 011H
call L4000
call L02F7
lxi h,0C010H
mov a,l
sta XC004
call L02CC
mov a,h
sta XC005
call L02CC
lxi h,0C001H
mvi c,003H
L04A2:
mvi m,030H
inx h
call L02CC
dcr c
jnz L04A2
lxi d,0017AH
lxi h,0C00FH
call L0324
call L02CC
lxi h,0DFFEH
mvi m,017H
call L02CC
inx h
mvi m,017H
call L02CC
lxi h,0C001H
mvi c,005H
mov a,m
L04CC:
inx h
xra m
dcr c
jnz L04CC
sta XC000
call L02CC
in 011H
L04DA:
call L0063
lda XBEC5
cpi 043H
jnz L04ED
mvi a,000H
sta XBEC5
jmp L0579
;
L04ED:
lxi h,00180H
call L027F
lxi h,00189H
call L027F
mvi a,003H
sta XBEB3
L04FE:
lxi d,00125H
lxi h,0BD0AH
call L01A8
lda XBEB3
dcr a
ori 030H
sta XBD14
lxi d,0BD0AH
lxi h,00101H
in 011H
call L4000
lxi b,000CDH
call L01BC
lxi h,00184H
call L027F
in 011H
L0529:
in 021H
ani 002H
jz L0539
in 011H
in 020H
cpi 00DH
jz L0559
L0539:
in 011H
in 040H
ani 040H
jz L0529
lda XBEB3
dcr a
sta XBEB3
jnz L04FE
mvi a,030H
sta XBEB3
mvi b,014H
call L00B3
jmp L0569
;
L0559:
lxi h,00189H
call L027F
mvi a,04FH
sta XBEB3
mvi b,014H
call L00B3
L0569:
in 011H
mvi a,0FFH
sta XBBFF
call L0063
L0573:
lxi b,000CDH
call L01BC
L0579:
in 041H
ani 00EH
ori 030H
sta XBEB0
in 041H
rar
rar
rar
rar
ani 007H
ori 030H
sta XBEAF
call L01D9
mvi a,037H
out 011H
in 010H
mvi a,000H
sta XBEC6
mvi a,003H
sta XBEB5
L05A2:
lda XBEAF
mov d,a
mvi e,005H
mvi b,005H
lxi h,0BC00H
call L01EF
jnc L062C
in 041H
ani 080H
jnz L0E87
in 040H
ani 040H
jz L05A2
lda XBEC9
inr a
sta XBEC9
lxi b,000CDH
call L01BC
lda XBEC9
cpi 016H
cp L07F8
lda XBE3A
cpi 031H
jnz L05A2
lda XBEB9
cpi 045H
jz L05EE
cpi 05AH
jz L05EE
jmp L05A2
;
L05EE:
lxi d,0BE0AH
lda XBEC8
cpi 000H
jnz L0621
mvi a,001H
sta XBEC8
L05FE:
lda XBE31
sui 033H
jp L0616
lxi h,00301H
in 011H
call L4000
lda XBE31
cpi 031H
jnz L05A2
L0616:
lxi h,00302H
in 011H
call L4000
jmp L05A2
;
L0621:
lxi d,0BE1AH
mvi a,000H
sta XBEC8
jmp L05FE
;
L062C:
cpi 004H
jz L0579
cpi 005H
jnz L0579
dcx h
mov a,m
ani 07EH
mov c,a
lda XBEB0
cmp c
jnz L0579
dcx h
lda XBEAF
cmp m
jnz L0579
inx h
mov a,m
ani 001H
jnz L0931
lda XBEB8
cpi 031H
jz L070E
L0659:
cpi 053H
jz L070E
cpi 045H
jz L067A
cpi 054H
jz L067A
cpi 044H
jz L067A
cpi 04EH
jz L06B7
cpi 04CH
jz L06E5
jmp L070E
;
L067A:
lxi b,01180H
call L0192
lxi h,0BC0AH
mvi m,07FH
inx h
mvi m,07FH
inx h
lxi d,0BC8AH
call L01A8
lxi h,0BC14H
mvi m,04CH
mvi b,000H
lxi h,0BC0CH
L0699:
inx h
mov a,m
xra b
mov b,a
mov a,m
cpi 003H
jnz L0699
inx h
mov m,b
inx h
mvi m,07FH
inx h
mvi m,07FH
inx h
mvi m,017H
lxi h,0BC0AH
call L026E
jmp L0777
;
L06B7:
lxi b,01180H
call L0192
lxi h,0BC0AH
mvi m,07FH
inx h
mvi m,07FH
inx h
lxi d,0BC8AH
call L01A8
lxi h,0BC14H
mvi m,04CH
inx h
mvi c,00CH
L06D4:
mvi m,030H
inx h
dcr c
jnz L06D4
mvi m,003H
mvi b,000H
lxi h,0BC0CH
jmp L0699
;
L06E5:
lxi b,01180H
call L0192
lxi h,0BC0AH
mvi m,07FH
inx h
mvi m,07FH
inx h
lxi d,0BC8AH
call L01A8
lxi h,0BC14H
mvi m,04CH
inx h
lxi d,0BE38H
call L01A8
mvi b,000H
lxi h,0BC0CH
jmp L0699
;
L070E:
lxi b,01180H
call L0192
lxi h,0BC0AH
mvi m,07FH
inx h
mvi m,07FH
inx h
mvi m,002H
inx h
lxi d,XBC8B
mvi c,007H
call L019F
lxi h,0BC0FH
lxi d,0C001H
mvi c,003H
call L019F
mvi c,00AH
lda XBEB2
cpi 040H
jp L0740
mvi m,046H
inx h
L0740:
mov m,a
inx h
lda XBEB3
cpi 040H
jp L074D
mvi m,046H
inx h
L074D:
mov m,a
inx h
mvi m,003H
push h
mvi b,000H
L0754:
mov a,m
cpi 002H
jz L0760
xra b
mov b,a
dcx h
jmp L0754
;
L0760:
pop h
inx h
mov m,b
inx h
mvi m,07FH
inx h
mvi m,07FH
inx h
mvi m,017H
mvi a,053H
sta XBEB8
lxi h,0BC0AH
call L0268