Merge pull request #13 from lroathe/master

Merge from sql branch
This commit is contained in:
Lane Roathe 2019-11-17 17:47:27 -08:00 committed by GitHub
commit ed6867cc3d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 54 additions and 16 deletions

View File

@ -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

View File

@ -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
View File

@ -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);

View File

@ -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));

View File

@ -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"

View File

@ -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

View File

@ -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

View File

@ -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

2
todo.txt Normal file
View File

@ -0,0 +1,2 @@
2019-11-17 - BRK does not detect a lable that can't be evaluated
2019-11-17 - ASCII parsing in both eval and for ASC type commands