mirror of
https://github.com/marketideas/qasm.git
synced 2024-12-27 15:29:30 +00:00
commit
ed6867cc3d
4
Makefile
4
Makefile
@ -18,7 +18,7 @@ endif
|
||||
|
||||
all:
|
||||
-mkdir -p ./build
|
||||
-cd ./build && cmake .. && $(MAKE) $S
|
||||
-cd ./build && cmake -DCMAKE_BUILD_TYPE=DEBUG .. && $(MAKE) $S
|
||||
|
||||
release:
|
||||
-rm -rf ./build
|
||||
@ -33,9 +33,11 @@ debug:
|
||||
|
||||
distclean:
|
||||
rm -rf ./build
|
||||
-rm -rf ./testout
|
||||
|
||||
clean:
|
||||
-rm -rf ./build
|
||||
-rm -rf ./testout
|
||||
|
||||
depend:
|
||||
-cd ./build && $(MAKE) depend
|
||||
|
1
asm.cpp
1
asm.cpp
@ -1784,7 +1784,6 @@ void CLASS::process(void)
|
||||
|
||||
int64_t value = -1;
|
||||
x = evaluate(line, line.operand_expr, value);
|
||||
//line.eval_result=x;
|
||||
|
||||
if (x == 0)
|
||||
{
|
||||
|
1
asm.h
1
asm.h
@ -409,6 +409,7 @@ public:
|
||||
int doNoPattern(MerlinLine &line, TSymbol &sym);
|
||||
int doMVN(MerlinLine &line, TSymbol &sym);
|
||||
int doPER(MerlinLine &line, TSymbol &sym);
|
||||
int doBRK(MerlinLine & line, TSymbol & sym);
|
||||
|
||||
int doEQU(MerlinLine &line, TSymbol &sym);
|
||||
int doXC(MerlinLine &line, TSymbol &sym);
|
||||
|
26
opcodes.cpp
26
opcodes.cpp
@ -750,6 +750,30 @@ int CLASS::doBYTE(MerlinLine & line, TSymbol & sym)
|
||||
return (res);
|
||||
}
|
||||
|
||||
int CLASS::doBRK(MerlinLine & line, TSymbol & sym)
|
||||
{
|
||||
UNUSED(sym);
|
||||
|
||||
int res = 1;
|
||||
int bytes=0;
|
||||
|
||||
if (line.operand_expr!="")
|
||||
{
|
||||
bytes++;
|
||||
}
|
||||
if (pass > 0)
|
||||
{
|
||||
setOpcode(line, sym.opcode);
|
||||
for (int i=0;i<bytes;i++)
|
||||
{
|
||||
line.outbytes.push_back((line.expr_value>>(8*i))&0xFF);
|
||||
}
|
||||
|
||||
line.outbytect = res+bytes;
|
||||
}
|
||||
return (res+bytes);
|
||||
}
|
||||
|
||||
void CLASS::insertOpcodes(void)
|
||||
{
|
||||
pushopcode("=", 0x00, OP_PSUEDO, OPHANDLER(&CLASS::doEQU));
|
||||
@ -828,7 +852,7 @@ void CLASS::insertOpcodes(void)
|
||||
pushopcode("BNE", 0x03, 0, OPHANDLER(&CLASS::doBRANCH));
|
||||
pushopcode("BPL", 0x00, 0, OPHANDLER(&CLASS::doBRANCH));
|
||||
pushopcode("BRA", 0x40, 0, OPHANDLER(&CLASS::doBRANCH));
|
||||
pushopcode("BRK", 0x00, 1, OPHANDLER(&CLASS::doAddress));
|
||||
pushopcode("BRK", 0x00, 1, OPHANDLER(&CLASS::doBRK));
|
||||
pushopcode("BRL", 0x20, 0, OPHANDLER(&CLASS::doBRANCH));
|
||||
pushopcode("BVC", 0x01, 0, OPHANDLER(&CLASS::doBRANCH));
|
||||
pushopcode("BVS", 0x81, 0, OPHANDLER(&CLASS::doBRANCH));
|
||||
|
26
runtests.sh
26
runtests.sh
@ -7,8 +7,15 @@ rm -f $TMPFILE
|
||||
rm -rf $OUTDIR
|
||||
mkdir -p $OUTDIR
|
||||
|
||||
SRC=`ls ./testdata`
|
||||
SRC=`ls ./testdata | grep -E '^([0-9]+)(.*)\.[Ss]'`
|
||||
|
||||
#for S in $SRC ; do
|
||||
# echo $S
|
||||
#done
|
||||
#exit
|
||||
|
||||
TOTAL=0
|
||||
FAILCT=0
|
||||
|
||||
for S in $SRC ; do
|
||||
|
||||
@ -21,11 +28,22 @@ for S in $SRC ; do
|
||||
./qasm -o 0/$OUTDIR/$S1 ./testdata/$S >> $TMPFILE
|
||||
|
||||
R=?$
|
||||
echo $S " " $S1
|
||||
cat $TMPFILE | grep "End qASM assembly"
|
||||
#echo $S " " $S1
|
||||
R=`cat $TMPFILE | grep "End qASM assembly"`
|
||||
E=`echo $R | awk -e '{ print $6; }'`
|
||||
ect=`echo $(($E))`
|
||||
P="PASS: "
|
||||
TOTAL=$(($TOTAL+1))
|
||||
if [ $ect != 0 ] ; then
|
||||
printf 'FAIL: (%3s) ' $ect
|
||||
|
||||
FAILCT=$(($FAILCT+1))
|
||||
else
|
||||
printf "PASS: "
|
||||
fi
|
||||
echo " $S"
|
||||
done
|
||||
ls -l $OUTDIR
|
||||
echo "Total: $TOTAL Fail: $FAILCT"
|
||||
|
||||
|
||||
|
||||
|
2
testdata/allops-common-6502.S
vendored
2
testdata/allops-common-6502.S
vendored
@ -2,8 +2,6 @@
|
||||
; See the LICENSE.txt file for distribution terms (Apache 2.0).
|
||||
;
|
||||
; Assembler: Merlin 32
|
||||
ABS equ $A55A
|
||||
ZP equ $FF
|
||||
|
||||
ORG $1000
|
||||
|
||||
|
5
testdata/allops-common-65816.S
vendored
5
testdata/allops-common-65816.S
vendored
@ -2,11 +2,6 @@
|
||||
; See the LICENSE.txt file for distribution terms (Apache 2.0).
|
||||
;
|
||||
; Assembler: Merlin 32
|
||||
MV0 equ $FE0000
|
||||
MV1 equi $FF0000
|
||||
|
||||
ABS equ $A55A
|
||||
ZP equ $FF
|
||||
|
||||
ORG $1000
|
||||
|
||||
|
3
testdata/allops-common-65C02.S
vendored
3
testdata/allops-common-65C02.S
vendored
@ -2,8 +2,7 @@
|
||||
; See the LICENSE.txt file for distribution terms (Apache 2.0).
|
||||
;
|
||||
; Assembler: Merlin 32
|
||||
ABS equ $A55A
|
||||
ZP equ $FF
|
||||
|
||||
ORG $1000
|
||||
|
||||
JSR PostBRK
|
||||
|
Loading…
Reference in New Issue
Block a user