-
Notifications
You must be signed in to change notification settings - Fork 18
/
Copy pathdasm-11
executable file
·3763 lines (3286 loc) · 122 KB
/
dasm-11
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
#!/usr/bin/perl -w
# $Id: dasm-11 1286 2022-08-25 06:53:38Z mueller $
# SPDX-License-Identifier: GPL-3.0-or-later
# Copyright 2008-2022 by Walter F.J. Mueller <[email protected]>
#
# Revision History:
# Date Rev Version Comment
# 2022-08-25 1286 1.4.12 add -I, .:$RETROBASE/tools/dasm-11/lib default path
# 2022-06-09 1246 1.4.11 fix -help, fix -dmode allowed values
# 2019-07-13 1189 1.4.10 drop superfluous exists for $opts
# 2019-05-07 1147 1.4.9 two bugfixes
# 2018-12-18 1089 1.4.8 add and use bailout
# 2013-04-02 503 1.4.7 BUGFIX: correct xor and fpp, now proper rg,gr form
# fix ccops, macro-11 compliant <sec|sen> like output
# 2013-04-01 502 1.4.6 allow input from STDIN ('-' as file name)
# 2013-02-23 492 1.4.5 renamed disasm->dasm-11
# 2010-04-26 284 1.4.4 add error check for GetOptions
# 2009-09-19 239 1.4.3 use %cp.psw for new psw in mov-mov-rti sequences
# 2009-07-04 231 1.4.2 propper from addr in "location not typed '.vect'.."
# 2009-06-20 227 1.4.1 BUGFIX: S### label to 2nd imm/ind now correct;
# BUGFIX: [IN]### autolabel only when no symbolization
# add character symbolization in asci[iz] via @chars
# 2009-06-14 226 1.4 support use=xxx after .type directive; support
# op[12]sym=xxx in null directive; cleanup vect.psw
# handling; support sym mode "."; .ascooo support;
# tag data when target in mov #addr,<pointer> is typed
# BUGFIX: now correct comment for mov #nnn,<vect*>
# 2009-06-11 225 1.3.10 support user auto-labels (xx*:)
# 2009-05-31 221 1.3.9 terminator of type*[] lists now word tagged;
# allow trailing ,code in .struct; add .tryret
# 2009-05-24 219 1.3.8 catch asciz tags running over end-of-mem; add --ttlc
# proper labcref handling for pointes in typlabcref()
# 2009-05-09 213 1.3.7 preliminary addition of cis instructions
# 2009-05-02 212 1.3.6 add @data {comstr} attribute -> full string comments
# 2009-04-26 209 1.3.5 fix print_usage();
# 2009-04-25 208 1.3.4 add vector name to vector setup lcomm
# 2009-04-12 207 1.3.3 add lcomm for all vector setup's
# 2009-04-09 205 1.3.2 no code tag for 0 after mov #0; datsym all Pxxx vars
# add --info to enable -I messages.
# 2009-04-05 204 1.3.1 add lblind option/handl.; add fp11-c maint. opcodes
# scomm non 1170 opcodes; reformat scomm's;
# add .patch
# 2009-04-04 203 1.3 don't follow NULL prt for <type>*; add .code!;
# code tag .vect handler; add anoemt option/handling
# don't emitt unused gsym's; add lblimm option/handl.
# don't V label catcher setup; add .susp option
# 2009-03-29 202 1.2.6 add {anno} attributes; handle %symset of 0 correctly
# 2009-03-27 201 1.2.5 correct usage of symchr option
# 2009-03-22 200 1.2.4 add forgotten $dsc->{pc_seq} to fpp instructions
# handle mov #nnn,pc; handle sob labels
# annotate fpp instructions
# 2008-07-13 158 1.2.3 fix jmp@xxx and jsr rx,@xxx; add label upgrades;
# implement cref output
# 2008-07-11 157 1.2.2 added .enabl/.dsabl support (sym***,lbliot);
# support use= attribute, use symset's in symbolize
# 2008-07-04 156 1.2.1 added dmp.gz support; add scomm for asci pointers
# 2008-06-29 155 1.2 Many improvements (new typespec system,...)
# 2008-06-22 154 1.1 Many improvements (labels, symsets, ....)
# 2008-06-18 153 1.0 Initial version
#
# Format of 'das' DisAssember Steering file:
#
# # das comment (not visible in output)
# @<fname> {read nested das file}
# .symbol <symbol> = <addr> <alist>
# .symset <symset> = <set definition>
# .struct <tlist> {defines a structure}
# .params (iot|bpt) <list of .word directives>
# .params (trap|emt) ooo[:ooo] <list of .word directives>
# ; line comment, will preceed the next statement
# oooooo : [label:] directive [;comment]
#
# with
# directives
# <none> --> just set label for location and/or comment
#
# .params <list of .word directives> --> params for jsr at oooooo
#
# .enabl <opt> [<val>]
# .dsabl <opt> [<val>]
# with
# symchr --> convert byte immediates -> #'x if ascii char
# symimm ooo --> convert word immediates -> #label if match and >ooo
# symind ooo --> convert index -> label if match and >ooo
# lbliot ooo --> auto label and scomm iot statements (start with ooo)
# anoemt ooo --> annotate emt instructions
# lblimm --> auto-create label for an immediate value
# lblind --> auto-create label for an index value
#
# .byte --> byte
# .ascii n --> .ascii /.../
# .asciz --> .asciz /.../
# .ascooo --> .ascii /.../ up to ooo terminator
# .code --> start of code sequence
# .vect --> interrupt/trap vector
# .<typespec> <alist>
# .params <tlist>
# .susp <option>
# .patch <addr> <value>
#
# Generated label types
# Annn: asciz/ascii targets {is a .asciz/.ascii directive}
# Bnnn: branch targets {from branch instructions}
# Rnnn: call targets {from jsr instructions}
# Cnnn: code targets {from jmp instructions}
# Dnnn: data targets {from memory access of an instruction}
# Innn: {from lblimm [anno=1]}
# Lnnn: das code start {from nnn: .code}
# Nnnn: {from lblind [anno=1]}
# Pnnn: pointer targets
# Snnn+: pointing into an instruction {self referencing/modifying code}
# Vnnn: vector handler {from mv #nnn,@#<vector>}
#
# ltyp/dtyp on cross refrence table
# ltyp
# albl auto-label from code following
# asym ? seems from lblimm or lblind
# data label from das (for data and code)
# gsym ? seems from .symbol or .symset
# rlbl (comes always with vect.psw)
#
# dtyp
# word 16 bit data word
# byte 8 bit data byte
# code instruction, opcode part
# code.imm instruction, immediate value part
# code.ind instruction, index value part
# vect interrupt vector, pointer to handler
# vect.psw interrupt vector, new psw value
# ascii ascii string value (not zero terminated)
# asciz ascii string zero terminated
# ascooo ascii string <ooo> terminated
# rad50 rad50 encoded string
# flt2 single precision float
# flt4 double precision float
# <type>* pointer to an address holding <type>
# with word,byte,code,asci[iz],rad50,flt[24] and
# $<struct>
use 5.14.0; # require Perl 5.14 or higher
use strict; # require strict checking
use FileHandle;
use Getopt::Long;
my %opts = ();
GetOptions(\%opts, "help", "das:s", "dmode:s", "start:s",
"I=s@",
"info",
"draw", "dtag", "tctag", "ttlc"
)
or bailout("bad command options");
# set up default include path
unshift @{$opts{I}}, "."; # ./ is first in include path
push @{$opts{I}}, "$ENV{RETROBASE}/tools/dasm-11/lib" if defined $ENV{RETROBASE};
sub load_data; # load dmp file
sub load_steer; # load das file
sub dump_data; # dump @data array status
sub tag_code; # paint all code sections
sub tag_undef; # tag all yet undefined words/bytes
sub tag_data; # paint all data sections
sub gather_ascii; # gather ascii, asciz, or ascooo string
sub gather_blkw; # gather blkw block
sub gather_blkb; # gather blkb block
sub pass_opts1; # handle some options (symimm)
sub pass_opts2; # handle most options (symxxx,lbliot,...)
sub do_lblimmind; # helper to handle lblimm and lblind
sub do_symimmind; # helper to handle symimm, symind and symchr
sub name_labels; # name all autogenerated labels
sub anal_inst; # analyse single instruction
sub anal_operand; # analyse src or dst operand specifier
sub anal_cisops; # analyse cis operands
sub get_regname; # return register name
sub set_type; # set type tag in @data
sub write_source; # write source or list file
sub print_info; # print messages on unnamed vect or i/o space
sub symbolize; # convert oooooo -> label
sub word2byte; # add {byte} values for a {word}
sub get_lpref; # return label prefix depending on tspec
sub set_typlabcref; # setup type, label and cref
sub set_labcref; # define auto label, add cref info
sub add_adrcref; # add cref entry in adrtbl
sub add_symcref; # add cref entry in symtbl
sub set_acslabel; # define auto label from acs info
sub set_option; # setup .enabl/.dsabl option
sub set_curopt; # update current option list %curopt
sub set_susopt; # restore suspended options
sub get_word; # return word data (or undef)
sub get_byte; # return byte data (or undef)
sub get_taddr; # return target address (or undef)
sub add_symbol; # add symbol in adrtbl and symtbl
sub add_adr_rlabel; # add relative label entry in adrtbl
sub add_adr_alist; # add attribute list to adrtbl entry
sub add_adr_attr; # add attribute to adrtbl entry
sub add_sym_attr; # add attribute to symtbl entry
sub add_dat_attr; # add attribute to data word/byte
sub add_dat_alist; # add attribute list for data
sub add_ops_alist; # add attribute list for code
sub add_ctpend; # add element in code tag pending list
sub add_lcomm; # add full line comment
sub add_scomm; # add statement comment
sub add_symset; # add a new %symsettbl entry
sub add_struct; # add a new %structtbl entry
sub add_params; # add a new %paramstbl entry
sub chk_typespec; # check validity of typespec (or list)
sub chk_byte; # check availability of byte (convert if needed)
sub chk_data; # check availability of data (word or byte)
sub chk_opcode; # check existence and content of {opcode}
sub chk_op1typ; # check existence and content of {op1typ}
sub chk_op2typ; # check existence and content of {op2typ}
sub chk_op2str; # check existence and content of {op2str}
sub chk_op2str; # check existence and content of {op2str}
sub chk_type; # check whether address is typed
sub convoct; # convert 16 bit int to %6.6o octal
sub get_numoctdec; # convert oct or dec number to binary
sub print_bugcheck; # print BUGCHECK message, with line number
sub print_help; # --help or error output
my $filename_dmp; # name of the input dmp file
my $fh_out = *STDOUT;
# @data --> data table; is array of hashes
# ->{word} 16 bit value if [addr]
# ->{byte} 8 bit value if [addr]
# ->{type} type of data:
# word 16 bit data word
# byte 8 bit data byte
# code instruction, opcode part
# code.imm instruction, immediate value part
# code.ind instruction, index value part
# vect interrupt vector, pointer to handler
# vect.psw interrupt vector, new psw value
# ascii ascii string value (not zero terminated)
# asciz ascii string zero terminated
# ascooo ascii string <ooo> terminated
# rad50 rad50 encoded string
# flt2 single precision float
# flt4 double precision float
# <type>* pointer to an address holding <type>
# with word,byte,code,asci[iz],rad50,flt[24] and
# $<struct>
# ->{nb} length in bytes of item (always given)
# ->{nw} length in words of item (for word aligned items)
# ->{ibase} address of item base address (for all but first in item)
# ->{dirstr} directive name (can be word,byte,ascii,asciz,.even)
# ->{argstr} directive args (must be defined when {dirstr} defined)
# ->{comstr} full asciz string (defined when {dirstr} eq asciz)
#
my @data;
# %adrtbl --> address table; is hash (by %6.6o addr) of hashs
# ->{addr} address as integer
# ->{typ} type: "gsym", "data", "albl", "asym", "rlbl"
# ->{string} symbol string (might not be unique, might be expression)
# ->{cref} cross reference hash (indexed by from address)
# ->{$from} ref type
# ->{use} symbolization options
#
my %adrtbl; # address table
# %symtbl --> symbol table; is hash (by symbol) of hashes
# ->{val} value as integer
# ->{typ} type: "gsym", "data", set name (%xxx, @xxx)
#
my %symtbl; # symbol table
# %symsettbl --> symbol set table; is hash (by setname) of arrays of hashs
# ->[]->{sym} symbol name
# ->[]->{val} symbol value
# ->[]->{msk} symbol mask (in case of % sets)
#
my %symsettbl;
my @ctpend; # code tag pending list
# %structtbl --> struct definition table; is hash (by struct name)
# ->[<array of typespecs>]
my %structtbl = ( # struct descriptor table
'$cisdsc'=> ["word","word*"]
);
my %paramstbl; # parameter descriptor table
# %opttbl --> options table; is hash (by option name)
# ->{ena} enable state
# ->{attr}->{} hash of option attributes
#
my %opttbl = (
symchr=> {ena => 0,
attr => {anno=>"n"},
anno => 0},
symimm=> {ena => 0,
attr => {anno=>"n",
min=>"n",
max=>"n"},
anno => 0,
min => 01000,
max => 0177700},
symind=> {ena => 0,
attr => {anno=>"n",
min=>"n",
max=>"n"},
anno => 0,
min => 01000,
max => 0177700},
symwrd=> {ena => 0,
attr => {anno=>"n",
min=>"n",
max=>"n"},
anno => 0,
min => 01000,
max => 0177700},
lblimm=> {ena => 0,
attr => {anno=>"n",
min=>"n",
max=>"n"},
anno => 0,
min => 01000,
max => 0177700},
lblind=> {ena => 0,
attr => {anno=>"n",
min=>"n",
max=>"n"},
anno => 0,
min => 01000,
max => 0177700},
lbliot=> {ena => 0,
attr => {tnum=>"n"},
tnum => 1},
anoemt=> {ena => 0,
attr => {tbl=>"l",
size=>"n",
max=>"n"},
tbl => "???",
size => 0,
max => 377}
);
my %curopt = (); # current option set
my @susp_restore; # list of suspend restores
my $dmode_opt;
#
# opcode type's:
# type example decsription
# 0arg halt no operands
# 1arg jmp @#1200 one mod/reg operand
# 2arg mov #100,2(r4) two mod/reg operand
# gr mul #12,r2 reg destination, mod/reg source operand
# rg jsr pc,@#1200 reg source form, one reg, one mod/reg operand
# rts rts pc one register operand
# br br 124 one 8 bit signed displacement operand
# sob sob r2,124 register operand, 6 bit displacement
# ccop clc one 4 bit operand, opcodes or'ed
# spl spl 7 one 3 bit operand
# mark mark 12 one 6 bit operand
# trap trap 123 one 8 bit operand
# 0fpp cfcc fpp: no operands
# gfpp clrf f0 fpp: one mod/reg operand
# grfpp addf a,f0 fpp: one mod/reg operand, fpp accumulator dst
# rgfpp stf f0,a fpp: fpp accumulator src, one mod/reg operand
#
my @opcode_tbl = (
{code=>0000000, mask=>0000000, mnem=>"halt", type=>"0arg"},
{code=>0000001, mask=>0000000, mnem=>"wait", type=>"0arg"},
{code=>0000002, mask=>0000000, mnem=>"rti", type=>"0arg"},
{code=>0000003, mask=>0000000, mnem=>"bpt", type=>"0arg"},
{code=>0000004, mask=>0000000, mnem=>"iot", type=>"0arg"},
{code=>0000005, mask=>0000000, mnem=>"reset", type=>"0arg"},
{code=>0000006, mask=>0000000, mnem=>"rtt", type=>"0arg"},
{code=>0000007, mask=>0000000, mnem=>"mfpt", type=>"0arg", cpu=>"j11"},
{code=>0000100, mask=>0000077, mnem=>"jmp", type=>"1arg", dst=>"j"},
{code=>0000200, mask=>0000007, mnem=>"rts", type=>"rts"},
{code=>0000230, mask=>0000007, mnem=>"spl", type=>"spl"},
{code=>0000240, mask=>0000017, mnem=>"cl", type=>"ccop"},
{code=>0000260, mask=>0000017, mnem=>"se", type=>"ccop"},
{code=>0000300, mask=>0000077, mnem=>"swab", type=>"1arg", dst=>"m"},
{code=>0000400, mask=>0000377, mnem=>"br", type=>"br"},
{code=>0001000, mask=>0000377, mnem=>"bne", type=>"br"},
{code=>0001400, mask=>0000377, mnem=>"beq", type=>"br"},
{code=>0002000, mask=>0000377, mnem=>"bge", type=>"br"},
{code=>0002400, mask=>0000377, mnem=>"blt", type=>"br"},
{code=>0003000, mask=>0000377, mnem=>"bgt", type=>"br"},
{code=>0003400, mask=>0000377, mnem=>"ble", type=>"br"},
{code=>0004000, mask=>0000777, mnem=>"jsr", type=>"rg", dst=>"e"},
{code=>0005000, mask=>0000077, mnem=>"clr", type=>"1arg", dst=>"w"},
{code=>0005100, mask=>0000077, mnem=>"com", type=>"1arg", dst=>"m"},
{code=>0005200, mask=>0000077, mnem=>"inc", type=>"1arg", dst=>"m"},
{code=>0005300, mask=>0000077, mnem=>"dec", type=>"1arg", dst=>"m"},
{code=>0005400, mask=>0000077, mnem=>"neg", type=>"1arg", dst=>"m"},
{code=>0005500, mask=>0000077, mnem=>"adc", type=>"1arg", dst=>"m"},
{code=>0005600, mask=>0000077, mnem=>"sbc", type=>"1arg", dst=>"m"},
{code=>0005700, mask=>0000077, mnem=>"tst", type=>"1arg", dst=>"r"},
{code=>0006000, mask=>0000077, mnem=>"ror", type=>"1arg", dst=>"m"},
{code=>0006100, mask=>0000077, mnem=>"rol", type=>"1arg", dst=>"m"},
{code=>0006200, mask=>0000077, mnem=>"asr", type=>"1arg", dst=>"m"},
{code=>0006300, mask=>0000077, mnem=>"asl", type=>"1arg", dst=>"m"},
{code=>0006400, mask=>0000077, mnem=>"mark", type=>"mark"},
{code=>0006500, mask=>0000077, mnem=>"mfpi", type=>"1arg", dst=>"r"},
{code=>0006600, mask=>0000077, mnem=>"mtpi", type=>"1arg", dst=>"w"},
{code=>0006700, mask=>0000077, mnem=>"sxt", type=>"1arg", dst=>"w"},
{code=>0007000, mask=>0000077, mnem=>"csm", type=>"1arg", cpu=>"j11"},
{code=>0007200, mask=>0000077, mnem=>"tstset",type=>"1arg", cpu=>"j11"},
{code=>0007300, mask=>0000077, mnem=>"wrtlck",type=>"1arg", cpu=>"j11"},
{code=>0010000, mask=>0007777, mnem=>"mov", type=>"2arg",
src=>"r", dst=>"w"},
{code=>0020000, mask=>0007777, mnem=>"cmp", type=>"2arg",
src=>"r", dst=>"r"},
{code=>0030000, mask=>0007777, mnem=>"bit", type=>"2arg",
src=>"r", dst=>"r"},
{code=>0040000, mask=>0007777, mnem=>"bic", type=>"2arg",
src=>"r", dst=>"m"},
{code=>0050000, mask=>0007777, mnem=>"bis", type=>"2arg",
src=>"r", dst=>"m"},
{code=>0060000, mask=>0007777, mnem=>"add", type=>"2arg",
src=>"r", dst=>"m"},
{code=>0070000, mask=>0000777, mnem=>"mul", type=>"gr", dst=>"r"},
{code=>0071000, mask=>0000777, mnem=>"div", type=>"gr", dst=>"r"},
{code=>0072000, mask=>0000777, mnem=>"ash", type=>"gr", dst=>"r"},
{code=>0073000, mask=>0000777, mnem=>"ashc", type=>"gr", dst=>"r"},
{code=>0074000, mask=>0000777, mnem=>"xor", type=>"rg", dst=>"m"},
{code=>0075000, mask=>0000007, mnem=>"fadd", type=>"1reg", cpu=>"fis"},
{code=>0075010, mask=>0000007, mnem=>"fsub", type=>"1reg", cpu=>"fis"},
{code=>0075020, mask=>0000007, mnem=>"fmul", type=>"1reg", cpu=>"fis"},
{code=>0075030, mask=>0000007, mnem=>"fdiv", type=>"1reg", cpu=>"fis"},
{code=>0076020, mask=>0000007, mnem=>"ld2r", type=>"crdd", cpu=>"cis"},
{code=>0076030, mask=>0000000, mnem=>"movc", type=>"0arg", cpu=>"cis"},
{code=>0076031, mask=>0000000, mnem=>"movrc", type=>"0arg", cpu=>"cis"},
{code=>0076032, mask=>0000000, mnem=>"movtc", type=>"0arg", cpu=>"cis"},
{code=>0076040, mask=>0000000, mnem=>"locc", type=>"0arg", cpu=>"cis"},
{code=>0076041, mask=>0000000, mnem=>"skpc", type=>"0arg", cpu=>"cis"},
{code=>0076042, mask=>0000000, mnem=>"scanc", type=>"0arg", cpu=>"cis"},
{code=>0076043, mask=>0000000, mnem=>"spanc", type=>"0arg", cpu=>"cis"},
{code=>0076044, mask=>0000000, mnem=>"cmpc", type=>"0arg", cpu=>"cis"},
{code=>0076045, mask=>0000000, mnem=>"matc", type=>"0arg", cpu=>"cis"},
{code=>0076050, mask=>0000000, mnem=>"addn", type=>"0arg", cpu=>"cis"},
{code=>0076051, mask=>0000000, mnem=>"subn", type=>"0arg", cpu=>"cis"},
{code=>0076052, mask=>0000000, mnem=>"cmpn", type=>"0arg", cpu=>"cis"},
{code=>0076053, mask=>0000000, mnem=>"cvtnl", type=>"0arg", cpu=>"cis"},
{code=>0076054, mask=>0000000, mnem=>"cvtpn", type=>"0arg", cpu=>"cis"},
{code=>0076055, mask=>0000000, mnem=>"cvtnp", type=>"0arg", cpu=>"cis"},
{code=>0076056, mask=>0000000, mnem=>"ashn", type=>"0arg", cpu=>"cis"},
{code=>0076057, mask=>0000000, mnem=>"cvtln", type=>"0arg", cpu=>"cis"},
{code=>0076060, mask=>0000007, mnem=>"ld3r", type=>"crddd",cpu=>"cis"},
{code=>0076070, mask=>0000000, mnem=>"addp", type=>"0arg", cpu=>"cis"},
{code=>0076071, mask=>0000000, mnem=>"subp", type=>"0arg", cpu=>"cis"},
{code=>0076072, mask=>0000000, mnem=>"cmpp", type=>"0arg", cpu=>"cis"},
{code=>0076073, mask=>0000000, mnem=>"cvtpl", type=>"0arg", cpu=>"cis"},
{code=>0076074, mask=>0000000, mnem=>"mulp", type=>"0arg", cpu=>"cis"},
{code=>0076075, mask=>0000000, mnem=>"divp", type=>"0arg", cpu=>"cis"},
{code=>0076076, mask=>0000000, mnem=>"ashp", type=>"0arg", cpu=>"cis"},
{code=>0076077, mask=>0000000, mnem=>"cvtlp", type=>"0arg", cpu=>"cis"},
{code=>0076130, mask=>0000000, mnem=>"movci", type=>"cdda", cpu=>"cis"},
{code=>0076131, mask=>0000000, mnem=>"movrci",type=>"cdda", cpu=>"cis"},
{code=>0076132, mask=>0000000, mnem=>"movtci",type=>"cddaa",cpu=>"cis"},
{code=>0076140, mask=>0000000, mnem=>"locci", type=>"cda", cpu=>"cis"},
{code=>0076141, mask=>0000000, mnem=>"skpci", type=>"cda", cpu=>"cis"},
{code=>0076142, mask=>0000000, mnem=>"scanci",type=>"cdd", cpu=>"cis"},
{code=>0076143, mask=>0000000, mnem=>"spanci",type=>"cdd", cpu=>"cis"},
{code=>0076144, mask=>0000000, mnem=>"cmpci", type=>"cdda", cpu=>"cis"},
{code=>0076145, mask=>0000000, mnem=>"matci", type=>"cdd", cpu=>"cis"},
{code=>0076150, mask=>0000000, mnem=>"addni", type=>"cddd", cpu=>"cis"},
{code=>0076151, mask=>0000000, mnem=>"subni", type=>"cddd", cpu=>"cis"},
{code=>0076152, mask=>0000000, mnem=>"cmpni", type=>"cdd", cpu=>"cis"},
{code=>0076153, mask=>0000000, mnem=>"cvtnli",type=>"cda", cpu=>"cis"},
{code=>0076154, mask=>0000000, mnem=>"cvtpni",type=>"cdd", cpu=>"cis"},
{code=>0076155, mask=>0000000, mnem=>"cvtnpi",type=>"cdd", cpu=>"cis"},
{code=>0076156, mask=>0000000, mnem=>"ashni", type=>"cdda", cpu=>"cis"},
{code=>0076157, mask=>0000000, mnem=>"cvtlni",type=>"cdd", cpu=>"cis"},
{code=>0076170, mask=>0000000, mnem=>"addpi", type=>"cddd", cpu=>"cis"},
{code=>0076171, mask=>0000000, mnem=>"subpi", type=>"cddd", cpu=>"cis"},
{code=>0076172, mask=>0000000, mnem=>"cmppi", type=>"cdd", cpu=>"cis"},
{code=>0076173, mask=>0000000, mnem=>"cvtpli",type=>"cda", cpu=>"cis"},
{code=>0076174, mask=>0000000, mnem=>"mulpi", type=>"cddd", cpu=>"cis"},
{code=>0076175, mask=>0000000, mnem=>"divpi", type=>"cddd", cpu=>"cis"},
{code=>0076176, mask=>0000000, mnem=>"ashpi", type=>"cdda", cpu=>"cis"},
{code=>0076177, mask=>0000000, mnem=>"cvtlpi",type=>"cdd", cpu=>"cis"},
{code=>0076600, mask=>0000000, mnem=>"med", type=>"0reg", cpu=>"11/60"},
{code=>0077000, mask=>0000777, mnem=>"sob", type=>"sob"},
{code=>0100000, mask=>0000377, mnem=>"bpl", type=>"br"},
{code=>0100400, mask=>0000377, mnem=>"bmi", type=>"br"},
{code=>0101000, mask=>0000377, mnem=>"bhi", type=>"br"},
{code=>0101400, mask=>0000377, mnem=>"blos", type=>"br"},
{code=>0102000, mask=>0000377, mnem=>"bvc", type=>"br"},
{code=>0102400, mask=>0000377, mnem=>"bvs", type=>"br"},
{code=>0103000, mask=>0000377, mnem=>"bcc", type=>"br"},
{code=>0103400, mask=>0000377, mnem=>"bcs", type=>"br"},
{code=>0104000, mask=>0000377, mnem=>"emt", type=>"trap"},
{code=>0104400, mask=>0000377, mnem=>"trap", type=>"trap"},
{code=>0105000, mask=>0000077, mnem=>"clrb", type=>"1arg", dst=>"w",
bytop=>1},
{code=>0105100, mask=>0000077, mnem=>"comb", type=>"1arg", dst=>"m",
bytop=>1},
{code=>0105200, mask=>0000077, mnem=>"incb", type=>"1arg", dst=>"m",
bytop=>1},
{code=>0105300, mask=>0000077, mnem=>"decb", type=>"1arg", dst=>"m",
bytop=>1},
{code=>0105400, mask=>0000077, mnem=>"negb", type=>"1arg", dst=>"m",
bytop=>1},
{code=>0105500, mask=>0000077, mnem=>"adcb", type=>"1arg", dst=>"m",
bytop=>1},
{code=>0105600, mask=>0000077, mnem=>"sbcb", type=>"1arg", dst=>"m",
bytop=>1},
{code=>0105700, mask=>0000077, mnem=>"tstb", type=>"1arg", dst=>"r",
bytop=>1},
{code=>0106000, mask=>0000077, mnem=>"rorb", type=>"1arg", dst=>"m",
bytop=>1},
{code=>0106100, mask=>0000077, mnem=>"rolb", type=>"1arg", dst=>"m",
bytop=>1},
{code=>0106200, mask=>0000077, mnem=>"asrb", type=>"1arg", dst=>"m",
bytop=>1},
{code=>0106300, mask=>0000077, mnem=>"aslb", type=>"1arg", dst=>"m",
bytop=>1},
{code=>0106400, mask=>0000077, mnem=>"mtps", type=>"1arg", dst=>"r",
cpu=>"j11"},
{code=>0106500, mask=>0000077, mnem=>"mfpd", type=>"1arg", dst=>"r"},
{code=>0106600, mask=>0000077, mnem=>"mtpd", type=>"1arg", dst=>"w"},
{code=>0106700, mask=>0000077, mnem=>"mfps", type=>"1arg", dst=>"w",
cpu=>"j11"},
{code=>0110000, mask=>0007777, mnem=>"movb", type=>"2arg",
src=>"r", dst=>"w", bytop=>1},
{code=>0120000, mask=>0007777, mnem=>"cmpb", type=>"2arg",
src=>"r", dst=>"r", bytop=>1},
{code=>0130000, mask=>0007777, mnem=>"bitb", type=>"2arg",
src=>"r", dst=>"r", bytop=>1},
{code=>0140000, mask=>0007777, mnem=>"bicb", type=>"2arg",
src=>"r", dst=>"m", bytop=>1},
{code=>0150000, mask=>0007777, mnem=>"bisb", type=>"2arg",
src=>"r", dst=>"m", bytop=>1},
{code=>0160000, mask=>0007777, mnem=>"sub", type=>"2arg",
src=>"r", dst=>"m"},
{code=>0170000, mask=>0000000, mnem=>"cfcc", type=>"0fpp"},
{code=>0170001, mask=>0000000, mnem=>"setf", type=>"0fpp"},
{code=>0170002, mask=>0000000, mnem=>"seti", type=>"0fpp"},
{code=>0170003, mask=>0000000, mnem=>"ldub", type=>"0fpp", cpu=>"fp11"},
{code=>0170004, mask=>0000000, mnem=>"mns", type=>"0fpp", cpu=>"fp11"},
{code=>0170005, mask=>0000000, mnem=>"sta0", type=>"0fpp", cpu=>"fp11"},
{code=>0170007, mask=>0000000, mnem=>"stq0", type=>"0fpp", cpu=>"fp11"},
{code=>0170011, mask=>0000000, mnem=>"setd", type=>"0fpp"},
{code=>0170012, mask=>0000000, mnem=>"setl", type=>"0fpp"},
{code=>0170100, mask=>0000077, mnem=>"ldfps", type=>"gfpp", dst=>"r"},
{code=>0170200, mask=>0000077, mnem=>"stfps", type=>"gfpp", dst=>"w"},
{code=>0170300, mask=>0000077, mnem=>"stst", type=>"gfpp", dst=>"w"},
{code=>0170400, mask=>0000077, mnem=>"clrf", type=>"gfpp", dst=>"w"},
{code=>0170500, mask=>0000077, mnem=>"tstf", type=>"gfpp", dst=>"r"},
{code=>0170600, mask=>0000077, mnem=>"absf", type=>"gfpp", dst=>"m"},
{code=>0170700, mask=>0000077, mnem=>"negf", type=>"gfpp", dst=>"m"},
{code=>0171000, mask=>0000377, mnem=>"mulf", type=>"grfpp", dst=>"r"},
{code=>0171400, mask=>0000377, mnem=>"modf", type=>"grfpp", dst=>"r"},
{code=>0172000, mask=>0000377, mnem=>"addf", type=>"grfpp", dst=>"r"},
{code=>0172400, mask=>0000377, mnem=>"ldf", type=>"grfpp", dst=>"r"},
{code=>0173000, mask=>0000377, mnem=>"subf", type=>"grfpp", dst=>"r"},
{code=>0173400, mask=>0000377, mnem=>"cmpf", type=>"grfpp", dst=>"r"},
{code=>0174000, mask=>0000377, mnem=>"stf", type=>"rgfpp", dst=>"w"},
{code=>0174400, mask=>0000377, mnem=>"divf", type=>"grfpp", dst=>"r"},
{code=>0175000, mask=>0000377, mnem=>"stexp", type=>"rgfpp", dst=>"w"},
{code=>0175400, mask=>0000377, mnem=>"stcif", type=>"rgfpp", dst=>"w"},
{code=>0176000, mask=>0000377, mnem=>"stcfd", type=>"rgfpp", dst=>"w"},
{code=>0176400, mask=>0000377, mnem=>"ldexp", type=>"grfpp", dst=>"r"},
{code=>0177000, mask=>0000377, mnem=>"ldcif", type=>"grfpp", dst=>"r"},
{code=>0177400, mask=>0000377, mnem=>"ldcdf", type=>"grfpp", dst=>"r"}
);
# Note: the keys in %adr_info_tbl are 6 digit octal numbers. They must be
# put in '' quotes explicitely, otherwise perl converts them first to
# a number and then back into a string, but decimal without leading 0.
my %adr_info_vect = (
'000004' => "v..iit .vect missed ?",
'000010' => "v..rit .vect missed ?",
'000014' => "v..bpt .vect missed ?",
'000020' => "v..iot .vect missed ?",
'000024' => "v..pwr .vect missed ?",
'000030' => "v..emt .vect missed ?",
'000034' => "v..trp .vect missed ?",
'000060' => "v..tti .vect missed ?",
'000064' => "v..tto .vect missed ?",
'000070' => "v..ptr .vect missed ?",
'000074' => "v..ptp .vect missed ?",
'000100' => "v..kwl .vect missed ?",
'000104' => "v..kwp .vect missed ?",
'000114' => "v..mse .vect missed ?",
'000120' => "v..deu .vect missed ?",
'000160' => "v..rl .vect missed ?",
'000200' => "v..lp .vect missed ?",
'000220' => "v..rk .vect missed ?",
'000224' => "v..tm .vect missed ?",
'000240' => "v..pir .vect missed ?",
'000244' => "v..fpp .vect missed ?",
'000250' => "v..mmu .vect missed ?",
'000254' => "v..rha .vect missed ?",
'000260' => "v..iis .vect missed ?"
);
my @adr_info_iopage = (
[0177760, 0177775, "1170 reg missed ?"],
[0177740, 0177753, "1170 reg missed ?"],
[0177600, 0177677, "MMU pdr missed ?"],
[0177572, 0177577, "MMU ssr missed ?"],
[0177570, 0177571, "DISP/SW missed ?"],
[0177560, 0177567, "DL11 1st missed ?"],
[0177546, 0177547, "KW11-L missed ?"],
[0177570, 0177571, "DISP/SW missed ?"],
[0177514, 0177517, "LP11 missed ?"],
[0177500, 0177503, "IIST missed ?"],
[0177440, 0177477, "RK06 missed ?"],
[0177400, 0177417, "RK11 missed ?"],
[0177170, 0177173, "RX11 missed ?"],
[0177160, 0177165, "CR11 missed ?"],
[0177060, 0177061, "XOR Test missed ?"],
[0176700, 0176753, "RH70 missed ?"],
[0176500, 0176507, "DL11 2nd missed ?"],
[0174510, 0174517, "DEUNA missed ?"],
[0174400, 0174411, "RL11 missed ?"],
[0173000, 0173177, "m9312 boot missed ?"],
[0172540, 0172545, "KW11-P missed ?"],
[0172520, 0172533, "TM11 missed ?"],
[0172516, 0172517, "MMU ssr missed ?"],
[0172200, 0172377, "MMU pdr missed ?"],
[0172150, 0172153, "UDA50 missed ?"],
[0170200, 0170377, "UBMAP missed ?"],
[0165000, 0165777, "m9312 diag missed ?"],
[0160500, 0160517, "DH11 missed ?"],
[0160100, 0160107, "DZ11 missed ?"]
);
use constant BIT00 => 0000001;
use constant BIT01 => 0000002;
use constant BIT02 => 0000004;
use constant BIT03 => 0000010;
use constant BIT04 => 0000020;
use constant BIT05 => 0000040;
use constant BIT06 => 0000100;
use constant BIT07 => 0000200;
use constant BIT08 => 0000400;
use constant BIT09 => 0001000;
use constant BIT10 => 0002000;
use constant BIT11 => 0004000;
use constant BIT12 => 0010000;
use constant BIT13 => 0020000;
use constant BIT14 => 0040000;
use constant BIT15 => 0100000;
#
# -- Main program starts here ------------------------------------------------
#
autoflush STDOUT 1 if (-p STDOUT); # autoflush if output into pipe
autoflush STDOUT 1 if (-t STDOUT); # autoflush if output into term
if ($opts{help}) {
print_help();
exit 0;
}
bailout("specify one and only one data file") if (scalar(@ARGV) != 1);
$filename_dmp = $ARGV[0];
load_data($filename_dmp);
if (exists $opts{dmode}) {
if ($opts{dmode} =~ m{^(word|asciz|code)$} ) {
$dmode_opt = $opts{dmode};
} else {
print STDERR "dasm-11-E: word,asciz,code allowed for -dmode\n";
}
}
if (exists $opts{start}) {
my @alist = split /,/, $opts{start};
foreach my $addr (@alist) {
if ($addr =~ m{^[0-7]+$} ) {
add_ctpend(oct $addr, "--start");
} else {
print STDERR "dasm-11-E: only octal values allowed for -start\n";
}
}
}
if (exists $opts{das}) {
load_steer($opts{das});
} elsif ($filename_dmp =~ m{^(.*)\.dmp(\.gz)?$} ) {
my $filename_das = $1 . ".das";
if (-r $filename_das) {
load_steer($filename_das);
}
}
dump_data() if $opts{draw};
tag_code();
pass_opts1(); # FIXME: opts1 must run before
# tag_undef, otherwise
# data is merged (why???)
tag_undef(); # FIXME: tag_undef can tag code
tag_code() if scalar(@ctpend);
tag_data();
pass_opts2();
name_labels();
dump_data() if $opts{dtag};
write_source();
print_info() if $opts{info};
#-------------------------------------------------------------------------------
sub load_data { # load dmp file
my ($file) = @_;
my $fh;
if ($file eq '-') {
$fh = *STDIN;
} else {
bailout("input file '$file' not found") if (not -r $file);
$fh = new FileHandle;
if ($file =~ m{\.gz$}) {
$fh->open("gunzip -c $file|")
or bailout("Failed to open/unzip '$file': $!");
} else {
$fh->open("<$file")
or bailout("Failed to open data file '$file': $!");
}
}
while (<$fh>) {
chomp;
if ( m{^\s*([0-7]+)\s*:\s*([0-7]+)\s*$} ) {
my $addr = oct $1;
my $val = oct $2;
$data[$addr] = {word => $val};
} else {
print STDERR "dasm-11-E: bad data line \"$_\"\n";
}
}
}
#-------------------------------------------------------------------------------
sub load_steer { # load das file
my ($file) = @_;
my $fh = new FileHandle;
my @lcomm;
# locate das file in -I path
my $fnam = $file;
unless ($fnam =~ m|^/|) {
foreach (@{$opts{I}}) {
if (-r "$_/$fnam") {
$fnam = "$_/$fnam";
last;
}
}
}
bailout("file steer file '$file' not found") if (not -r $fnam);
$fh->open("<$fnam");
while (<$fh>) {
chomp;
while ( m{\\$} ) { # ends with \ --> get continuation line
my $cline = <$fh>;
last if not defined $cline;
chomp $cline;
$cline =~ s/^\s*//; # drop leading blanks of continuation
s/\\$//; # drop trailing \
$_ .= $cline; # and append continuation line
}
next if m{^#} ; # ignore # comment
next if m{^\s*$} ; # ignore empty line
s{^\s*}{}; # drop leading blanks
s{\s*$}{}; # drop trailing blanks
if ( m{^;} ) { # ;<line comment>
push @lcomm, $_;
next;
}
my $cmd = $_;
my $comm;
if ( m{^
(.+?) # any command --> $1
\s* #
(;.*) # ; comment --> $2
$ }x ) {
$cmd = $1;
$comm = $2;
}
if ($cmd =~ m{^\@(.+)$} ) { # @filename -> nested files
load_steer($1);
# .struct directive
} elsif ($cmd =~ m{
^\.struct \s+ # .struct
(\$[a-zA-Z][a-zA-Z0-9]*) # <name> --> $1
\s* = \s* # =
(.*?) # <tspec-list> --> $2
$ }x ) {
add_struct($1, $2);
# .params iot|bpt <list>
} elsif ($cmd =~ m{
^\.params \s+ # .params
(iot|bpt) \s+ # <trap_inst> --> $1
(.+) # <tspec-list> --> $2
$ }x ) {
add_params($1, $2);
# .params emt|trap ooo[:ooo] <list>
} elsif ($cmd =~ m{
^\.params \s+ # .params
(emt|trap) \s+ # <trap_inst> --> $1
([0-7]{1,3}) # <trap_num> --> $2
(:?) # : ? --> $3
([0-7]{0,3}) \s+ # <trap_numhigh> --> $4
(.+) # <tspec_list> --> $5
$ }x ) {
my $opcode = $1;
my $rlow = $2;
my $rdel = $3;
my $rhigh = $4;
my $plist = $5;
my $beg = oct $rlow;
my $end = ($rdel) ? oct $rhigh : $beg;
for (my $i=$beg; $i<=$end; $i++) {
my $name = sprintf "%s %3.3o", $opcode, $i;
add_params($name, $plist);
}
# .symbol <symbol> = <addr> <alist>
} elsif ($cmd =~ m{
^\.symbol \s+ # .symbol
([a-zA-Z\$\.][a-zA-Z0-9\$\.]*) # <symname> --> $1
\s* = \s* # =
([0-7]+) # <addr> --> $2
( (
\s+
[a-zA-Z][a-zA-Z0-9]* # <name>
= # =
\S+ # <value>
)* # <alist> --> $3
)
$ }x ) {
my $gsym = $1;
my $addr = oct $2;
my $alist = $3;
add_symbol($addr, $gsym, "gsym");
add_adr_alist(convoct($addr), $alist) if defined $alist;
add_sym_attr($gsym, "scomm", $comm) if defined $comm;
# .symset <symset> = <set definition>
} elsif ($cmd =~ m{
^\.symset \s+ # .symset
([\@\%][a-zA-Z][a-zA-Z0-9\.]*) # <setname> --> $1
\s* = \s* # =
(.*?) # <setdef> --> $2
$ }x ) {
my $setname = $1;
my $setdef = $2;
add_symset($setname, $setdef);
# .(en|ds)abl <option> <attr-list>
} elsif ($cmd =~ m{
^(\.enabl|\.dsabl) \s+ # .enabl or .dsabl --> $1
([a-zA-z][a-zA-Z0-9]*) # <option> --> $2
((\s+.+?)*) # <attr_list> --> $3
$ }x ) {
my $ends = $1;
my $opt = $2;
my $attr = $3;
set_option(undef, $ends, $opt, $attr);
# .patch <addr> <value>
} elsif ($cmd =~ m{
^\.patch \s+ # .patch
([0-7]+) \s+ # <addr> --> $1
([0-7]+) # <value> --> $2
$ }x ) {
my $addr = oct $1;
my $val = oct $2;
$data[$addr] = {word => $val};
add_scomm($addr, $comm) if $comm;
# <addr> : <das_stmt>
} elsif ($cmd =~ m{
^([0-7]+) # <addr> --> $1
\s* : \s* # :
(.*?) # <statement> --> $2
$ }x ) {
my $addr = oct $1;
my $stmt = $2;
my $label;
my $dire = $stmt;
if (scalar(@lcomm)) { # any previous lcomm's
foreach (@lcomm) { add_lcomm($addr, $_); } # store with addr
@lcomm = (); # reset lcomm list
}
if ($stmt =~ m{ # strip off label
^([a-zA-Z\$\.][a-zA-Z0-9\$\.]*|[a-zA-Z]+\*) # <label> --> $1
\s* : \s* # :
(.*) # <directive> --> $2
$ }x ) {
$label = $1;
$dire = $2;
my $dtyp = chk_data($addr);
if ($dtyp) {
if ($label =~ m{\*$}) { # user auto-label
my $lpref = $label;
$lpref =~ s/\*$//;
set_labcref($addr, $lpref);
} else { # user label
add_symbol($addr, $label, "data");
}
} else {
printf STDERR "dasm-11-E: label '%s' defined but no data for %6.6o," .
"will be ignored\n", $label, $addr;
}
}
if (defined $comm) { # comments available ?
if ($comm =~ m{^;\|} ) { # inline lcomm
add_lcomm($addr, $comm);
} else { # scomm
my $text = $comm;
$text =~ s{^;\s*}{}; # strip leading "; "
add_scomm($addr, $text);
}
}
# .dmode <type>
if ($dire =~ m{
^.dmode # .dmode
\s+
(byte|word|code|
asci[iz]|asc[0-7]{3}|
rad50|flt[24]) # <type> --> $1
$ }x ) {
$data[$addr]->{dmode} = $1;
# .vect
} elsif ($dire eq ".vect") { # .vect
set_type($addr , "vect");
my $vh = get_word($addr);
if (defined $vh && chk_data($vh) eq "w" && # point to data
$vh != 0 && # not null
$vh != $addr+2) { # not catcher
##printf STDERR "+++1 %6.6o -> %6.6o\n", $addr, $vh;
set_typlabcref($vh, "code", "V"); # tag it
set_typlabcref($addr, "code*"); # FIXME: wmy this ????
}
# .<typespec> <alist>
} elsif ($dire =~ m{
^\.(byte|word|code!?| # base types
asci[iz]|asc[0-7]{3}| # or asc types
rad50|flt[24]|vect| # or ext. types
\$[a-zA-Z][a-zA-Z0-9]*) # or structs -->$1
([\*\[\]\d\.]*) # range -->$2
( (
\s+
[a-zA-Z][a-zA-Z0-9]* # <name>
= # =
\S+ # <value>
)* # <alist> --> $3
)
$ }x ) {
my $tspec = $1.$2;
my $alist = $3;
set_typlabcref($addr, $tspec, "L");
add_dat_alist($addr, $alist) if defined $alist;
# .params <plist>
} elsif ($dire =~ m{
^\.params # .params
\s+
(.*) # <plist> --> $1
$ }x ) {
my $plist = $1;
my $name = sprintf "jsr %6.6o", $addr;
add_params($name, $plist);