mirror of
https://github.com/marketideas/qasm.git
synced 2024-12-27 15:29:30 +00:00
Merge branch 'sgq_qasm_main' of https://github.com/marketideas/qasm
This commit is contained in:
commit
3cab17d7f5
11
Makefile
11
Makefile
@ -32,8 +32,9 @@ debug:
|
||||
|
||||
|
||||
distclean:
|
||||
rm -rf ./build
|
||||
-rm -rf ./testout
|
||||
-rm -rf ./build
|
||||
-rm -rf ./qasmout
|
||||
-rm -rf ./m32out
|
||||
|
||||
clean:
|
||||
-rm -rf ./build
|
||||
@ -60,13 +61,13 @@ compare:
|
||||
asm:
|
||||
|
||||
test1:
|
||||
-qasm src/main.s
|
||||
-qasm testdata/3001-lroathe.S
|
||||
|
||||
test2:
|
||||
-qasm src/testfile.s
|
||||
-qasm testdata/3002-testfile.S
|
||||
|
||||
test3:
|
||||
-qasm src/var.s
|
||||
-qasm testdata/3003-var.S
|
||||
|
||||
|
||||
|
||||
|
6
asm.cpp
6
asm.cpp
@ -1342,6 +1342,11 @@ int CLASS::callOpCode(std::string op, MerlinLine &line)
|
||||
//line.expr_value = (line.expr_value >> 16) & 0xFFFF;
|
||||
break;
|
||||
case '|':
|
||||
if (syntax==SYNTAX_MERLIN)
|
||||
{
|
||||
line.setError(errBadLabel);
|
||||
line.expr_value=0;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -1554,6 +1559,7 @@ void CLASS::initpass(void)
|
||||
truncdata = 0;
|
||||
variables.clear(); // clear the variables for each pass
|
||||
|
||||
macros.clear();
|
||||
while (!PCstack.empty())
|
||||
{
|
||||
PCstack.pop();
|
||||
|
34
asm.h
34
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<MerlinLine> lines;
|
||||
std::vector<std::string> variables;
|
||||
};
|
||||
|
||||
class TPsuedoOp;
|
||||
|
||||
class T65816Asm : public TFileProcessor
|
||||
@ -371,8 +384,8 @@ public:
|
||||
|
||||
std::string currentsymstr;
|
||||
std::vector<MerlinLine> lines;
|
||||
Poco::HashMap<std::string, TMacro> macros;
|
||||
Poco::HashMap<std::string, TSymbol>opcodes;
|
||||
Poco::HashMap<std::string, TSymbol> macros;
|
||||
Poco::HashMap<std::string, TSymbol> symbols;
|
||||
Poco::HashMap<std::string, TSymbol> variables;
|
||||
|
||||
@ -386,6 +399,7 @@ public:
|
||||
std::stack<TLUPstruct> LUPstack;
|
||||
std::stack<TDOstruct> DOstack;
|
||||
std::stack<bool> LSTstack;
|
||||
std::stack<TMacro> curMacro;
|
||||
|
||||
TPsuedoOp *psuedoops;
|
||||
|
||||
|
35
merlintests.sh
Executable file
35
merlintests.sh
Executable file
@ -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
|
||||
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
#!/bin/bash
|
||||
|
||||
OUTDIR=./testout
|
||||
OUTDIR=./qasmout
|
||||
TMPFILE=/tmp/qasm_out.txt
|
||||
|
||||
rm -f $TMPFILE
|
||||
@ -40,14 +40,15 @@ 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
|
||||
QSHA=`sha256sum $OUTDIR/$BASE.bin |awk '{print $1;}'` 2>/dev/null >/dev/null
|
||||
fi
|
||||
#echo "$MSHA $QSHA"
|
||||
#echo "MSHA=$MSHA QSHA=$QSHA"
|
||||
|
||||
shapass=0;
|
||||
CX=" "
|
||||
|
28
testdata/3000-addresses.S
vendored
Normal file
28
testdata/3000-addresses.S
vendored
Normal file
@ -0,0 +1,28 @@
|
||||
lst
|
||||
xc
|
||||
xc
|
||||
org $018200
|
||||
|
||||
bank02 equ $020000
|
||||
bank03 equ $030000
|
||||
dp equ $A5
|
||||
long equ $020304
|
||||
|
||||
mx %00
|
||||
start nop
|
||||
pea ^start
|
||||
pea start
|
||||
mvn bank02,bank03
|
||||
mvp bank03,bank02
|
||||
lda dp
|
||||
lda <dp
|
||||
lda >dp
|
||||
lda ^dp
|
||||
lda |dp
|
||||
lda #long
|
||||
lda #<long
|
||||
lda #>long
|
||||
lda #^long
|
||||
lda #|long
|
||||
|
||||
lst off
|
10
src/main.s → testdata/3001-lroathe.S
vendored
10
src/main.s → testdata/3001-lroathe.S
vendored
@ -114,7 +114,7 @@ START
|
||||
adc _num1+dum1
|
||||
sbc _num1+dum1
|
||||
bit _num1+dum0
|
||||
sta _num1+dum0 ;(FIXED): can't use sta _num1+dum0
|
||||
sta _num1+dum0 ;(FIXED): can't use sta _num1+dum0 '
|
||||
stz _num1+dum0
|
||||
|
||||
lda _num1+dum0,x
|
||||
@ -180,7 +180,7 @@ myQuit
|
||||
|
||||
|
||||
ldaz $FFFF ; forced DP
|
||||
lda: $FFFF ; forced ABS (any char but 'L', 'D', and 'Z"
|
||||
lda: $FFFF ; forced ABS (any char but 'L', 'D', and 'Z'
|
||||
ldal $FFFF ; forced long abs (3 byte address)
|
||||
|
||||
ldaz $05
|
||||
@ -338,8 +338,6 @@ myQuit
|
||||
lda #^$A51234 ;bank
|
||||
|
||||
|
||||
mx MX
|
||||
|
||||
lda $0008 ;ZP
|
||||
lda $08 ;ZP
|
||||
lda $ffff-$fff7 ;ZP
|
||||
@ -362,8 +360,8 @@ L00BC bit L00BC
|
||||
|
||||
hex ;no error
|
||||
hex 11,22,33,44,55,66,77,88,99
|
||||
hex 112233445566778899F
|
||||
hex 112233445I566778899FF
|
||||
;hex 112233445566778899F
|
||||
;hex 112233445I566778899FF
|
||||
|
||||
hex aabb,CC,0123456789abcdefABCDEF,ff
|
||||
|
4
src/testfile.s → testdata/3002-testfile.S
vendored
4
src/testfile.s → testdata/3002-testfile.S
vendored
@ -14,7 +14,7 @@ lexpr = $010203
|
||||
immed = $123456
|
||||
neg equ -16
|
||||
|
||||
]var1 = v1234
|
||||
*]var1 = v1234
|
||||
|
||||
;lst off
|
||||
start00
|
||||
@ -308,5 +308,5 @@ startF0
|
||||
inc expr,x
|
||||
sbcl lexpr,x
|
||||
lst off
|
||||
sav ./test.bin
|
||||
;sav ./test.bin
|
||||
|
0
src/var.s → testdata/3003-var.S
vendored
0
src/var.s → testdata/3003-var.S
vendored
BIN
testdata/M32_expected/1000-allops-value-65816
vendored
BIN
testdata/M32_expected/1000-allops-value-65816
vendored
Binary file not shown.
BIN
testdata/M32_expected/1001-allops-zero-65816
vendored
BIN
testdata/M32_expected/1001-allops-zero-65816
vendored
Binary file not shown.
BIN
testdata/M32_expected/1002-embedded-instructions
vendored
BIN
testdata/M32_expected/1002-embedded-instructions
vendored
Binary file not shown.
BIN
testdata/M32_expected/1003-flags-and-branches
vendored
BIN
testdata/M32_expected/1003-flags-and-branches
vendored
Binary file not shown.
BIN
testdata/M32_expected/1004-data-recognition
vendored
BIN
testdata/M32_expected/1004-data-recognition
vendored
Binary file not shown.
BIN
testdata/M32_expected/2000-allops-value-6502
vendored
BIN
testdata/M32_expected/2000-allops-value-6502
vendored
Binary file not shown.
BIN
testdata/M32_expected/2001-allops-zero-6502
vendored
BIN
testdata/M32_expected/2001-allops-zero-6502
vendored
Binary file not shown.
BIN
testdata/M32_expected/2002-allops-value-65C02
vendored
BIN
testdata/M32_expected/2002-allops-value-65C02
vendored
Binary file not shown.
BIN
testdata/M32_expected/2003-allops-zero-65C02
vendored
BIN
testdata/M32_expected/2003-allops-zero-65C02
vendored
Binary file not shown.
BIN
testdata/M32_expected/2004-numeric-types
vendored
BIN
testdata/M32_expected/2004-numeric-types
vendored
Binary file not shown.
BIN
testdata/M32_expected/2005-string-types
vendored
BIN
testdata/M32_expected/2005-string-types
vendored
Binary file not shown.
BIN
testdata/M32_expected/2006-operand-formats
vendored
BIN
testdata/M32_expected/2006-operand-formats
vendored
Binary file not shown.
BIN
testdata/M32_expected/2007-labels-and-symbols
vendored
BIN
testdata/M32_expected/2007-labels-and-symbols
vendored
Binary file not shown.
BIN
testdata/M32_expected/2008-address-changes
vendored
BIN
testdata/M32_expected/2008-address-changes
vendored
Binary file not shown.
BIN
testdata/M32_expected/2010-target-adjustment
vendored
BIN
testdata/M32_expected/2010-target-adjustment
vendored
Binary file not shown.
2
testdata/M32_expected/2011-hinting
vendored
2
testdata/M32_expected/2011-hinting
vendored
@ -1,2 +0,0 @@
|
||||
,,©ę,˘˙ę
|
||||
ę,˘˙ę V$©˘" ( V$©3˘D : =ęV$ E` V$©U˘f`<60>‚<EFBFBD>©™`
|
BIN
testdata/M32_expected/2012-label-localizer
vendored
BIN
testdata/M32_expected/2012-label-localizer
vendored
Binary file not shown.
BIN
testdata/M32_expected/2013-notes-and-comments
vendored
BIN
testdata/M32_expected/2013-notes-and-comments
vendored
Binary file not shown.
BIN
testdata/M32_expected/2014-label-dp
vendored
BIN
testdata/M32_expected/2014-label-dp
vendored
Binary file not shown.
BIN
testdata/M32_expected/2019-local-variables
vendored
BIN
testdata/M32_expected/2019-local-variables
vendored
Binary file not shown.
BIN
testdata/M32_expected/2020-cycle-counts-65816
vendored
BIN
testdata/M32_expected/2020-cycle-counts-65816
vendored
Binary file not shown.
BIN
testdata/M32_expected/2021-external-symbols
vendored
BIN
testdata/M32_expected/2021-external-symbols
vendored
Binary file not shown.
BIN
testdata/M32_expected/2022-extension-scripts
vendored
BIN
testdata/M32_expected/2022-extension-scripts
vendored
Binary file not shown.
Loading…
Reference in New Issue
Block a user