-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathlibr3.asm
11323 lines (10907 loc) · 238 KB
/
libr3.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
; z80dasm 1.1.3
; command line: ./z80dasm -a -l -S libr3.sym -s libr3.sym1 -o libr3.mac -b libr3.blocks.txt LIBR3.COM
org 00100h
BDOS: equ 0x0005
__argc_: equ 0x5584
__Hbss: equ 0x5599
l0100h:
ld hl,(00006h) ;0100
ld sp,hl ;0103
ld de,__Lbss ;0104
or a ;0107
ld hl,__Hbss ;0108
sbc hl,de ;010b
ld c,l ;010d
ld b,h ;010e
dec bc ;010f
ld l,e ;0110
ld h,d ;0111
inc de ;0112
ld (hl),000h ;0113
ldir ;0115
ld hl,data ;0117
push hl ;011a
ld hl,00080h ;011b
ld c,(hl) ;011e
inc hl ;011f
ld b,000h ;0120
add hl,bc ;0122
ld (hl),000h ;0123
ld hl,00081h ;0125
push hl ;0128
call startup ;0129
pop bc ;012c
pop bc ;012d
push hl ;012e
ld hl,(__argc_) ;012f
push hl ;0132
call main ;0133
push hl ;0136
call exit ;0137
jp 00000h ;013a
; =============== F U N C T I O N ===========================================
; 1 sub_013dh ok++
;
sub_013dh: ; int sub_013dh(register * st, char * p2) {
call csv ;013d ; char loc1, loc2;
push hl ;0140 ;
ld l,(ix+006h) ;0141 ;
ld h,(ix+007h) ;p1 ;0144 ;
push hl ;0147 ;
pop iy ;st ;0148 ;
jr l01aeh ;014a ; goto m6;
l014ch: ; ; m1:
ld a,(iy+000h) ;*st ;014c ;
ld e,a ;014f ;
rla ;0150 ;
sbc a,a ;0151 ;
ld d,a ;0152 ;
ld hl,l46b4h ; ctype_+1 ;0153 ;
add hl,de ;0156 ;
bit 0,(hl) ;0157 ;
ld a,e ;0159 ;
jr nz,l0161h ;015a ; if(isupper(*st) != 0) goto m2;
ld l,a ;015c ;
rla ;015d ;
sbc a,a ;015e ; l = 0
jr l0169h ;015f ; goto m3;
l0161h: ; ; m2:
ld e,a ;0161 ;
rla ;0162 ;
sbc a,a ;0163 ;
ld d,a ;0164 ;
ld hl,00020h ;0165 ;
add hl,de ;0168 ; l = 0x20 + *st;
l0169h: ; ; m3:
ld (ix-001h),l ;loc1 ;0169 ; loc1 = l;
ld l,(ix+008h) ;016c ;
ld h,(ix+009h) ;p2 ;016f ;
ld a,(hl) ;0172 ;
ld e,a ;0173 ;
rla ;0174 ;
sbc a,a ;0175 ;
ld d,a ;0176 ;
ld hl,l46b4h ; ctype_+1 ;0177 ;
add hl,de ;017a ;
bit 0,(hl) ;017b ;
ld l,(ix+008h) ;017d ;
ld h,(ix+009h) ;p2 ;0180 ;
ld a,(hl) ;0183 ;
jr nz,l018ch ;0184 ; if(isupper(*p2) != 0) goto m4;
ld l,a ;0186 ;
rla ;0187 ;
sbc a,a ;0188 ;
ld h,a ;0189 ; l = (char)*p2
jr l0194h ;018a ; goto m5;
l018ch: ; ; m4:
ld e,a ;018c ;
rla ;018d ;
sbc a,a ;018e ;
ld d,a ;018f ;
ld hl,00020h ;0190 ;
add hl,de ;0193 ; l = 0x20 + (char)*p2;
l0194h: ; ; m5:
ld (ix-002h),l ;loc2 ;0194 ; loc2 = l;
ld a,(ix-001h) ;loc1 ;0197 ;
cp (ix-002h) ;loc2 ;019a ;
jr nz,l01b4h ;019d ; if(loc1 != loc2) goto m7;
inc iy ;019f ; ++st;
ld l,(ix+008h) ;01a1 ;
ld h,(ix+009h) ;p2 ;01a4 ;
inc hl ;01a7 ;
ld (ix+008h),l ;01a8 ;
ld (ix+009h),h ;p2 ;01ab ; ++p2;
l01aeh: ; ; m6:
ld a,(iy+000h) ;01ae ;
or a ;01b1 ;
jr nz,l014ch ;01b2 ; if(*st != 0) goto m1;
l01b4h: ; ; m7:
ld l,(ix+008h) ;01b4 ;
ld h,(ix+009h) ;p2 ;01b7 ;
ld a,(hl) ;01ba ;
ld e,a ;01bb ;
rla ;01bc ;
sbc a,a ;01bd ;
ld d,a ;01be ;
ld a,(iy+000h) ;01bf ;
ld l,a ;01c2 ;
rla ;01c3 ;
sbc a,a ;01c4 ;
ld h,a ;01c5 ;
or a ;01c6 ;
sbc hl,de ;01c7 ; return *p2 - *st;
jp cret ;01c9 ; }
; =============== F U N C T I O N ===========================================
; 2 sub_01cch ok++
;
sub_01cch: ; void sub_01cch(int p1, int p2) {
call csv ;01cc ;
ld l,(ix+008h) ;01cf ;
ld h,(ix+009h) ;p2 ;01d2 ;
ld (word_4747),hl ;01d5 ; word_4747 = p2;
ld l,(ix+006h) ;01d8 ;
ld h,(ix+007h) ;p1 ;01db ;
ld (word_4745),hl ;01de ;
ld a,l ;01e1 ;
or h ;01e2 ;
jp z,cret ;01e3 ; if((word_4745 = p1) != 0) {
push hl ;01e6 ;
call sub_1304h ;01e7 ;
ld (word_4749),hl ;01ea ; word_4749 = sub_1304h(word_4745);
ld hl,(word_4745) ;01ed ;
add hl,hl ;01f0 ;
ex (sp),hl ;01f1 ;
call sub_1304h ;01f2 ;
ld (word_474b),hl ;01f5 ; word_474b = sub_1304h(word_4745*2);
jp cret ;01f8 ; }
; }
; =============== F U N C T I O N ===========================================
; 3 sub_01fbh ok++
;
sub_01fbh: ; char sub_01fbh(int * p1) {
call csv ;01fb ;
push hl ;01fe ;
ld hl,(word_4745) ;01ff ;
ld a,l ;0202 ;
or h ;0203 ;
jr nz,l020bh ;0204 ; if(word_4745 != 0) goto m1;
ld l,001h ;0206 ;
jp cret ;0208 ; return 1;
l020bh: ; ; m1:
ld a,(word_4745) ;020b ;
ld (ix-001h),a ;l1 ;020e ; l1 = word_4745;
l0211h: ; ; m2:
ld a,(ix-001h) ;l1 ;0211 ;
dec (ix-001h) ;l1 ;0214 ;
or a ;0217 ;
jr nz,l021fh ;0218 ; if(l1-- != 0) goto m3;
ld l,000h ;021a ; return 0;
jp cret ;021c ;
l021fh: ; ; m3:
ld l,(ix+006h) ;021f ;
ld h,(ix+007h) ;p1 ;0222 ;
push hl ;0225 ;
ld de,(word_4747) ;0226 ;
ld a,(ix-001h) ;l1 ;022a ;
ld l,a ;022d ;
rla ;022e ;
sbc a,a ;022f ;
ld h,a ;0230 ;
add hl,hl ;0231 ;
add hl,de ;0232 ;
ld c,(hl) ;0233 ;
inc hl ;0234 ;
ld b,(hl) ;0235 ;
push bc ;0236 ;
call sub_013dh ;0237 ;
pop bc ;023a ;
pop bc ;023b ;
ld a,l ;023c ;
or h ;023d ;
jr nz,l0211h ;023e ; if(sub_013d(word_4747[l1], p1) != 0) goto m2;
ld de,(word_4749) ;0240 ;
ld a,(ix-001h) ;0244 ;
ld l,a ;0247 ;
rla ;0248 ;
sbc a,a ;0249 ;
ld h,a ;024a ;
add hl,de ;024b ;
ld (hl),001h ;024c ; word_4749[l1] = 1;
ld a,(ix-001h) ;024e ;
ld l,a ;0251 ;
rla ;0252 ;
sbc a,a ;0253 ;
ld h,a ;0254 ;
ld a,l ;0255 ;
inc a ;0256 ;
ld l,a ;0257 ; return l1-1;
jp cret ;0258 ; }
; =============== F U N C T I O N ===========================================
; 4 sub_025bh ok++
;
sub_025bh: ; void sub_025bh() {
call csv ;025b ;
push hl ;025e ;
ld (ix-002h),000h ;025f ;
ld (ix-001h),000h ;l1 ;0263 ; l1 = 0;
jr l02a1h ;0267 ; goto m3;
l0269h: ; m1:
ld de,(word_4749) ;0269 ;
ld l,(ix-002h) ;026d ;
ld h,(ix-001h) ;l1 ;0270 ;
add hl,de ;0273 ;
ld a,(hl) ;0274 ;
or a ;0275 ;
ld l,(ix-002h) ;0276 ;
ld h,(ix-001h) ;l1 ;0279 ;
jr nz,l029ah ;027c ; if(word_4749[l1] != 0) goto m2;
push hl ;027e ;
ld de,(word_4747) ;027f ;
add hl,hl ;0283 ;
add hl,de ;0284 ;
ld c,(hl) ;0285 ;
inc hl ;0286 ;
ld b,(hl) ;0287 ;
push bc ;0288 ;
ld l,(ix+006h) ;0289 ;
ld h,(ix+007h) ;p1 ;028c ;
call indir ;028f ; fun(word_4747[l1], l1);
pop bc ;0292 ;
pop bc ;0293 ;
ld l,(ix-002h) ;0294 ;
ld h,(ix-001h) ;l1 ;0297 ;
l029ah: ; m2:
inc hl ;029a ;
ld (ix-002h),l ;029b ;
ld (ix-001h),h ;l1 ;029e ; ++l1;
l02a1h: ; m3:
ld de,(word_4745) ;02a1 ;
ld l,(ix-002h) ;02a5 ;
ld h,(ix-001h) ;l1 ;02a8 ;
or a ;02ab ;
sbc hl,de ;02ac ;
jr nz,l0269h ;02ae ; if(l1 != word_4745) goto m1;
jp cret ;02b0 ; }
; =============== F U N C T I O N ===========================================
; 5 sub_02b3h ok++
;
sub_02b3h: ; void sub_02b3h(char * p1) {
call csv ;02b3 ;
ld l,(ix+006h) ;02b6 ;
ld h,(ix+007h) ;p1 ;02b9 ;
push hl ;02bc ;
call sub_01fbh ;02bd ;
pop bc ;02c0 ;
ld a,l ;02c1 ;
or a ;02c2 ;
jp nz,cret ;02c3 ; if(sub_01fbh(p1) == 0)
call sub_0789h ;02c6 ; sub_0789h();
jp cret ;02c9 ; }
; =============== F U N C T I O N ===========================================
; 6 sub_02cch ok++
;
sub_02cch: ; void sub_02cch(char * p1) {
call csv ;02cc ;
ld l,(ix+006h) ;02cf ;
ld h,(ix+007h) ;p1 ;02d2 ;
push hl ;02d5 ;
call sub_01fbh ;02d6 ;
pop bc ;02d9 ;
ld a,l ;02da ;
or a ;02db ;
jp nz,cret ;02dc ; if(sub_01fbh(p1) == 0)
call sub_0874h ;02df ; sub_0874h();
jp cret ;02e2 ; }
; =============== F U N C T I O N ===========================================
; 7 sub_02e5h ok++
;
sub_02e5h: ; void sub_02e5h() {
ld hl,(word_4745) ;02e5 ;
ld a,l ;02e8 ;
or h ;02e9 ;
jr nz,l02f4h ;02ea ; if(word_4745 == 0)
ld hl,l4160h ;02ec ;
push hl ;02ef ;
call sub_117ch ;02f0 ; sub_117ch("delete what ?");
pop bc ;02f3 ;
l02f4h: ;
call sub_0487h ;02f4 ; sub_0487h();
call sub_034ah ;02f7 ; sub_034ah();
ld hl,sub_02b3h ;02fa ;
push hl ;02fd ;
call sub_0621h ;02fe ; sub_0621h(sub_02b3h);
ld hl,sub_12d4h ;0301 ;
ex (sp),hl ;0304 ;
call sub_025bh ;0305 ; sub_025bh(sub_12d4h);
pop bc ;0308 ;
call sub_04d6h ;0309 ; sub_04d6h();
ld hl,sub_02cch ;030c ;
push hl ;030f ;
call sub_0621h ;0310 ; sub_0621h(sub_02cch);
pop bc ;0313 ;
jp sub_053ch ;0314 ; goto sub_053ch;
; }
; =============== F U N C T I O N ===========================================
; 8 sub_0317h ok++
;
sub_0317h: ; void sub_0317h(char * p1) {
call csv ;0317 ;
ld l,(ix+006h) ;031a ;
ld h,(ix+007h) ;p1 ;031d ;
push hl ;0320 ;
call sub_01fbh ;0321 ;
pop bc ;0324 ;
ld a,l ;0325 ;
or a ;0326 ;
jp z,cret ;0327 ; if(sub_01fbh(p1) != 0)
ld l,(ix+006h) ;032a ;
ld h,(ix+007h) ;p1 ;032d ;
push hl ;0330 ;
call sub_0912h ;0331 ; sub_0912h(p1)
jp cret ;0334 ; }
; =============== F U N C T I O N ===========================================
; 9 sub_0337h ok++
;
sub_0337h: ; void sub_0337h() {
call sub_0487h ;0337 ; sub_0487h();
ld hl,sub_0317h ;033a ;
push hl ;033d ;
call sub_0621h ;033e ; sub_0621h(sub_0317h);
ld hl,sub_12d4h ;0341 ;
ex (sp),hl ;0344 ;
call sub_025bh ;0345 ; sub_025bh(sub_12d4h);
pop bc ;0348 ;
ret ;0349 ; }
; =============== F U N C T I O N ===========================================
; 10 sub_034ah ok++
;
sub_034ah: ; void sub_034ah() {
ld hl,l4179h ;034a ;
push hl ;034d ;
ld hl,l416eh ;034e ;
push hl ;0351 ;
call _fopen ;0352 ;
pop bc ;0355 ;
pop bc ;0356 ;
ld (word_4967),hl ;0357 ;
ld a,l ;035a ;
or h ;035b ;
ret nz ;035c ; if((word_4967 = fopen("libtmp.$$$", "wb")) == 0) {
ld hl,l416eh ;035d ;
push hl ;0360 ;
call sub_11c4h ;0361 ; sub_11c4h("libtmp.$$$");
pop bc ;0364 ; }
ret ;0365 ; }
; =============== F U N C T I O N ===========================================
; 11 sub_0366h ok++
;
sub_0366h: ; int sub_0366h(p1, p2, p3, p4) {
call csv ;0366 ;
ld l,(ix+00ch) ;0369 ;
ld h,(ix+00dh) ;p4 ;036c ;
push hl ;036f ;
ld l,(ix+00ah) ;0370 ;
ld h,(ix+00bh) ;p3 ;0373 ;
push hl ;0376 ;
ld l,(ix+008h) ;0377 ;
ld h,(ix+009h) ;p2 ;037a ;
push hl ;037d ;
ld l,(ix+006h) ;037e ;
ld h,(ix+007h) ;p1 ;0381 ;
push hl ;0384 ;
call sub_2355h ;0385 ;
pop bc ;0388 ;
pop bc ;0389 ;
pop bc ;038a ;
pop bc ;038b ;
ld (ix+008h),l ;038c ;
ld (ix+009h),h ;p2 ;038f ;
ld e,(ix+00ah) ;0392 ;
ld d,(ix+00bh) ;p3 ;0395 ;
or a ;0398 ;
sbc hl,de ;0399 ;
jr z,l03beh ;039b ; if((p2 = sub_2355h(p1, p2, p3, p4)) != p3) {
ld de,(word_4967) ;039d ;
ld l,(ix+00ch) ;03a1 ;
ld h,(ix+00dh) ;p4 ;03a4 ;
or a ;03a7 ;
sbc hl,de ;03a8 ;
jr z,l03b1h ;03aa ;
ld hl,l4198h ;"output" ;03ac ;
jr l03b4h ;03af ;
l03b1h: ; m1: ;
ld hl,l4193h ;"temp" ;03b1 ;
l03b4h: ; m2: ;
push hl ;03b4 ;
ld hl,l417ch ;03b5 ;
push hl ;03b8 ;
call sub_117ch ;03b9 ; sub_117ch("Write error on %s file", (p4 - word_4967 == 0) ? "temp" : "output");
pop bc ;03bc ;
pop bc ;03bd ;
l03beh: ; m3: ; }
ld l,(ix+008h) ;03be
ld h,(ix+009h) ;p2 ;03c1 ; return p2;
jp cret ;03c4 ; }
; =============== F U N C T I O N ===========================================
; 12 sub_03c7h ok++
;
sub_03c7h:
ld hl,(word_4967) ;03c7 ; void sub_03c7h() {
ld a,l ;03ca ;
or h ;03cb ;
ret z ;03cc ; if(word_4967 != 0) {
push hl ;03cd ;
call _fclose ;03ce ; fclose(word_4967);
ld hl,l416eh ;03d1 ;
ex (sp),hl ;03d4 ;
call _unlink ;03d5 ; unlink("libtmp.$$$");
pop bc ;03d8 ; }
ret ;03d9 ; }
; =============== F U N C T I O N ===========================================
; 13 sub_03dah ok++
;
sub_03dah: ; void sub_03dah(p1) {
call csv ;03da ; register * st;
ld l,(ix+006h) ;03dd ;
ld h,(ix+007h) ;p1 ;03e0 ;
ld (word_4758),hl ;03e3 ; word_4758 = p1;
ld hl,l419fh ;"rb" ;03e6 ;
push hl ;03e9 ;
ld hl,(word_4758) ;03ea ;
push hl ;03ed ;
call _fopen ;03ee ;
pop bc ;03f1 ;
pop bc ;03f2 ; word_4761 = fopen(word_4758, "rb")
ld (word_4761),hl ;03f3 ;
ld a,l ;03f6 ;
or h ;03f7 ;
jr nz,l0454h ;03f8 ; if(word_4761 != 0) goto m5;
ld hl,(word_4b7e) ;03fa ;
ld a,l ;03fd ;
or h ;03fe ;
jr z,l0409h ;03ff ; if(word_4b7e != 0) {
ld hl,(word_4758) ;0401 ;
push hl ;0404 ;
call sub_11c4h ;0405 ; sub_11c4h(word_4758)
pop bc ;0408 ; }
l0409h: ; m1: ;
ld hl,0002eh ;0409 ;
push hl ;040c ;
ld hl,(word_4758) ;040d ;
push hl ;0410 ;
call _strrchr ;0411 ;
pop bc ;0414 ;
pop bc ;0415 ;
push hl ;0416 ;
pop iy ;0417 ; st = strrchr(word_4758, 0x2E);
ld a,l ;0419 ;
or h ;041a ;
jr z,l043bh ;041b ; if(st == 0) goto m2;
ld hl,l41a2h ;".lib" ;041d ;
push hl ;0420 ;
push iy ;0421 ;
call strcmp ;0423 ;
pop bc ;0426 ;
pop bc ;0427 ;
ld a,l ;0428 ;
or h ;0429 ;
jr z,l0448h ;042a ; if(strcmp(st, ".lib") == 0) goto m3;
ld hl,l41a7h ;".LIB" ;042c ;
push hl ;042f ;
push iy ;0430 ;
call strcmp ;0432 ;
pop bc ;0435 ;
pop bc ;0436 ;
ld a,l ;0437 ;
or h ;0438 ;
jr z,l0448h ;0439 ; if(strcmp(st, ".LIB") == 0) goto m3;
l043bh: ; m2:
ld hl,(word_4758) ;043b ;
push hl ;043e ;
ld hl,l41ach ;043f ;
push hl ;0442 ;
call sub_124dh ;0443 ; sub_124dh("library file names should have .lib extension: %s", word_4758);
pop bc ;0446 ;
pop bc ;0447 ;
l0448h: ; m3:
ld hl,00000h ;0448 ;
ld (word_4752),hl ;044b ; word_4752 = 0;
l044eh: ; m4:
ld (word_474f),hl ;044e ; word_474f = 0;
jp cret ;0451 ;
l0454h: ; m5:
ld hl,(word_4761) ;0454 ;
push hl ;0457 ;
ld hl,00001h ;0458 ;
push hl ;045b ;
ld hl,00004h ;045c ;
push hl ;045f ;
ld hl,arry_4969 ;0460 ;
push hl ;0463 ;
call read1 ;0464 ;
pop bc ;0467 ;
pop bc ;0468 ;
pop bc ;0469 ;
pop bc ;046a ;
ld de,00001h ;046b ;
or a ;046e ;
sbc hl,de ;046f ;
call nz,sub_0d14h ;0471 ; if(read1(arry_4969, 4, 1, word_4761) != 1) sub_0d14h();
ld hl,arry_4969 ;0474 ;
push hl ;0477 ;
call sub_0c53h ;0478 ;
ld (word_4752),hl ;047b ; word_4752 = sub_0c53h(arry_4969);
ld hl,arry_496b ;047e ;
ex (sp),hl ;0481 ;
call sub_0c53h ;0482 ; word_474f = sub_0c53h(arry_496b);
jr l044eh ;0485 ;
; }
; =============== F U N C T I O N ===========================================
; 14 sub_0487h ok++
;
sub_0487h: ; void sub_0487h() {
ld hl,(word_4761) ;0487 ;
ld a,l ;048a ;
or h ;048b ;
ret z ;048c ; if(word_4761 == 0) return;
ld hl,l41deh ;048d ;
push hl ;0490 ;
ld hl,(word_4758) ;0491 ;
push hl ;0494 ;
call _fopen ;0495 ;
pop bc ;0498 ;
pop bc ;0499 ;
ld (word_4b6d),hl ;049a ;
ld a,l ;049d ;
or h ;049e ;
jr z,l04cdh ;049f ; if((word_4b6d = fopen(word_4758, "rb")) == 0) goto m1;
ld hl,00000h ;04a1 ;
push hl ;04a4 ;
ld de,(word_4752) ;04a5 ;
ld a,d ;04a9 ;
rla ;04aa ;
sbc a,a ;04ab ;
ld l,a ;04ac ;
ld h,a ;04ad ;
ex de,hl ;04ae ;
ld bc,00004h ;04af ;
add hl,bc ;04b2 ;
ex de,hl ;04b3 ;
ld bc,00000h ;04b4 ;
adc hl,bc ;04b7 ;
push hl ;04b9 ;
push de ;04ba ;
ld hl,(word_4b6d) ;04bb ;
push hl ;04be ;
call _fseek ;04bf ;
pop bc ;04c2 ;
pop bc ;04c3 ;
pop bc ;04c4 ;
pop bc ;04c5 ;
ld de,0ffffh ;04c6 ;
or a ;04c9 ;
sbc hl,de ;04ca ;
ret nz ;04cc ; if(fseek(word_4b6d,word_4752+4,0) != -1) return;
l04cdh: ; m1:
ld hl,(word_4758) ;04cd ;
push hl ;04d0 ;
call sub_11c4h ;04d1 ; sub_11c4h(word_4758);
pop bc ;04d4 ;
ret ;04d5 ; }
; =============== F U N C T I O N ===========================================
; 15 sub_04d6h ok++
;
sub_04d6h: ; void sub_04d6h() {
ld hl,(word_4b7c) ;04d6 ;
ld a,l ;04d9 ;
or h ;04da ;
jr z,l04e5h ;04db ; if(word_4b7c != 0)
ld hl,0x0005 ;04dd ;
push hl ;04e0 ;
call sub_12e8h ;04e1 ; sub_12e8h(5);
pop bc ;04e4 ;
l04e5h: ; m1: ;
ld hl,(word_4761) ;04e5 ;
ld a,l ;04e8 ;
or h ;04e9 ;
ret z ;04ea ; if(word_4761 == 0) return;
ld hl,00000h ;04eb ;
push hl ;04ee ;
ld de,00004h ;04ef ;
push hl ;04f2 ;
push de ;04f3 ;
ld hl,(word_4761) ;04f4 ;
push hl ;04f7 ;
call _fseek ;04f8 ;
pop bc ;04fb ;
pop bc ;04fc ;
pop bc ;04fd ;
pop bc ;04fe ;
ld de,0ffffh ;04ff ;
or a ;0502 ;
sbc hl,de ;0503 ;
jr z,l0533h ;0505 ; if(fseek(word_4761, 4, 0) != -1) {
ld hl,00000h ;0507 ;
push hl ;050a ;
ld de,(word_4752) ;050b ;
ld a,d ;050f ;
rla ;0510 ;
sbc a,a ;0511 ;
ld l,a ;0512 ;
ld h,a ;0513 ;
ex de,hl ;0514 ;
ld bc,00004h ;0515 ;
add hl,bc ;0518 ;
ex de,hl ;0519 ;
ld bc,00000h ;051a ;
adc hl,bc ;051d ;
push hl ;051f ;
push de ;0520 ;
ld hl,(word_4b6d) ;0521 ;
push hl ;0524 ;
call _fseek ;0525 ;
pop bc ;0528 ;
pop bc ;0529 ;
pop bc ;052a ;
pop bc ;052b ;
ld de,0ffffh ;052c ;
or a ;052f ;
sbc hl,de ;0530 ;
ret nz ;0532 ; if(fseek(word_4b6d, word_4752+4, 0) != -1) return;
l0533h: ; m2: ; }
ld hl,(word_4758) ;0533 ;
push hl ;0536 ;
call sub_11e5h ;0537 ; sub_11e5h(word_4758);
pop bc ;053a ;
ret ;053b ; }
; =============== F U N C T I O N ===========================================
; 16 sub_053ch ok++
;
sub_053ch: ; void sub_053ch() {
call csv ;053c ;
push hl ;053f ;
push hl ;0540 ;
ld hl,(word_4967) ;0541 ;
push hl ;0544 ;
call _fclose ;0545 ;
pop bc ;0548 ; fclose(word_4967);
ld hl,(word_4761) ;0549 ;
ld a,l ;054c ;
or h ;054d ;
jr z,l055ch ;054e ; if(word_4761 == 0) goto m1;
push hl ;0550 ;
call _fclose ;0551 ; fclose(word_4761);
ld hl,(word_4b6d) ;0554 ;
ex (sp),hl ;0557 ;
call _fclose ;0558 ; fclose(word_4b6d);
pop bc ;055b ;
l055ch: ; m1:
ld hl,l41e1h ;055c ;
push hl ;055f ;
ld hl,l416eh ;0560 ;
push hl ;0563 ;
call _fopen ;0564 ;
pop bc ;0567 ;
pop bc ;0568 ;
ld (word_4967),hl ;0569 ;
ld a,l ;056c ;
or h ;056d ;
jr nz,l0578h ;056e ; if((word_4967 = fopen("libtmp.$$$", "rb")) != 0) goto m2;
ld hl,l416eh ;0570 ;
push hl ;0573 ;
call sub_11c4h ;0574 ; sub_11c4h("libtmp.$$$");
pop bc ;0577 ;
l0578h: ; m2:
ld hl,l41e4h ;0578 ;
push hl ;057b ;
ld hl,(word_4758) ;057c ;
push hl ;057f ;
call _fopen ;0580 ;
pop bc ;0583 ;
pop bc ;0584 ;
ld (word_4761),hl ;0585 ;
ld a,l ;0588 ;
or h ;0589 ;
jr nz,l0594h ;058a ; if((word_4761 = fopen(word_4758, "wb")) != 0) goto m3;
ld hl,(word_4758) ;058c ;
push hl ;058f ;
call sub_11c4h ;0590 ; sub_11c4h(word_4758);
pop bc ;0593 ;
l0594h: ; m3:
ld hl,arry_4969 ;0594 ;
push hl ;0597 ;
ld hl,(word_475c) ;0598 ;
push hl ;059b ;
call sub_0c31h ;059c ; sub_0c31h(word_475c, &arry_4969);
pop bc ;059f ;
ld hl,arry_496b ;05a0 ;
ex (sp),hl ;05a3 ;
ld hl,(word_475a) ;05a4 ;
push hl ;05a7 ;
call sub_0c31h ;05a8 ; sub_0c31h(word_475a, arry_496b);
pop bc ;05ab ;
ld hl,(word_4761) ;05ac ;
ex (sp),hl ;\4 ;05af ;
ld hl,00004h ;05b0 ;
push hl ;\3 ;05b3 ;
ld hl,00001h ;05b4 ;
push hl ;\2 ;05b7 ;
ld hl,arry_4969 ;05b8 ;
push hl ;\1 ;05bb ;
call sub_0366h ;05bc ; sub_0366h(arry_4969, 1, 4, word_4761);
pop bc ;05bf ;
pop bc ;05c0 ;
pop bc ;05c1 ;
pop bc ;05c2 ;
ld (ix-004h),004h ;05c3 ;
ld (ix-003h),000h ;l2 ;05c7 ; l2 = 4;
jr l05f6h ;05cb ; goto m5;
l05cdh: ; m4:
ld l,(ix-002h) ;05cd ;
ld h,(ix-001h) ;l1 ;05d0 ;
push hl ;\3 ;05d3 ;
ld hl,00001h ;05d4 ;
push hl ;\2 ;05d7 ;
ld hl,arry_4969 ;05d8 ;
push hl ;\1 ;05db ;
call sub_0366h ;05dc ; sub_0366h(arry_4969, 1, l1, word_4761);
pop bc ;05df ;
pop bc ;05e0 ;
pop bc ;05e1 ;
pop bc ;05e2 ;
ld e,(ix-002h) ;05e3 ;
ld d,(ix-001h) ;l1 ;05e6 ;
ld l,(ix-004h) ;05e9 ;
ld h,(ix-003h) ;l2 ;05ec ;
add hl,de ;05ef ;
ld (ix-004h),l ;05f0 ;
ld (ix-003h),h ;l2 ;05f3 ; l2 += l1;
l05f6h: ; m5:
ld hl,(word_4967) ;05f6 ;
push hl ;\4 ;05f9 ;
ld hl,00200h ;05fa ;
push hl ;\3 ;05fd ;
ld hl,00001h ;05fe ;
push hl ;\2 ;0601 ;
ld hl,arry_4969 ;0602 ;
push hl ;\1 ;0605 ;
call read1 ;0606 ;
pop bc ;0609 ;
pop bc ;060a ;
pop bc ;060b ;
pop bc ;060c ;
ld (ix-002h),l ;060d ;
ld (ix-001h),h ;l1 ;0610 ;
ld a,l ;0613 ;
or h ;0614 ;
ld hl,(word_4761) ;\4 ;0615 ;
push hl ;0618 ;
jr nz,l05cdh ;0619 ; if(l1 = read1(arry_4969, 1, 1, word_4967) != 0) goto m4;
call _fclose ;061b ; fclose(word_4761);
jp cret ;061e ; }
; =============== F U N C T I O N ===========================================
; 17 sub_0621h ok++
;
sub_0621h: ; void sub_0621h(void (*p1)(char *, long)) {
call csv ;0621 ; int loc;
push hl ;0624 ;
ld hl,(word_474f) ;0625 ;
ld (ix-002h),l ;0628 ;
ld (ix-001h),h ;loc ;062b ; loc = word_474f;
jp l071bh ;062e ; goto m4;
l0631h: ; m1:
ld hl,(word_4761) ;0631 ;
push hl ;0634 ;
ld hl,00001h ;0635 ;
push hl ;0638 ;
ld hl,0000ch ;0639 ;
push hl ;063c ;
ld hl,arry_4969 ;063d ;
push hl ;0640 ;
call read1 ;0641 ;
pop bc ;0644 ;
pop bc ;0645 ;
pop bc ;0646 ;
pop bc ;0647 ;
ld de,00001h ;0648 ;
or a ;064b ;
sbc hl,de ;064c ;
call nz,sub_0d14h ;064e ; if(read1(arry_4969, 0xC, 1, word_4761) != 1) sub_0d14h();
ld hl,arry_4969 ;0651 ;
push hl ;0654 ;
call sub_0c53h ;0655 ;
ld (word_4b6f),hl ;0658 ; word_4b6f = sub_0c53h(arry_4969);
ld hl,arry_496b ;065b ;
ex (sp),hl ;065e ;
call sub_0c53h ;065f ;
ld (word_475f),hl ;0662 ; word_475f = sub_0c53h(arry_496b);
ld hl,arry_496d ;0665 ;
ex (sp),hl ;0668 ;
call sub_0c73h ;0669 ;
ld (word_4763),de ;long ;066c ;
ld (word_4765),hl ;0670 ; long_4763 = sub_0c73h(arry_496d);
ld hl,04971h ;0673 ;
ex (sp),hl ;0676 ;
call sub_0c73h ;0677 ;
ld (04b69h),de ;long ;067a ;
ld (04b6bh),hl ;067e ; long_4b69 = sub_0c73h(arry_4971);
ld hl,arry_4975 ;0681 ;
ex (sp),hl ;0684 ;
call sub_0cb3h ;0685 ; sub_0cb3h(arry_4975);
pop bc ;0688 ;
xor a ;0689 ;
ld (byte_4751),a ;068a ;
ld (byte_475e),a ;068d ; byte_475e = byte_4751 = 0;
ld de,(04b69h) ;long ;0690 ;
ld hl,(04b6bh) ;0694 ;
push hl ;0697 ;
push de ;0698 ;
ld hl,arry_4975 ;0699 ;
push hl ;069c ;
ld l,(ix+006h) ;069d ;
ld h,(ix+007h) ;p1 ;06a0 ;
call indir ;06a3 ; p1(arry_4975, long_4b69);
pop bc ;06a6 ;
pop bc ;06a7 ;
pop bc ;06a8 ;
ld a,(byte_475e) ;06a9 ;
or a ;06ac ;
jr nz,l06d9h ;06ad ; if(byte_475e != 0) goto m2;
ld hl,00001h ;06af ;
push hl ;06b2 ;
ld de,(word_4b6f) ;06b3 ;
ld a,d ;06b7 ;
rla ;06b8 ;
sbc a,a ;06b9 ;
ld l,a ;06ba ;
ld h,a ;06bb ;
push hl ;06bc ;
push de ;06bd ;
ld hl,(word_4761) ;06be ;
push hl ;06c1 ;
call _fseek ;06c2 ;
pop bc ;06c5 ;
pop bc ;06c6 ;
pop bc ;06c7 ;
pop bc ;06c8 ;
ld de,0ffffh ;06c9 ;
or a ;06cc ;
sbc hl,de ;06cd ;
jr nz,l06d9h ;06cf ; if(fseek(word_4761, word_4b6f, 1) != -1) goto m2;
ld hl,(word_4758) ;06d1 ;
push hl ;06d4 ;
call sub_11e5h ;06d5 ; sub_11e5h(word_4758);
pop bc ;06d8 ;
l06d9h: ; m2:
ld hl,(word_4b6d) ;06d9 ;
ld a,l ;06dc ;
or h ;06dd ;
jr z,l070eh ;06de ; if(word_4b6d == 0) goto m3;
ld a,(byte_4751) ;06e0 ;
or a ;06e3 ;
jr nz,l070eh ;06e4 ; if(byte_4751 != 0) goto m3;
ld hl,00001h ;06e6 ;
push hl ;06e9 ;
ld de,(word_4763) ;06ea ;
ld hl,(word_4765) ;06ee ;
push hl ;06f1 ;
push de ;06f2 ;
ld hl,(word_4b6d) ;06f3 ;
push hl ;06f6 ;
call _fseek ;06f7 ;
pop bc ;06fa ;
pop bc ;06fb ;
pop bc ;06fc ;
pop bc ;06fd ;
ld de,0ffffh ;06fe ;
or a ;0701 ;
sbc hl,de ;0702 ;
jr nz,l070eh ;0704 ; if(fseek(word_4b6d, word_4763, 1) != -1) goto m3;
ld hl,(word_4758) ;0706 ;
push hl ;0709 ;
call sub_11e5h ;070a ; sub_11e5h(word_4758);
pop bc ;070d ;
l070eh: ; m3:
ld l,(ix-002h) ;070e ;
ld h,(ix-001h) ;0711 ;
dec hl ;0714 ;
ld (ix-002h),l ;0715 ;
ld (ix-001h),h ;0718 ; --loc;
l071bh: ; m4:
ld a,(ix-002h) ;071b ;
or (ix-001h) ;071e ;
jp nz,l0631h ;0721 ; if(loc != 0) goto m1;
jp cret ;0724 ; }
; =============== F U N C T I O N ===========================================
; 18 sub_0727h ok++
;
sub_0727h: ; void sub_0727(void (*funptr)(char *, int)) {
call csv ;0727 ; int l1, l2;
push hl ;072a ;
push hl ;072b ;
ld hl,(word_475f) ;072c ;
ld (ix-002h),l ;072f ;
ld (ix-001h),h ;l1 ;0732 ; l1 = word_475f;
jr l0779h ;0735 ; goto m2;
l0737h: ; m1:
ld hl,(word_4761) ;0737 ;
push hl ;073a ;
call fgetc ;073b ;
pop bc ;073e ;
ld (ix-004h),l ;073f ;
ld (ix-003h),h ;l2 ;0742 ;
ld de,0ffffh ;0745 ;
or a ;0748 ;
sbc hl,de ;0749 ;
call z,sub_0d14h ;074b ; if((l2 = fgetc(word_4761)) == -1) sub_0d14h();
ld hl,l4767h ;074e ;
push hl ;0751 ;
call sub_0cb3h ;0752 ; sub_0cb3h(arry_4767);
pop bc ;0755 ;
ld l,(ix-004h) ;0756 ;
ld h,(ix-003h) ;l2 ;0759 ;
push hl ;075c ;
ld hl,l4767h ;075d ;
push hl ;0760 ;
ld l,(ix+006h) ;0761 ;
ld h,(ix+007h) ;p1 ;0764 ;
call indir ;0767 ; funptr(arry_4767, l2);
pop bc ;076a ;
pop bc ;076b ;
ld l,(ix-002h) ;076c ;
ld h,(ix-001h) ;l1 ;076f ;
dec hl ;0772 ;
ld (ix-002h),l ;0773 ;
ld (ix-001h),h ;l1 ;0776 ; --l1;
l0779h: ; m2:
ld a,(ix-002h) ;0779 ;
or (ix-001h) ;l1 ;077c ;
jr nz,l0737h ;077f ; if(l1 != 0) goto m1;
ld a,001h ;0781 ;
ld (byte_475e),a ;0783 ; byte_475e = 1;