-
Notifications
You must be signed in to change notification settings - Fork 0
/
C2500ROM64k.txt
1995 lines (1994 loc) · 87.8 KB
/
C2500ROM64k.txt
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
000037FC clr.l -(sp) ; execption gate
000037FE move.l d0,-(sp)
00003800 move.l d0,-(sp)
00003802 movem.l d1-d5/a0-a1,-(sp)
00003806 moveq #$FFFFFFFF,d0
00003808 move.l d0,$20(sp)
0000380C addq.l #1,(dword_101050).l
00003812 bfextu $2E(sp){4:10},d0
00003818 movea.l ($11853C).l,a0
0000381E addq.l #1,(a0,d0.l)
00003822 move.l d0,d1
00003824 lsl.l #4,d1
00003826 lea ($11753C).l,a0
0000382C adda.l d1,a0
0000382E move.l sp,-(sp)
00003830 move.l 8(a0),-(sp)
00003834 move.l d0,-(sp)
00003836 movea.l (a0),a0
00003838 jsr (a0)
0000383A adda.l #$C,sp
00003840 move.l (dword_101050).l,d1
00003846 subq.l #1,d1
00003848 bne.s loc_3872
0000384A bfextu $28(sp){5:3},d0
00003850 bhi.s loc_3872
00003852
00003852 loc_3852: ; CODE XREF: ROM:00003870j
00003852 move.l (dword_101054).l,d0
00003858 and.l (dword_101058).l,d0
0000385E bne.s loc_386A
00003860 clr.l (dword_101050).l
00003866 bra.w loc_375A
0000386A ; ---------------------------------------------------------------------------
0000386A
0000386A loc_386A: ; CODE XREF: ROM:0000385Ej
0000386A bsr.l sub_9E80
00003870 bra.s loc_3852
00003872 ; ---------------------------------------------------------------------------
00003872
00003872 loc_3872: ; CODE XREF: ROM:00003848j
00003872 ; ROM:00003850j
00003872 move.l d1,(dword_101050).l
00003878 movem.l (sp)+,d1-d5/a0-a1
0000387C move.l (sp)+,d0
0000387E addq.l #4,sp
00003880 adda.l (sp)+,sp
00003882 rte
003D0548 ; ¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦ S U B R O U T I N E ¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦
003D0548
003D0548 ; Attributes: bp-based frame
003D0548
003D0548 runcmd: ; CODE XREF: sub_3D0338+106p
003D0548
003D0548 var_1BC = -$1BC
003D0548 var_194 = -$194
003D0548 var_C8 = -$C8
003D0548 var_C4 = -$C4
003D0548 arg_4 = $C
003D0548 arg_8 = $10
003D0548 arg_C = $14
003D0548
003D0548 link a6,#-$194
003D054C movem.l d2-d7/a2-a5,-(sp)
003D0550 move.l arg_4(a6),d6
003D0554 move.l arg_8(a6),d5
003D0558 movea.l arg_C(a6),a5
003D055C move.l (a5),var_C8(a6)
003D0560 moveq #1,d2
003D0562 moveq #1,d3
003D0564 cmp.l d2,d5
003D0566 ble.s loc_3D05C8
003D0568 move.l a6,d4
003D056A addi.l #$FFFFFE70,d4
003D0570 lea 4(a5),a3
003D0574 lea var_C8(a6),a4
003D0578 lea var_C4(a6),a2
003D057C
003D057C loc_3D057C: ; CODE XREF: runcmd+7Ej
003D057C move.l d4,-(sp)
003D057E pea (unk_32).w
003D0582 move.l (a3),-(sp)
003D0584 bsr.l sub_3D3158
003D058A move.l d0,d1
003D058C lea $C(sp),sp
003D0590 blt.w loc_3D07DA
003D0594 move.l d2,d0
003D0596 add.l d1,d0
003D0598 moveq #$31,d7 ; '1'
003D059A cmp.l d0,d7
003D059C blt.w loc_3D07B4
003D05A0 tst.l d1
003D05A2 bne.s loc_3D05A8
003D05A4 move.l (a3),(a2)+
003D05A6 addq.l #1,d2
003D05A8
003D05A8 loc_3D05A8: ; CODE XREF: runcmd+5Aj
003D05A8 clr.l d0
003D05AA cmp.l d0,d1
003D05AC ble.s loc_3D05C0
003D05AE movea.l d4,a1
003D05B0 lea (a4,d2.l*4),a0
003D05B4
003D05B4 loc_3D05B4: ; CODE XREF: runcmd+76j
003D05B4 move.l (a1)+,(a0)+
003D05B6 addq.l #4,a2
003D05B8 addq.l #1,d2
003D05BA addq.l #1,d0
003D05BC cmp.l d0,d1
003D05BE bgt.s loc_3D05B4
003D05C0
003D05C0 loc_3D05C0: ; CODE XREF: runcmd+64j
003D05C0 addq.l #4,a3
003D05C2 addq.l #1,d3
003D05C4 cmp.l d3,d5
003D05C6 bgt.s loc_3D057C
003D05C8
003D05C8 loc_3D05C8: ; CODE XREF: runcmd+1Ej
003D05C8 lea var_C8(a6),a4
003D05CC clr.l (a4,d2.l*4)
003D05D0 tst.l d6
003D05D2 bne.s loc_3D05E2
003D05D4 clr.l -(sp)
003D05D6 pea (unk_11).w
003D05DA bsr.l signal
003D05E0 addq.l #8,sp
003D05E2
003D05E2 loc_3D05E2: ; CODE XREF: runcmd+8Aj
003D05E2 moveq #2,d0
003D05E4 trap #0
003D05E6 cmpi.l #$FFFFEFFF,d0
003D05EC bls.s loc_3D05F8
003D05EE neg.l d0
003D05F0 move.l d0,(dword_3D840C).l
003D05F6 moveq #$FFFFFFFF,d0
003D05F8
003D05F8 loc_3D05F8: ; CODE XREF: runcmd+A4j
003D05F8 move.l d0,d2
003D05FA bne.w loc_3D06B6
003D05FE move.l (dword_3D8464).l,d0
003D0604 move.l d0,d7
003D0606 subq.l #1,d7
003D0608 move.l d7,(dword_3D8464).l
003D060E subq.l #1,d0
003D0610 lea (signal).l,a2
003D0616 bmi.s loc_3D0650
003D0618 lea (off_3D843C).l,a3
003D061E
003D061E loc_3D061E: ; CODE XREF: runcmd+106j
003D061E move.l (dword_3D8464).l,d0
003D0624 movea.l (a3,d0.l*4),a0
003D0628 cmpa.l #off_3D8328,a0
003D062E beq.s loc_3D0642
003D0630 move.l $14(a0),-(sp)
003D0634 bsr.l sub_3D5A6C
003D063A addq.l #4,sp
003D063C move.l (dword_3D8464).l,d0
003D0642
003D0642 loc_3D0642: ; CODE XREF: runcmd+E6j
003D0642 move.l d0,d7
003D0644 subq.l #1,d7
003D0646 move.l d7,(dword_3D8464).l
003D064C subq.l #1,d0
003D064E bpl.s loc_3D061E
003D0650
003D0650 loc_3D0650: ; CODE XREF: runcmd+CEj
003D0650 clr.l -(sp)
003D0652 pea (unk_2).w
003D0656 jsr (a2)
003D0658 clr.l -(sp)
003D065A pea (unk_3).w
003D065E jsr (a2)
003D0660 clr.l -(sp)
003D0662 pea (unk_11).w
003D0666 jsr (a2)
003D0668 move.l a4,-(sp)
003D066A move.l var_C8(a6),-(sp)
003D066E bsr.l execvp
003D0674 lea $20(sp),sp
003D0678 move.l (dword_3D840C).l,d0
003D067E moveq #2,d7
003D0680 cmp.l d0,d7
003D0682 beq.s loc_3D0692
003D0684 move.l d0,-(sp)
003D0686 bsr.l strerror
003D068C addq.l #4,sp
003D068E move.l a0,d0
003D0690 bra.s loc_3D0698
003D0692 ; ---------------------------------------------------------------------------
003D0692
003D0692 loc_3D0692: ; CODE XREF: runcmd+13Aj
003D0692 move.l #aBadCommandOrFi,d0 ; "Bad command or file name"
003D0698
003D0698 loc_3D0698: ; CODE XREF: runcmd+148j
003D0698 move.l d0,-(sp)
003D069A move.l var_C8(a6),-(sp)
003D069E pea (aSS).l ; "%s: %s\n"
003D06A4 bsr.l printf
003D06AA clr.l -(sp)
003D06AC bsr.l _exit
003D06B2 lea $10(sp),sp
003D06B6
003D06B6 loc_3D06B6: ; CODE XREF: runcmd+B2j
003D06B6 tst.l d2
003D06B8 bge.s loc_3D06E0
003D06BA move.l #$10000000,-(sp)
003D06C0 pea (catchchild).l
003D06C6 pea (unk_11).w
003D06CA bsr.l __signal
003D06D0 pea (aVforkFailed).l ; "vfork failed"
003D06D6 bsr.l perror
003D06DC bra.w loc_3D07DA
003D06E0 ; ---------------------------------------------------------------------------
003D06E0
003D06E0 loc_3D06E0: ; CODE XREF: runcmd+170j
003D06E0 tst.l d6
003D06E2 beq.s loc_3D06F6
003D06E4 move.l d2,-(sp)
003D06E6 pea (aD).l ; "[%d]\n"
003D06EC bsr.l printf
003D06F2 bra.w loc_3D07DA
003D06F6 ; ---------------------------------------------------------------------------
003D06F6
003D06F6 loc_3D06F6: ; CODE XREF: runcmd+19Aj
003D06F6 tst.l d2
003D06F8 beq.w loc_3D07C8
003D06FC clr.l var_194(a6)
003D0700 clr.l (dword_3D822A).l
003D0706 lea (sub_3D60E4).l,a2
003D070C bra.s loc_3D0732
003D070E ; ---------------------------------------------------------------------------
003D070E
003D070E loc_3D070E: ; CODE XREF: runcmd+1FCj
003D070E cmp.l d0,d2
003D0710 beq.s loc_3D0732
003D0712 move.l d0,-(sp)
003D0714 bsr.l sub_3D5B80
003D071A move.l d0,-(sp)
003D071C pea (aShDChildDDied).l ; "sh %d: child %d died\n"
003D0722 pea (off_3D8378).l
003D0728 bsr.l fprintf
003D072E lea $10(sp),sp
003D0732
003D0732 loc_3D0732: ; CODE XREF: runcmd+1C4j
003D0732 ; runcmd+1C8j ...
003D0732 clr.l -(sp)
003D0734 clr.l -(sp)
003D0736 pea var_194(a6)
003D073A move.l d2,-(sp)
003D073C jsr (a2)
003D073E lea $10(sp),sp
003D0742 tst.l d0
003D0744 bge.s loc_3D070E
003D0746 moveq #4,d7
003D0748 cmp.l (dword_3D840C).l,d7
003D074E beq.s loc_3D0732
003D0750 move.l #$10000000,-(sp)
003D0756 pea (catchchild).l
003D075C pea (unk_11).w
003D0760 bsr.l __signal
003D0766 moveq #1,d7
003D0768 move.l d7,(dword_3D822A).l
003D076E move.b var_194+3(a6),d1
003D0772 lea $C(sp),sp
003D0776 beq.s loc_3D07DA
003D0778 moveq #$7F,d7 ; ''
003D077A and.l var_194(a6),d7
003D077E move.l d7,-(sp)
003D0780 move.l #aKilled,d0 ; "killed"
003D0786 tst.b d1
003D0788 bge.s loc_3D0790
003D078A move.l #aCoreDumped,d0 ; "core dumped"
003D0790
003D0790 loc_3D0790: ; CODE XREF: runcmd+240j
003D0790 move.l d0,-(sp)
003D0792 move.l d2,-(sp)
003D0794 pea (aPidDSSignalD).l ; "pid %d: %s (signal %d)\n"
003D079A pea (off_3D8378).l
003D07A0 bsr.l fprintf
003D07A6 pea (off_3D8378).l
003D07AC bsr.l fflush
003D07B2 bra.s loc_3D07DA
003D07B4 ; ---------------------------------------------------------------------------
003D07B4
003D07B4 loc_3D07B4: ; CODE XREF: runcmd+54j
003D07B4 pea (aTooManyArgum_0).l ; "Too many arguments\n"
003D07BA pea (off_3D8378).l
003D07C0 bsr.l fprintf
003D07C6 bra.s loc_3D07DA
003D07C8 ; ---------------------------------------------------------------------------
003D07C8
003D07C8 loc_3D07C8: ; CODE XREF: runcmd+1B0j
003D07C8 move.l (a5),-(sp)
003D07CA bsr.l perror
003D07D0 pea (unk_1).w
003D07D4 bsr.l exit
003D07DA
003D07DA loc_3D07DA: ; CODE XREF: runcmd+48j
003D07DA ; runcmd+194j ...
003D07DA movem.l var_1BC(a6),d2-d7/a2-a5
003D07E0 unlk a6
003D07E2 rts
003D07E2 ; End of function runcmd
003D4828
003D4828 ; ¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦ S U B R O U T I N E ¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦
003D4828
003D4828 ; Attributes: bp-based frame
003D4828
003D4828 fgets: ; CODE XREF: readfile+C6p
003D4828 ; ROM:003D2AE6p
003D4828 ; DATA XREF: ...
003D4828
003D4828 var_10 = -$10
003D4828 arg_0 = 8
003D4828 arg_4 = $C
003D4828 arg_8 = $10
003D4828
003D4828 link a6,#0
003D482C movem.l d2-d3/a2-a3,-(sp)
003D4830 movea.l arg_0(a6),a3
003D4834 movea.l arg_8(a6),a2
003D4838 move.l a3,d3
003D483A move.l arg_4(a6),d2
003D483E beq.s loc_3D4874
003D4840
003D4840 loc_3D4840: ; CODE XREF: fgets+4Aj
003D4840 movea.l (a2),a0
003D4842 cmpa.l 4(a2),a0
003D4846 bcs.s loc_3D4854
003D4848 move.l a2,-(sp)
003D484A bsr.l getc
003D4850 addq.l #4,sp
003D4852 bra.s loc_3D485A
003D4854 ; ---------------------------------------------------------------------------
003D4854
003D4854 loc_3D4854: ; CODE XREF: fgets+1Ej
003D4854 clr.l d0
003D4856 move.b (a0),d0
003D4858 addq.l #1,(a2)
003D485A
003D485A loc_3D485A: ; CODE XREF: fgets+2Aj
003D485A moveq #$FFFFFFFF,d1
003D485C cmp.l d0,d1
003D485E bne.s loc_3D4868
003D4860 cmp.l a3,d3
003D4862 bne.s loc_3D4874
003D4864 suba.l a0,a0
003D4866 bra.s loc_3D4884
003D4868 ; ---------------------------------------------------------------------------
003D4868
003D4868 loc_3D4868: ; CODE XREF: fgets+36j
003D4868 move.b d0,(a3)+
003D486A moveq #$A,d1
003D486C cmp.l d0,d1
003D486E beq.s loc_3D4874
003D4870 subq.l #1,d2
003D4872 bne.s loc_3D4840
003D4874
003D4874 loc_3D4874: ; CODE XREF: fgets+16j
003D4874 ; fgets+3Aj ...
003D4874 clr.b (a3)
003D4876 btst #1,$1A(a2)
003D487C seq d0
003D487E extb.l d0
003D4880 and.l d0,d3
003D4882 movea.l d3,a0
003D4884
003D4884 loc_3D4884: ; CODE XREF: fgets+3Ej
003D4884 move.l a0,d0
003D4886 movem.l var_10(a6),d2-d3/a2-a3
003D488C unlk a6
003D488E rts
003D0172 readfile: ; CODE XREF: sub_3D0080:loc_3D0162p
003D0172 ; ROM:003D0870p
003D0172
003D0172 var_1C = -$1C
003D0172 arg_0 = 8
003D0172
003D0172 link a6,#0
003D0176 movem.l d2-d4/a2-a5,-(sp)
003D017A movea.l arg_0(a6),a3
003D017E moveq #9,d4
003D0180 cmp.l (dword_3D8464).l,d4
003D0186 bge.s loc_3D019E
003D0188 pea (aTooManySourceF).l ; "Too many source files\n"
003D018E pea (off_3D8378).l
003D0194 bsr.l fprintf
003D019A bra.w loc_3D032E
003D019E ; ---------------------------------------------------------------------------
003D019E
003D019E loc_3D019E: ; CODE XREF: readfile+14j
003D019E lea (off_3D8328).l,a2
003D01A4 move.l a2,d2
003D01A6 tst.l a3
003D01A8 beq.s loc_3D01E0
003D01AA pea (aR_4).l ; "r"
003D01B0 clr.l -(sp)
003D01B2 pea ($FFFFFFFF).w
003D01B6 move.l a3,-(sp)
003D01B8 bsr.l sub_3D4A88
003D01BE movea.l a0,a2
003D01C0 lea $10(sp),sp
003D01C4 tst.l a2
003D01C6 bne.s loc_3D01E0
003D01C8 move.l a3,-(sp)
003D01CA bsr.l perror
003D01D0 bra.w loc_3D032E
003D01D4 ; ---------------------------------------------------------------------------
003D01D4
003D01D4 loc_3D01D4: ; CODE XREF: readfile+B8j
003D01D4 move.l a2,-(sp)
003D01D6 bsr.l sub_3D4C38
003D01DC bra.w loc_3D0328
003D01E0 ; ---------------------------------------------------------------------------
003D01E0
003D01E0 loc_3D01E0: ; CODE XREF: readfile+36j
003D01E0 ; readfile+54j
003D01E0 move.l (dword_3D8464).l,d0
003D01E6 lea (off_3D843C).l,a0
003D01EC move.l a2,(a0,d0.l*4)
003D01F0 addq.l #1,(dword_3D8464).l
003D01F6 move.l $14(a2),-(sp)
003D01FA bsr.l sub_3D5994
003D0200 move.l d0,d3
003D0202 addq.l #4,sp
003D0204 lea (fflush).l,a5
003D020A
003D020A loc_3D020A: ; CODE XREF: readfile+F4j
003D020A ; readfile+162j ...
003D020A pea (stdout).l
003D0210 jsr (a5)
003D0212 addq.l #4,sp
003D0214 cmp.l a2,d2
003D0216 bne.s loc_3D021C
003D0218 bsr.w showprompt
003D021C
003D021C loc_3D021C: ; CODE XREF: readfile+A4j
003D021C tst.l (dword_3D9009).l
003D0222 beq.s loc_3D022C
003D0224 tst.l d3
003D0226 bne.s loc_3D022C
003D0228 cmp.l a2,d2
003D022A bne.s loc_3D01D4
003D022C
003D022C loc_3D022C: ; CODE XREF: readfile+B0j
003D022C ; readfile+B4j
003D022C move.l a2,-(sp)
003D022E pea (off_FF).w
003D0232 pea (buf).l ; "sdc"
003D0238 bsr.l fgets
003D023E lea $C(sp),sp
003D0242 tst.l a0
003D0244 bne.s loc_3D0268
003D0246 move.l $18(a2),d0
003D024A btst #9,d0
003D024E beq.w loc_3D030A
003D0252 moveq #4,d4
003D0254 cmp.l (dword_3D840C).l,d4
003D025A bne.w loc_3D02E6
003D025E andi.w #$FCFF,d0
003D0262 move.l d0,$18(a2)
003D0266 bra.s loc_3D020A
003D0268 ; ---------------------------------------------------------------------------
003D0268
003D0268 loc_3D0268: ; CODE XREF: readfile+D2j
003D0268 pea (buf).l ; "sdc"
003D026E bsr.l strlen
003D0274 move.l d0,d1
003D0276 subq.l #1,d1
003D0278 lea (buf).l,a3 ; "sdc"
003D027E movea.l a3,a4
003D0280 addq.l #4,sp
003D0282 cmpi.b #$A,(a3,d1.l)
003D0288 bne.s loc_3D028C
003D028A move.l d1,d0
003D028C
003D028C loc_3D028C: ; CODE XREF: readfile+116j
003D028C tst.l d0
003D028E ble.s loc_3D02AA
003D0290 movea.l a3,a1
003D0292
003D0292 loc_3D0292: ; CODE XREF: readfile+136j
003D0292 movea.l d0,a0
003D0294 subq.l #1,a0
003D0296 move.b (a0,a1.l),d1
003D029A cmpi.b #$20,d1 ; ' '
003D029E beq.s loc_3D02A6
003D02A0 cmpi.b #9,d1
003D02A4 bne.s loc_3D02AA
003D02A6
003D02A6 loc_3D02A6: ; CODE XREF: readfile+12Cj
003D02A6 move.l a0,d0
003D02A8 bgt.s loc_3D0292
003D02AA
003D02AA loc_3D02AA: ; CODE XREF: readfile+11Cj
003D02AA ; readfile+132j
003D02AA clr.b (a4,d0.l)
003D02AE cmp.l a2,d2
003D02B0 beq.s loc_3D02C2
003D02B2 move.l a3,-(sp)
003D02B4 pea (aCommandS).l ; "Command: %s\n"
003D02BA bsr.l printf
003D02C0 addq.l #8,sp
003D02C2
003D02C2 loc_3D02C2: ; CODE XREF: readfile+13Ej
003D02C2 movea.l a3,a0
003D02C4 bra.s loc_3D02C8
003D02C6 ; ---------------------------------------------------------------------------
003D02C6
003D02C6 loc_3D02C6: ; CODE XREF: readfile+15Cj
003D02C6 addq.l #1,a0
003D02C8
003D02C8 loc_3D02C8: ; CODE XREF: readfile+152j
003D02C8 move.b (a0),d0
003D02CA cmpi.b #$20,d0 ; ' '
003D02CE beq.s loc_3D02C6
003D02D0 cmpi.b #$23,d0 ; '#'
003D02D4 beq.w loc_3D020A
003D02D8 pea (buf).l ; "sdc"
003D02DE bsr.s command
003D02E0 addq.l #4,sp
003D02E2 bra.w loc_3D020A
003D02E6 ; ---------------------------------------------------------------------------
003D02E6
003D02E6 loc_3D02E6: ; CODE XREF: readfile+E8j
003D02E6 btst #9,d0
003D02EA beq.s loc_3D030A
003D02EC pea (aReadingCommand).l ; "Reading command line"
003D02F2 bsr.l perror
003D02F8 addq.l #4,sp
003D02FA cmp.l a2,d2
003D02FC bne.s loc_3D030A
003D02FE pea (unk_1).w
003D0302 bsr.l exit
003D0308 addq.l #4,sp
003D030A
003D030A loc_3D030A: ; CODE XREF: readfile+DCj
003D030A ; readfile+178j ...
003D030A andi.w #$FCFF,$1A(a2)
003D0310 cmp.l a2,d2
003D0312 beq.s loc_3D0328
003D0314 move.l a2,-(sp)
003D0316 bsr.l sub_3D4C38
003D031C pea (aExecutionFinis).l ; "Execution Finished, Exiting\n"
003D0322 bsr.l printf
003D0328
003D0328 loc_3D0328: ; CODE XREF: readfile+6Aj
003D0328 ; readfile+1A0j
003D0328 subq.l #1,(dword_3D8464).l
003D032E
003D032E loc_3D032E: ; CODE XREF: readfile+28j
003D032E ; readfile+5Ej
003D032E movem.l var_1C(a6),d2-d4/a2-a5
003D0334 unlk a6
003D0336 rts
003D4828
003D4828 ; ¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦ S U B R O U T I N E ¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦
003D4828
003D4828 ; Attributes: bp-based frame
003D4828
003D4828 fgets: ; CODE XREF: readfile+C6p
003D4828 ; ROM:003D2AE6p
003D4828 ; DATA XREF: ...
003D4828
003D4828 var_10 = -$10
003D4828 arg_0 = 8
003D4828 arg_4 = $C
003D4828 arg_8 = $10
003D4828
003D4828 link a6,#0
003D482C movem.l d2-d3/a2-a3,-(sp)
003D4830 movea.l arg_0(a6),a3
003D4834 movea.l arg_8(a6),a2
003D4838 move.l a3,d3
003D483A move.l arg_4(a6),d2
003D483E beq.s loc_3D4874
003D4840
003D4840 loc_3D4840: ; CODE XREF: fgets+4Aj
003D4840 movea.l (a2),a0
003D4842 cmpa.l 4(a2),a0
003D4846 bcs.s loc_3D4854
003D4848 move.l a2,-(sp)
003D484A bsr.l getc
003D4850 addq.l #4,sp
003D4852 bra.s loc_3D485A
003D4854 ; ---------------------------------------------------------------------------
003D4854
003D4854 loc_3D4854: ; CODE XREF: fgets+1Ej
003D4854 clr.l d0
003D4856 move.b (a0),d0
003D4858 addq.l #1,(a2)
003D485A
003D485A loc_3D485A: ; CODE XREF: fgets+2Aj
003D485A moveq #$FFFFFFFF,d1
003D485C cmp.l d0,d1
003D485E bne.s loc_3D4868
003D4860 cmp.l a3,d3
003D4862 bne.s loc_3D4874
003D4864 suba.l a0,a0
003D4866 bra.s loc_3D4884
003D4868 ; ---------------------------------------------------------------------------
003D4868
003D4868 loc_3D4868: ; CODE XREF: fgets+36j
003D4868 move.b d0,(a3)+
003D486A moveq #$A,d1
003D486C cmp.l d0,d1
003D486E beq.s loc_3D4874
003D4870 subq.l #1,d2
003D4872 bne.s loc_3D4840
003D4874
003D4874 loc_3D4874: ; CODE XREF: fgets+16j
003D4874 ; fgets+3Aj ...
003D4874 clr.b (a3)
003D4876 btst #1,$1A(a2)
003D487C seq d0
003D487E extb.l d0
003D4880 and.l d0,d3
003D4882 movea.l d3,a0
003D4884
003D4884 loc_3D4884: ; CODE XREF: fgets+3Ej
003D4884 move.l a0,d0
003D4886 movem.l var_10(a6),d2-d3/a2-a3
003D488C unlk a6
003D488E rts
003D488E ; End of function fgets
003D46A8
003D46A8 ; ¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦ S U B R O U T I N E ¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦
003D46A8
003D46A8 ; Attributes: bp-based frame
003D46A8
003D46A8 getc: ; CODE XREF: ROM:003D15CAp
003D46A8 ; fgets+22p
003D46A8
003D46A8 var_4 = -4
003D46A8 arg_0 = 8
003D46A8
003D46A8 link a6,#0
003D46AC move.l a2,-(sp)
003D46AE movea.l arg_0(a6),a2
003D46B2 bsr.l sub_3D44FC
003D46B8 tst.b $1B(a2)
003D46BC bge.s loc_3D46C8
003D46BE move.l a2,-(sp)
003D46C0 bsr.l fflush
003D46C6 addq.l #4,sp
003D46C8
003D46C8 loc_3D46C8: ; CODE XREF: getc+14j
003D46C8 move.l $18(a2),d0
003D46CC andi.l #$310,d0
003D46D2 moveq #$10,d1
003D46D4 cmp.l d0,d1
003D46D6 bne.s loc_3D4704
003D46D8 movea.l (a2),a0
003D46DA cmpa.l 4(a2),a0
003D46DE bcs.s loc_3D471C
003D46E0 move.l $C(a2),d0
003D46E4 move.l d0,4(a2)
003D46E8 move.l d0,(a2)
003D46EA move.l a2,-(sp)
003D46EC move.l $10(a2),d1
003D46F0 sub.l d0,d1
003D46F2 move.l d1,-(sp)
003D46F4 pea (unk_1).w
003D46F8 move.l d0,-(sp)
003D46FA bsr.l sub_3D48EC
003D4700 tst.l d0
003D4702 bne.s loc_3D4708
003D4704
003D4704 loc_3D4704: ; CODE XREF: getc+2Ej
003D4704 moveq #$FFFFFFFF,d0
003D4706 bra.s loc_3D4722
003D4708 ; ---------------------------------------------------------------------------
003D4708
003D4708 loc_3D4708: ; CODE XREF: getc+5Aj
003D4708 add.l d0,4(a2)
003D470C moveq #$40,d0 ; '@'
003D470E or.l $18(a2),d0
003D4712 andi.w #$FBFF,d0
003D4716 move.l d0,$18(a2)
003D471A movea.l (a2),a0
003D471C
003D471C loc_3D471C: ; CODE XREF: getc+36j
003D471C clr.l d0
003D471E move.b (a0),d0
003D4720 addq.l #1,(a2)
003D4722
003D4722 loc_3D4722: ; CODE XREF: getc+5Ej
003D4722 movea.l var_4(a6),a2
003D4726 unlk a6
003D4728 rts
003D4728 ; End of function getc
003D4728
003D48EC ; ¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦ S U B R O U T I N E ¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦
003D48EC
003D48EC ; Attributes: bp-based frame
003D48EC
003D48EC sagasuchuu: ; CODE XREF: ROM:003D29D2p
003D48EC ; getc+52p
003D48EC ; DATA XREF: ...
003D48EC
003D48EC var_1C = -$1C
003D48EC arg_0 = 8
003D48EC arg_4 = $C
003D48EC arg_8 = $10
003D48EC arg_C = $14
003D48EC
003D48EC link a6,#0
003D48F0 movem.l d2-d6/a2-a3,-(sp)
003D48F4 movea.l arg_0(a6),a3
003D48F8 move.l arg_4(a6),d5
003D48FC movea.l arg_C(a6),a2
003D4900 clr.l d4
003D4902 bsr.l sub_3D44FC
003D4908 move.l $18(a2),d2
003D490C tst.b d2
003D490E bge.s loc_3D491A
003D4910 move.l a2,-(sp)
003D4912 bsr.l fflush
003D4918 addq.l #4,sp
003D491A
003D491A loc_3D491A: ; CODE XREF: sagasuchuu+22j
003D491A andi.l #$310,d2
003D4920 moveq #$10,d6
003D4922 cmp.l d2,d6
003D4924 beq.s loc_3D492A
003D4926 clr.l d0
003D4928 bra.s loc_3D4998
003D492A ; ---------------------------------------------------------------------------
003D492A
003D492A loc_3D492A: ; CODE XREF: sagasuchuu+38j
003D492A move.l d5,d3
003D492C muls.l arg_8(a6),d3
003D4932 move.l (a2),d0
003D4934 move.l 4(a2),d2
003D4938 sub.l d0,d2
003D493A cmp.l d2,d3
003D493C bhi.s loc_3D4950
003D493E move.l d3,-(sp)
003D4940 move.l d0,-(sp)
003D4942 move.l a3,-(sp)
003D4944 bsr.l sub_3D5910
003D494A add.l d3,(a2)
003D494C move.l d3,d0
003D494E bra.s loc_3D4998
003D4950 ; ---------------------------------------------------------------------------
003D4950
003D4950 loc_3D4950: ; CODE XREF: sagasuchuu+50j
003D4950 tst.l d2
003D4952 ble.s loc_3D4966
003D4954 move.l d2,-(sp)
003D4956 move.l d0,-(sp)
003D4958 move.l a3,-(sp)
003D495A bsr.l sub_3D5910
003D4960 move.l d2,d4
003D4962 lea $C(sp),sp
003D4966
003D4966 loc_3D4966: ; CODE XREF: sagasuchuu+66j
003D4966 sub.l d4,d3
003D4968 move.l d3,-(sp)
003D496A pea (a3,d4.l)
003D496E move.l $14(a2),-(sp)
003D4972 bsr.l sub_3D5DF8
003D4978 move.l d0,d2
003D497A bge.s loc_3D4986
003D497C ori.w #$200,$1A(a2)
003D4982 clr.l d2
003D4984 bra.s loc_3D4990
003D4986 ; ---------------------------------------------------------------------------
003D4986
003D4986 loc_3D4986: ; CODE XREF: sagasuchuu+8Ej
003D4986 tst.l d2
003D4988 bne.s loc_3D4990
003D498A ori.w #$100,$1A(a2)
003D4990
003D4990 loc_3D4990: ; CODE XREF: sagasuchuu+98j
003D4990 ; sagasuchuu+9Cj
003D4990 move.l d4,d0
003D4992 add.l d2,d0
003D4994 divu.l d5,d0
003D4998
003D4998 loc_3D4998: ; CODE XREF: sagasuchuu+3Cj
003D4998 ; sagasuchuu+62j
003D4998 movem.l var_1C(a6),d2-d6/a2-a3
003D499E unlk a6
003D49A0 rts
003D49A0 ; End of function sagasuchuu
00002F04 loc_2F04: ; DATA XREF: sub_2FA8+ECo
00002F04 move.l d3,-(sp)
00002F06 move.l d2,-(sp)
00002F08 movea.l (off_593B0).l,a0
00002F0E tst.l a0
00002F10 beq.s loc_2F14
00002F12 jsr (a0)
00002F14
00002F14 loc_2F14: ; CODE XREF: ROM:00002F10j
00002F14 move.l $14(sp),-(sp)
00002F18 bsr.l sub_5838
00002F1E addq.w #4,sp
00002F20 moveq #5,d3
00002F22 cmp.l (dword_FE0EC).l,d3
00002F28 beq.s loc_2FA2
00002F2A move.l (dword_59448).l,d0
00002F30 addi.l #$294,d0
00002F36 cmp.l (dword_118744).l,d0
00002F3C bge.s loc_2FA2
00002F3E move.l (off_FE0D8).l,d0
00002F44 move.l d0,d2
00002F46 asr.l #1,d2
00002F48 move.l #unk_7A120,d0
00002F4E sub.l d2,d0
00002F50 move.l (off_118748).l,d1
00002F56 cmp.l d1,d0
00002F58 bge.s loc_2FA2
00002F5A move.l d2,d0
00002F5C addi.l #unk_7A120,d0
00002F62 cmp.l d1,d0
00002F64 ble.s loc_2FA2
00002F66 move.l (dword_118744).l,d0
00002F6C movea.l (dword_593E4).l,a0
00002F72 tst.l a0
00002F74 beq.s loc_2F7E
00002F76 move.l d0,-(sp)
00002F78 jsr (a0)
00002F7A addq.w #4,sp
00002F7C bra.s loc_2F80
00002F7E ; ---------------------------------------------------------------------------
00002F7E
00002F7E loc_2F7E: ; CODE XREF: ROM:00002F74j
00002F7E moveq #$FFFFFFFF,d0
00002F80
00002F80 loc_2F80: ; CODE XREF: ROM:00002F7Cj
00002F80 tst.l d0
00002F82 bne.s loc_2F90
00002F84 move.l (dword_118744).l,(dword_59448).l
00002F8E bra.s loc_2FA2
00002F90 ; ---------------------------------------------------------------------------
00002F90
00002F90 loc_2F90: ; CODE XREF: ROM:00002F82j
00002F90 move.l (dword_118744).l,d3
00002F96 addi.l #$FFFFFDA8,d3
00002F9C move.l d3,(dword_59448).l
00002FA2
00002FA2 loc_2FA2: ; CODE XREF: ROM:00002F28j
00002FA2 ; ROM:00002F3Cj ...
00002FA2 move.l (sp)+,d2
00002FA4 move.l (sp)+,d3
00002FA6 rts
0004C1DC
0004C1DC ; ¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦ S U B R O U T I N E ¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦
0004C1DC
0004C1DC ; Attributes: bp-based frame
0004C1DC
0004C1DC sub_4C1DC: ; DATA XREF: sub_3C54+1Ao
0004C1DC ; ROM:off_593B0o
0004C1DC
0004C1DC var_108 = -$108
0004C1DC var_102 = -$102
0004C1DC var_1 = -1
0004C1DC
0004C1DC link a6,#-$104
0004C1E0 move.l a2,-(sp)
0004C1E2 movea.l (off_11470C).l,a2
0004C1E8 movea.l #$2120100,a1
0004C1EE move.b ($2120101).l,d0
0004C1F4 btst #3,d0
0004C1F8 beq.s loc_4C202
0004C1FA move.b ($212010F).l,var_1(a6)
0004C202
0004C202 loc_4C202: ; CODE XREF: sub_4C1DC+1Cj
0004C202 clr.l d1
0004C204 move.b ($2120101).l,d0
0004C20A btst #0,d0
0004C20E beq.s loc_4C226
0004C210
0004C210 loc_4C210: ; CODE XREF: sub_4C1DC+48j
0004C210 lea (a6,d1.l),a0
0004C214 move.b 3(a1),-$102(a0)
0004C21A addq.l #1,d1
0004C21C move.b 1(a1),d0
0004C220 btst #0,d0
0004C224 bne.s loc_4C210
0004C226
0004C226 loc_4C226: ; CODE XREF: sub_4C1DC+32j
0004C226 tst.l d1
0004C228 beq.s loc_4C23E
0004C22A move.l d1,-(sp)
0004C22C clr.l -(sp)
0004C22E pea var_102(a6)
0004C232 move.l a2,-(sp)
0004C234 movea.l $CE(a2),a0
0004C238 jsr (a0)
0004C23A addq.w #8,sp
0004C23C addq.w #8,sp
0004C23E
0004C23E loc_4C23E: ; CODE XREF: sub_4C1DC+4Cj
0004C23E movea.l var_108(a6),a2
0004C242 unlk a6
0004C244 rts
0004C244 ; End of function sub_4C1DC
0004C244
0004C244 ; ---------------------------------------------------------------------------
0004C246 aConsoleDuart: dc.b 'Console duart',0
0004F5E4 link a6,#-$44
0004F5E8 movem.l d2-d7/a2-a5,-(sp)
0004F5EC movea.l 8(a6),a2
0004F5F0 move.l $C(a6),d4
0004F5F4 move.l $14(a6),d2
0004F5F8 clr.b -$41(a6)
0004F5FC movea.l $96A(a2),a1
0004F600 tst.l a1
0004F602 beq.w loc_4FEA4
0004F606 btst #4,$93E(a2)
0004F60C beq.w loc_4F6B2
0004F610 movea.l $96E(a2),a0
0004F614 move.l #$1000,d1
0004F61A sub.l a0,d1
0004F61C move.l #$1000,d0
0004F622 sub.l $976(a2),d0
0004F626 cmp.l d0,d1
0004F628 bge.s loc_4F62C
0004F62A move.l d1,d0
0004F62C
0004F62C loc_4F62C: ; CODE XREF: ROM:0004F628j
0004F62C move.l d2,d5
0004F62E cmp.l d5,d0
0004F630 bge.s loc_4F634
0004F632 move.l d0,d5
0004F634
0004F634 loc_4F634: ; CODE XREF: ROM:0004F630j
0004F634 move.l d5,-(sp)
0004F636 pea (a0,a1.l)
0004F63A move.l d4,-(sp)
0004F63C lea (sub_58C62).l,a3
0004F642 jsr (a3)
0004F644 addq.w #8,sp
0004F646 addq.w #4,sp
0004F648 move.l $96E(a2),d0
0004F64C add.l d5,d0
0004F64E andi.l #$FFF,d0
0004F654 move.l d0,$96E(a2)
0004F658 move.l $976(a2),d0
0004F65C add.l d5,d0
0004F65E move.l d0,$976(a2)
0004F662 add.l d5,d4
0004F664 sub.l d5,d2
0004F666 move.l $96E(a2),d3
0004F66A move.l #$1000,d1
0004F670 sub.l d3,d1
0004F672 move.l #$1000,d7
0004F678 sub.l d0,d7
0004F67A move.l d7,d0
0004F67C cmp.l d0,d1
0004F67E bge.s loc_4F682
0004F680 move.l d1,d0
0004F682
0004F682 loc_4F682: ; CODE XREF: ROM:0004F67Ej
0004F682 move.l d2,d5
0004F684 cmp.l d5,d0
0004F686 bge.s loc_4F68A
0004F688 move.l d0,d5
0004F68A
0004F68A loc_4F68A: ; CODE XREF: ROM:0004F686j
0004F68A move.l d5,-(sp)
0004F68C add.l $96A(a2),d3
0004F690 move.l d3,-(sp)
0004F692 move.l d4,-(sp)
0004F694 jsr (a3)
0004F696 addq.w #8,sp
0004F698 addq.w #4,sp
0004F69A move.l $96E(a2),d0
0004F69E add.l d5,d0
0004F6A0 andi.l #$FFF,d0
0004F6A6 move.l d0,$96E(a2)
0004F6AA add.l d5,$976(a2)
0004F6AE bra.w loc_4FE30
0004F6B2 ; ---------------------------------------------------------------------------
0004F6B2
0004F6B2 loc_4F6B2: ; CODE XREF: ROM:0004F60Cj
0004F6B2 move.l d2,d5
0004F6B4 movea.l d4,a4
0004F6B6 movea.l $10(a6),a3
0004F6BA beq.w loc_4FE22
0004F6BE clr.l d6
0004F6C0
0004F6C0 loc_4F6C0: ; CODE XREF: ROM:0004FE1Ej
0004F6C0 tst.l a3
0004F6C2 beq.s loc_4F6C8
0004F6C4 move.b (a3)+,-$41(a6)
0004F6C8
0004F6C8 loc_4F6C8: ; CODE XREF: ROM:0004F6C2j
0004F6C8 move.b -$41(a6),d0
0004F6CC extb.l d0
0004F6CE moveq #4,d7
0004F6D0 cmp.l d0,d7
0004F6D2 bcs.w loc_4FE00
0004F6D6 move.w word_4F6DE(pc,d0.l*2),d0
0004F6DA jmp word_4F6DE(pc,d0.w)
0004F6DA ; ---------------------------------------------------------------------------
0004F6DE word_4F6DE: dc.w $A
0004F6E0 dc.w $52C
0004F6E2 dc.w $5FA