#!/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 # # 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 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, is typed # BUGFIX: now correct comment for mov #nnn, # 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 *; 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) # @ {read nested das file} # .symbol = # .symset = # .struct {defines a structure} # .params (iot|bpt) # .params (trap|emt) ooo[:ooo] # ; line comment, will preceed the next statement # oooooo : [label:] directive [;comment] # # with # directives # --> just set label for location and/or comment # # .params --> params for jsr at oooooo # # .enabl [] # .dsabl [] # 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 # . # .params # .susp