--- tme/ic/m68k/m68k-iset-expand.pl 2018/04/24 16:38:57 1.1.1.2 +++ tme/ic/m68k/m68k-iset-expand.pl 2018/04/24 16:41:49 1.1.1.3 @@ -1,6 +1,6 @@ #! /usr/local/bin/perl -w -# $Id: m68k-iset-expand.pl,v 1.1.1.2 2018/04/24 16:38:57 root Exp $ +# $Id: m68k-iset-expand.pl,v 1.1.1.3 2018/04/24 16:41:49 root Exp $ # m68k-inst-expand.pl - expands the m68k instruction templates into # full instruction word patterns and their decodings: @@ -381,6 +381,26 @@ for($line = 1; defined($_ = ); $l next; } + # EXCEPTION: a move of an address register to a predecrement + # or postincrement EA with that same address register, must + # store the original value of the address register. since the + # predecrement and postincrement code in the executer updates + # the address register before the move has happened, we wrap + # the normal move function in another that gives an op1 + # argument that is the original value of the address register: + if ($func =~ /^move_srp[di]\.S/) { + $func = 'move.S'; + } + if ($func eq 'move.S' + && substr($pattern, (15 - 5), 6) eq '001'.substr($pattern, (15 - 11), 3)) { + if (substr($pattern, (15 - 8), 3) eq '100') { + $func = 'move_srpd.S'; + } + elsif (substr($pattern, (15 - 8), 3) eq '011') { + $func = 'move_srpi.S'; + } + } + # the function name: if ($func =~ /^(.*)\.([sS])$/) { die "stdin:$line: $func with no size field?\n"