diff --git a/Makefile b/Makefile index 75353fe..98d38ea 100644 --- a/Makefile +++ b/Makefile @@ -34,6 +34,7 @@ debug: distclean: rm -rf ./build -rm -rf ./testout + -rm -rf ./m32out clean: -rm -rf ./build diff --git a/asm.cpp b/asm.cpp index 9324727..b57ae41 100644 --- a/asm.cpp +++ b/asm.cpp @@ -1554,6 +1554,7 @@ void CLASS::initpass(void) truncdata = 0; variables.clear(); // clear the variables for each pass + macros.clear(); while (!PCstack.empty()) { PCstack.pop(); diff --git a/asm.h b/asm.h index aa0e88e..5a9573c 100644 --- a/asm.h +++ b/asm.h @@ -280,11 +280,12 @@ public: { clear(); } - void clear(void) { - lupct=0; - lupoffset=0; - luprunning=0; - lupskip=false; + void clear(void) + { + lupct = 0; + lupoffset = 0; + luprunning = 0; + lupskip = false; } uint16_t lupct; bool lupskip; @@ -299,9 +300,10 @@ public: { clear(); } - void clear(void) { - doskip=false; - value=0; + void clear(void) + { + doskip = false; + value = 0; } uint32_t value; bool doskip; @@ -334,7 +336,7 @@ public: value = 0; used = false; //text = ""; - var_text=""; + var_text = ""; name = ""; namelc = ""; stype = 0; @@ -343,6 +345,17 @@ public: } }; + +class TMacro +{ +public: + std::string name; + std::string lcname; + uint32_t currentline; + std::vector lines; + std::vector variables; +}; + class TPsuedoOp; class T65816Asm : public TFileProcessor @@ -371,8 +384,8 @@ public: std::string currentsymstr; std::vector lines; + Poco::HashMap macros; Poco::HashMapopcodes; - Poco::HashMap macros; Poco::HashMap symbols; Poco::HashMap variables; @@ -386,6 +399,7 @@ public: std::stack LUPstack; std::stack DOstack; std::stack LSTstack; + std::stack curMacro; TPsuedoOp *psuedoops; diff --git a/merlintests.sh b/merlintests.sh new file mode 100755 index 0000000..6f39cd2 --- /dev/null +++ b/merlintests.sh @@ -0,0 +1,35 @@ +#!/bin/bash + +OUTDIR=./m32out + +rm -rf $OUTDIR +mkdir -p $OUTDIR + +SRC=`ls ./testdata | grep -E '^([0-9]+)(.*)\.[Ss]'` + +#SRC=`ls ./testdata | grep -E '^([0-9]+)(.*)\.[Ss]' | grep -i 2007` + +for S in $SRC ; do + + S1=$S + S1=${S1/.S/} + S1=${S1/.s/} + + BASE=${S/.S/} + BASE=${BASE/.s/} + cd ./testdata + #merlin32 $S 2>/dev/null >/dev/null + merlin32 . $S 2>/dev/null + + R=?$ + cd - >/dev/null + cp ./testdata/$S1 $OUTDIR/$S1.bin 2>/dev/null + rm -f ./testdata/*.txt 2>/dev/null + rm -f ./testdata/$S1 2>/dev/null + R=?$ + +done +ls $OUTDIR + + + diff --git a/runtests.sh b/runtests.sh index 6e4ae83..044b44b 100755 --- a/runtests.sh +++ b/runtests.sh @@ -40,8 +40,8 @@ for S in $SRC ; do MSHA="Q" QSHA="M" - if [ -f ./testdata/M32_expected/$BASE ] ; then - MSHA=`sha256sum ./testdata/M32_expected/$BASE | awk '{ print $1;}'` 2>/dev/null >/dev/null + if [ -f ./m32out/$BASE.bin ] ; then + MSHA=`sha256sum ./m32out/$BASE.bin | awk '{ print $1;}'` 2>/dev/null >/dev/null fi if [ -f $OUTDIR/$BASE.bin ] ; then diff --git a/testdata/M32_expected/1000-allops-value-65816 b/testdata/M32_expected/1000-allops-value-65816 deleted file mode 100644 index 204a57b..0000000 Binary files a/testdata/M32_expected/1000-allops-value-65816 and /dev/null differ diff --git a/testdata/M32_expected/1001-allops-zero-65816 b/testdata/M32_expected/1001-allops-zero-65816 deleted file mode 100644 index a885f04..0000000 Binary files a/testdata/M32_expected/1001-allops-zero-65816 and /dev/null differ diff --git a/testdata/M32_expected/1002-embedded-instructions b/testdata/M32_expected/1002-embedded-instructions deleted file mode 100644 index cffff3c..0000000 Binary files a/testdata/M32_expected/1002-embedded-instructions and /dev/null differ diff --git a/testdata/M32_expected/1003-flags-and-branches b/testdata/M32_expected/1003-flags-and-branches deleted file mode 100644 index 34e3a42..0000000 Binary files a/testdata/M32_expected/1003-flags-and-branches and /dev/null differ diff --git a/testdata/M32_expected/1004-data-recognition b/testdata/M32_expected/1004-data-recognition deleted file mode 100644 index 7687e62..0000000 Binary files a/testdata/M32_expected/1004-data-recognition and /dev/null differ diff --git a/testdata/M32_expected/2000-allops-value-6502 b/testdata/M32_expected/2000-allops-value-6502 deleted file mode 100644 index 52f4f7a..0000000 Binary files a/testdata/M32_expected/2000-allops-value-6502 and /dev/null differ diff --git a/testdata/M32_expected/2001-allops-zero-6502 b/testdata/M32_expected/2001-allops-zero-6502 deleted file mode 100644 index 4e99391..0000000 Binary files a/testdata/M32_expected/2001-allops-zero-6502 and /dev/null differ diff --git a/testdata/M32_expected/2002-allops-value-65C02 b/testdata/M32_expected/2002-allops-value-65C02 deleted file mode 100644 index 264d1f6..0000000 Binary files a/testdata/M32_expected/2002-allops-value-65C02 and /dev/null differ diff --git a/testdata/M32_expected/2003-allops-zero-65C02 b/testdata/M32_expected/2003-allops-zero-65C02 deleted file mode 100644 index 094abe6..0000000 Binary files a/testdata/M32_expected/2003-allops-zero-65C02 and /dev/null differ diff --git a/testdata/M32_expected/2004-numeric-types b/testdata/M32_expected/2004-numeric-types deleted file mode 100644 index 47e2524..0000000 Binary files a/testdata/M32_expected/2004-numeric-types and /dev/null differ diff --git a/testdata/M32_expected/2005-string-types b/testdata/M32_expected/2005-string-types deleted file mode 100644 index df57058..0000000 Binary files a/testdata/M32_expected/2005-string-types and /dev/null differ diff --git a/testdata/M32_expected/2006-operand-formats b/testdata/M32_expected/2006-operand-formats deleted file mode 100644 index ff2319e..0000000 Binary files a/testdata/M32_expected/2006-operand-formats and /dev/null differ diff --git a/testdata/M32_expected/2007-labels-and-symbols b/testdata/M32_expected/2007-labels-and-symbols deleted file mode 100644 index a200c62..0000000 Binary files a/testdata/M32_expected/2007-labels-and-symbols and /dev/null differ diff --git a/testdata/M32_expected/2008-address-changes b/testdata/M32_expected/2008-address-changes deleted file mode 100644 index cfec9c0..0000000 Binary files a/testdata/M32_expected/2008-address-changes and /dev/null differ diff --git a/testdata/M32_expected/2010-target-adjustment b/testdata/M32_expected/2010-target-adjustment deleted file mode 100644 index 5b3cfa6..0000000 Binary files a/testdata/M32_expected/2010-target-adjustment and /dev/null differ diff --git a/testdata/M32_expected/2011-hinting b/testdata/M32_expected/2011-hinting deleted file mode 100644 index 07cb179..0000000 --- a/testdata/M32_expected/2011-hinting +++ /dev/null @@ -1,2 +0,0 @@ -,,, -,  V$"  ( V$3D : =V$ E` V$Uf`` \ No newline at end of file diff --git a/testdata/M32_expected/2012-label-localizer b/testdata/M32_expected/2012-label-localizer deleted file mode 100644 index 7a2358e..0000000 Binary files a/testdata/M32_expected/2012-label-localizer and /dev/null differ diff --git a/testdata/M32_expected/2013-notes-and-comments b/testdata/M32_expected/2013-notes-and-comments deleted file mode 100644 index 233ba05..0000000 Binary files a/testdata/M32_expected/2013-notes-and-comments and /dev/null differ diff --git a/testdata/M32_expected/2014-label-dp b/testdata/M32_expected/2014-label-dp deleted file mode 100644 index 5c8e85e..0000000 Binary files a/testdata/M32_expected/2014-label-dp and /dev/null differ diff --git a/testdata/M32_expected/2019-local-variables b/testdata/M32_expected/2019-local-variables deleted file mode 100644 index 2e00938..0000000 Binary files a/testdata/M32_expected/2019-local-variables and /dev/null differ diff --git a/testdata/M32_expected/2020-cycle-counts-65816 b/testdata/M32_expected/2020-cycle-counts-65816 deleted file mode 100644 index a35ec67..0000000 Binary files a/testdata/M32_expected/2020-cycle-counts-65816 and /dev/null differ diff --git a/testdata/M32_expected/2021-external-symbols b/testdata/M32_expected/2021-external-symbols deleted file mode 100644 index b1d9202..0000000 Binary files a/testdata/M32_expected/2021-external-symbols and /dev/null differ diff --git a/testdata/M32_expected/2022-extension-scripts b/testdata/M32_expected/2022-extension-scripts deleted file mode 100644 index f110a86..0000000 Binary files a/testdata/M32_expected/2022-extension-scripts and /dev/null differ