mirror of
https://github.com/marketideas/qasm.git
synced 2026-04-21 22:16:43 +00:00
test
This commit is contained in:
@@ -27,6 +27,8 @@ void CLASS::print(uint32_t lineno)
|
||||
{
|
||||
int i, l, pcol;
|
||||
int commentcol = 40;
|
||||
static bool checked = false;
|
||||
static bool nc1 = false;
|
||||
bool nc = false;
|
||||
|
||||
|
||||
@@ -36,7 +38,21 @@ void CLASS::print(uint32_t lineno)
|
||||
l = 4;
|
||||
}
|
||||
|
||||
nc = getBool("option.nocolor", false);
|
||||
if (!checked)
|
||||
{
|
||||
nc1 = getBool("option.nocolor", false);
|
||||
checked = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
nc = nc1;
|
||||
}
|
||||
|
||||
if (!isatty(STDOUT_FILENO))
|
||||
{
|
||||
nc = true;
|
||||
}
|
||||
|
||||
if (!nc)
|
||||
{
|
||||
if (errorcode > 0)
|
||||
@@ -896,6 +912,9 @@ const TaddrMode addrRegEx[] =
|
||||
// one or more of any character except ][,();
|
||||
const std::string valExpression = "^([^\\]\\[,();]+)$";
|
||||
|
||||
// this one looks for ]variables
|
||||
const std::string varExpression = "^^([\\]][:-~][0-9A-Z_a-z~]*)";
|
||||
|
||||
// opcode check. emitted opcodes are compared against this
|
||||
// table, and if the XC status doesn't meet the requirements
|
||||
// an error is thrown
|
||||
@@ -1201,6 +1220,25 @@ int CLASS::parseOperand(MerlinLine & line)
|
||||
return (res);
|
||||
}
|
||||
|
||||
|
||||
int CLASS::substituteVariables(MerlinLine & line)
|
||||
{
|
||||
int res = -1;
|
||||
int idx;
|
||||
std::string oper = line.operand;
|
||||
if (oper.length() > 0)
|
||||
{
|
||||
std::vector<std::string> groups;
|
||||
|
||||
idx = 0;
|
||||
RegularExpression varEx(varExpression, 0, true);
|
||||
|
||||
groups.clear();
|
||||
|
||||
}
|
||||
return (res);
|
||||
}
|
||||
|
||||
void CLASS::process(void)
|
||||
{
|
||||
uint32_t l;
|
||||
@@ -1256,6 +1294,7 @@ void CLASS::process(void)
|
||||
line.setError(errDupSymbol);
|
||||
}
|
||||
}
|
||||
x = substituteVariables(line);
|
||||
x = parseOperand(line);
|
||||
if (x >= 0)
|
||||
{
|
||||
|
||||
@@ -40,13 +40,13 @@ enum asmErrors
|
||||
errNone,
|
||||
errWarn,
|
||||
errIncomplete,
|
||||
errUnimplemented,
|
||||
errFatal,
|
||||
errBadAddressMode,
|
||||
errBadOpcode,
|
||||
errIncompatibleOpcode,
|
||||
errBadByteCount,
|
||||
errBadBranch,
|
||||
errUnimplemented,
|
||||
errForwardRef,
|
||||
errNoRedefinition,
|
||||
errBadOperand,
|
||||
@@ -64,13 +64,13 @@ const std::string errStrings[errMAX + 1] =
|
||||
"No Error",
|
||||
"Warning",
|
||||
"Unfinished Opcode",
|
||||
"Unimplemented Instruction",
|
||||
"Fatal",
|
||||
"Unsupported Addressing Mode",
|
||||
"Unknown Opcode",
|
||||
"Opcode not available under CPU mode",
|
||||
"Byte output differs between passes",
|
||||
"Relative branch offset too large",
|
||||
"Unimplemented Instruction",
|
||||
"Forward Reference to symbol",
|
||||
"Unable to redefine symbol",
|
||||
"Unable to evaluate",
|
||||
@@ -316,6 +316,7 @@ public:
|
||||
void showVariables(void);
|
||||
int evaluate(MerlinLine &line,std::string expr, int64_t &value);
|
||||
|
||||
int substituteVariables(MerlinLine & line);
|
||||
int parseOperand(MerlinLine &line);
|
||||
int getAddrMode(MerlinLine &line);
|
||||
void setOpcode(MerlinLine &line, uint8_t op);
|
||||
|
||||
@@ -565,6 +565,11 @@ int CLASS::doBase6502(MerlinLine & line, TSymbol & sym)
|
||||
}
|
||||
}
|
||||
}
|
||||
if (line.flags&FLAG_FORCELONG)
|
||||
{
|
||||
line.setError(errBadAddressMode);
|
||||
}
|
||||
goto out;
|
||||
}
|
||||
|
||||
if (m == syn_imm)
|
||||
|
||||
@@ -5,8 +5,8 @@ logfile=mylog.log
|
||||
|
||||
[option]
|
||||
debug=1
|
||||
nocolor=true
|
||||
;must be an integer. Code can use this as a level
|
||||
nocolor=false
|
||||
;debug must be an integer. Code can use this as a level
|
||||
|
||||
[application]
|
||||
timezone=America/Los_Angeles
|
||||
|
||||
+125
-1
@@ -189,6 +189,130 @@ myQuit
|
||||
lda: $05
|
||||
ldal $05
|
||||
|
||||
lda $45
|
||||
lda $2345
|
||||
lda $012345
|
||||
ldaz $2345
|
||||
lda: $45
|
||||
ldal $012345
|
||||
ldal $2345
|
||||
ldal $45
|
||||
lda <$2345
|
||||
lda >$2345
|
||||
lda <$012345
|
||||
lda >$012345
|
||||
lda ^$012345
|
||||
lda |$012345
|
||||
|
||||
ora $45
|
||||
ora $2345
|
||||
ora $012345
|
||||
oraz $2345
|
||||
ora: $45
|
||||
oral $012345
|
||||
oral $2345
|
||||
oral $45
|
||||
ora <$2345
|
||||
ora >$2345
|
||||
ora <$012345
|
||||
ora >$012345
|
||||
ora ^$012345
|
||||
ora |$012345
|
||||
|
||||
and $45
|
||||
and $2345
|
||||
and $012345
|
||||
andz $2345
|
||||
and: $45
|
||||
andl $012345
|
||||
andl $2345
|
||||
andl $45
|
||||
and <$2345
|
||||
and >$2345
|
||||
and <$012345
|
||||
and >$012345
|
||||
and ^$012345
|
||||
and |$012345
|
||||
|
||||
eor $45
|
||||
eor $2345
|
||||
eor $012345
|
||||
eorz $2345
|
||||
eor: $45
|
||||
eorl $012345
|
||||
eorl $2345
|
||||
eorl $45
|
||||
eor <$2345
|
||||
eor >$2345
|
||||
eor <$012345
|
||||
eor >$012345
|
||||
eor ^$012345
|
||||
eor |$012345
|
||||
|
||||
adc $45
|
||||
adc $2345
|
||||
adc $012345
|
||||
adcz $2345
|
||||
adc: $45
|
||||
adcl $012345
|
||||
adcl $2345
|
||||
adcl $45
|
||||
adc <$2345
|
||||
adc >$2345
|
||||
adc <$012345
|
||||
adc >$012345
|
||||
adc ^$012345
|
||||
adc |$012345
|
||||
|
||||
sta $45
|
||||
sta $2345
|
||||
sta $012345
|
||||
staz $2345
|
||||
sta: $45
|
||||
stal $012345
|
||||
stal $2345
|
||||
stal $45
|
||||
sta <$2345
|
||||
sta >$2345
|
||||
sta <$012345
|
||||
sta >$012345
|
||||
sta ^$012345
|
||||
sta |$012345
|
||||
|
||||
cmp $45
|
||||
cmp $2345
|
||||
cmp $012345
|
||||
cmpz $2345
|
||||
cmp: $45
|
||||
cmpl $012345
|
||||
cmpl $2345
|
||||
cmpl $45
|
||||
cmp <$2345
|
||||
cmp >$2345
|
||||
cmp <$012345
|
||||
cmp >$012345
|
||||
cmp ^$012345
|
||||
cmp |$012345
|
||||
|
||||
sbc $45
|
||||
sbc $2345
|
||||
sbc $012345
|
||||
sbcz $2345
|
||||
sbc: $45
|
||||
sbcl $012345
|
||||
sbcl $2345
|
||||
sbcl $45
|
||||
sbc <$2345
|
||||
sbc >$2345
|
||||
sbc <$012345
|
||||
sbc >$012345
|
||||
sbc ^$012345
|
||||
sbc |$012345
|
||||
|
||||
asll $1234
|
||||
|
||||
|
||||
lst off
|
||||
|
||||
lda <$fff0+24 ;zp
|
||||
lda >$fff0+24 ;ABS (lo word)
|
||||
@@ -240,5 +364,5 @@ L00BC bit L00BC
|
||||
stx L00BC,y
|
||||
|
||||
//]XCODEEND ; Keep this at the end and put your code above this
|
||||
lst off
|
||||
;lst off
|
||||
|
||||
|
||||
Reference in New Issue
Block a user