From 5fca0afdac36b9e7b7bc54edad8c417e1d2e5dc7 Mon Sep 17 00:00:00 2001 From: Mark Tearle Date: Mon, 3 Dec 2001 13:34:45 +0000 Subject: [PATCH] Updated code to handle other single byte with arg instructions Working on instructions with words --- ROM/Makefile | 2 +- ROM/makeasm.pl | 58 ++++++++++++++++++++++++++++++++++---------------- 2 files changed, 41 insertions(+), 19 deletions(-) diff --git a/ROM/Makefile b/ROM/Makefile index 08266c9..c5600d6 100644 --- a/ROM/Makefile +++ b/ROM/Makefile @@ -1,5 +1,5 @@ HEXDUMP=xxd -HEXDUMP=od -A x -x +#HEXDUMP=od -A x -x .SUFFIXES: .asm .obj diff --git a/ROM/makeasm.pl b/ROM/makeasm.pl index ad25bba..e2b43ae 100755 --- a/ROM/makeasm.pl +++ b/ROM/makeasm.pl @@ -48,23 +48,36 @@ my %twobytesecond = ( '18 38' => 'PULY', '18 3A' => 'ABY', '18 3C' => 'PSHY'); -my %onewitharg = ( '80' => 'SUBA', - '81' => 'CMPA', - '82' => 'SBCA', - '84' => 'ANDA', - '85' => 'BITA', - '86' => 'LDAA', - '88' => 'EORA', - '8A' => 'ORA', - 'C0' => 'SUBB', - 'C1' => 'CMPB', - 'C2' => 'SBCB', - 'C4' => 'ANDB', - 'C5' => 'BITB', - 'C6' => 'LDAB', - 'C8' => 'EORB', - 'CA' => 'ORB' ); - +my %onewitharg = ('63' => "COM\t\$%s,X", + '6A' => "DEC\t\$%s,X", + '6C' => "INC\t\$%s,X", + '6D' => "TST\t\$%s,X", + '6E' => "JMP\t\$%s,X", + '6F' => "CLR\t\$%s,X", + '80' => "SUBA\t#\$%s", + '81' => "CMPA\t#\$%s", + '82' => "SBCA\t#\$%s", + '84' => "ANDA\t#\$%s", + '85' => "BITA\t#\$%s", + '86' => "LDAA\t#\$%s", + '88' => "EORA\t#\$%s", + '8A' => "ORA\t#\$%s", + 'A3' => "SUBD\t\$%s,X", + 'A7' => "STA\t\$%s,X", + 'C0' => "SUBB\t#\$%s", + 'C1' => "CMPB\t#\$%s", + 'C2' => "SBCB\t#\$%s", + 'C4' => "ANDB\t#\$%s", + 'C5' => "BITB\t#\$%s", + 'C6' => "LDAB\t#\$%s", + 'C8' => "EORB\t#\$%s", + 'CA' => "ORB\t#\$%s", + 'E3' => "ADDD\t\$%s,X", + 'EC' => "LDD\t\$%s,X", + 'ED' => "STAD\t\$%s,X" ); + + +my %onewithword = ('FF' => "STX\t\$%s%s"); LINE: while (<>) { @@ -123,12 +136,21 @@ sub instruction { if (defined $onewitharg{$instruction}) { $thing = substr($line,8,2); - print "\t$onewitharg{$instruction}\t#\$$thing"; + printf "\t$onewitharg{$instruction}", $thing; $line =~ /$onewitharg{$instruction} [0-9A-F][0-9A-F](.*)$/i; print "\t;$1\n"; return; } + if (defined $onewithword{$instruction}) { + $thing = substr($line,8,2); + $thing2 = substr($line,11,2); + printf "\t$onewithword{$instruction}", $thing, $thing2; + $line =~ /$onewithword{$instruction} [0-9A-F][0-9A-F][0-9A-F][0-9A-F](.*)$/i; + print "\t;$1\n"; + return; + } + if ($line =~ /^([A-F0-9]{4}) ((([A-F0-9]{2}) )*[A-F0-9]{2})/) { @_=split(' ',$2); print "\tFCB\t\$".join(', $',@_)."\n"; -- 2.20.1