mirror of
https://github.com/marketideas/qasm.git
synced 2024-12-28 06:29:58 +00:00
if/else/fin and some lst work
This commit is contained in:
parent
02bdd29e79
commit
6664a3e103
61
asm.cpp
61
asm.cpp
@ -25,12 +25,12 @@ void CLASS::setError(uint32_t ecode)
|
|||||||
|
|
||||||
void CLASS::print(uint32_t lineno)
|
void CLASS::print(uint32_t lineno)
|
||||||
{
|
{
|
||||||
int pcol;
|
uint32_t l, i, savpcol, pcol;
|
||||||
uint32_t l, i;
|
bool commentprinted = false;
|
||||||
//int commentcol;
|
|
||||||
static bool checked = false;
|
static bool checked = false;
|
||||||
static bool nc1 = false;
|
static bool nc1 = false;
|
||||||
bool nc = false;
|
bool nc = false;
|
||||||
|
uint8_t commentcol=tabs[2];
|
||||||
|
|
||||||
uint32_t b = 4; // how many bytes show on the first line
|
uint32_t b = 4; // how many bytes show on the first line
|
||||||
|
|
||||||
@ -53,7 +53,7 @@ void CLASS::print(uint32_t lineno)
|
|||||||
if (merlinstyle)
|
if (merlinstyle)
|
||||||
{
|
{
|
||||||
//printf("errorcode=%d\n",errorcode);
|
//printf("errorcode=%d\n",errorcode);
|
||||||
printf("%s in line: %d", errStrings[errorcode].c_str(), lineno + 1);
|
printf("\n%s in line: %d", errStrings[errorcode].c_str(), lineno + 1);
|
||||||
if (errorText != "")
|
if (errorText != "")
|
||||||
{
|
{
|
||||||
printf("%s", errorText.c_str());
|
printf("%s", errorText.c_str());
|
||||||
@ -155,6 +155,7 @@ void CLASS::print(uint32_t lineno)
|
|||||||
pcol += printf("%02X ", addressmode & 0xFF);
|
pcol += printf("%02X ", addressmode & 0xFF);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
savpcol = pcol; // this is how many bytes are in the side margin
|
||||||
pcol = 0; // reset pcol here because this is where source code starts
|
pcol = 0; // reset pcol here because this is where source code starts
|
||||||
|
|
||||||
if (empty)
|
if (empty)
|
||||||
@ -168,15 +169,43 @@ void CLASS::print(uint32_t lineno)
|
|||||||
pcol += printf(" ");
|
pcol += printf(" ");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
//else
|
||||||
{
|
{
|
||||||
pcol += printf("%s", comment.c_str());
|
int comct = 0;
|
||||||
|
for (uint32_t cc = 0; cc < comment.length(); cc++)
|
||||||
|
{
|
||||||
|
pcol += printf("%c", comment[cc]);
|
||||||
|
comct++;
|
||||||
|
if ((comment[cc] <= ' ') && (pcol >= (commentcol + savpcol + 10)))
|
||||||
|
{
|
||||||
|
printf("\n");
|
||||||
|
pcol = 0;
|
||||||
|
while (pcol < (commentcol + savpcol))
|
||||||
|
{
|
||||||
|
pcol += printf(" ");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
//pcol += printf("%s", comment.c_str());
|
||||||
|
|
||||||
|
}
|
||||||
|
commentprinted = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
pcol += printf("%-12s %-8s %-10s ", printlable.c_str(), opcode.c_str(), operand.c_str());
|
pcol += printf("%s ",printlable.c_str());
|
||||||
|
while (pcol < tabs[0])
|
||||||
|
{
|
||||||
|
pcol += printf(" ");
|
||||||
|
}
|
||||||
|
pcol+=printf("%s ",opcode.c_str());
|
||||||
|
while (pcol < tabs[1])
|
||||||
|
{
|
||||||
|
pcol += printf(" ");
|
||||||
|
}
|
||||||
|
pcol+=printf("%s ",operand.c_str());
|
||||||
|
//pcol += printf("%-12s %-8s %-10s ", printlable.c_str(), opcode.c_str(), operand.c_str());
|
||||||
}
|
}
|
||||||
if ((errorcode > 0) && (!merlinstyle))
|
if ((errorcode > 0) && (!merlinstyle))
|
||||||
{
|
{
|
||||||
@ -186,7 +215,7 @@ void CLASS::print(uint32_t lineno)
|
|||||||
}
|
}
|
||||||
pcol += printf(":[Error] %s %s", errStrings[errorcode].c_str(), errorText.c_str());
|
pcol += printf(":[Error] %s %s", errStrings[errorcode].c_str(), errorText.c_str());
|
||||||
}
|
}
|
||||||
else
|
else if (!commentprinted)
|
||||||
{
|
{
|
||||||
while (pcol < commentcol)
|
while (pcol < commentcol)
|
||||||
{
|
{
|
||||||
@ -208,7 +237,7 @@ void CLASS::print(uint32_t lineno)
|
|||||||
}
|
}
|
||||||
|
|
||||||
uint32_t ct = 1;
|
uint32_t ct = 1;
|
||||||
if ((obc > b) && ((truncdata&0x01)==0))
|
if ((obc > b) && ((truncdata & 0x01) == 0))
|
||||||
{
|
{
|
||||||
ct = 0;
|
ct = 0;
|
||||||
uint8_t db;
|
uint8_t db;
|
||||||
@ -261,7 +290,6 @@ void CLASS::clear()
|
|||||||
operand_expr2 = "";
|
operand_expr2 = "";
|
||||||
addrtext = "";
|
addrtext = "";
|
||||||
linemx = 0;
|
linemx = 0;
|
||||||
commentcol = 40;
|
|
||||||
bytect = 0;
|
bytect = 0;
|
||||||
opflags = 0;
|
opflags = 0;
|
||||||
pass0bytect = 0;
|
pass0bytect = 0;
|
||||||
@ -1293,7 +1321,7 @@ void CLASS::initpass(void)
|
|||||||
passcomplete = false;
|
passcomplete = false;
|
||||||
dumstartaddr = 0;
|
dumstartaddr = 0;
|
||||||
dumstart = 0;
|
dumstart = 0;
|
||||||
truncdata=0;
|
truncdata = 0;
|
||||||
variables.clear(); // clear the variables for each pass
|
variables.clear(); // clear the variables for each pass
|
||||||
|
|
||||||
while (!PCstack.empty())
|
while (!PCstack.empty())
|
||||||
@ -1626,19 +1654,14 @@ void CLASS::process(void)
|
|||||||
|
|
||||||
line.eval_result = 0;
|
line.eval_result = 0;
|
||||||
line.lineno = lineno + 1;
|
line.lineno = lineno + 1;
|
||||||
line.truncdata=truncdata;
|
line.truncdata = truncdata;
|
||||||
|
memcpy(line.tabs,tabs,sizeof(tabs));
|
||||||
//printf("lineno: %d %d |%s|\n",lineno,l,line.operand.c_str());
|
//printf("lineno: %d %d |%s|\n",lineno,l,line.operand.c_str());
|
||||||
|
|
||||||
op = Poco::toLower(line.opcode);
|
op = Poco::toLower(line.opcode);
|
||||||
operand = Poco::toLower(line.operand);
|
operand = Poco::toLower(line.operand);
|
||||||
line.startpc = PC.currentpc;
|
line.startpc = PC.currentpc;
|
||||||
line.linemx = mx;
|
line.linemx = mx;
|
||||||
uint16_t cc = tabs[2];
|
|
||||||
if (cc == 0)
|
|
||||||
{
|
|
||||||
cc = 40;
|
|
||||||
}
|
|
||||||
line.commentcol = cc;
|
|
||||||
line.bytect = 0;
|
line.bytect = 0;
|
||||||
line.showmx = showmx;
|
line.showmx = showmx;
|
||||||
|
|
||||||
@ -1701,7 +1724,7 @@ void CLASS::process(void)
|
|||||||
if ((x > 0) && (codeSkipped())) // has a psuedo-op turned off code generation? (LUP, IF, etc)
|
if ((x > 0) && (codeSkipped())) // has a psuedo-op turned off code generation? (LUP, IF, etc)
|
||||||
{
|
{
|
||||||
x = 0;
|
x = 0;
|
||||||
line.outbytect=0;
|
line.outbytect = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (x > 0)
|
if (x > 0)
|
||||||
|
4
asm.h
4
asm.h
@ -187,7 +187,7 @@ public:
|
|||||||
std::string comment;
|
std::string comment;
|
||||||
std::string addrtext;
|
std::string addrtext;
|
||||||
uint8_t linemx;
|
uint8_t linemx;
|
||||||
uint16_t commentcol;
|
uint8_t tabs[16];
|
||||||
bool showmx;
|
bool showmx;
|
||||||
uint8_t truncdata;
|
uint8_t truncdata;
|
||||||
uint32_t lineno;
|
uint32_t lineno;
|
||||||
@ -224,7 +224,7 @@ protected:
|
|||||||
std::vector<std::string> filenames;
|
std::vector<std::string> filenames;
|
||||||
uint8_t syntax;
|
uint8_t syntax;
|
||||||
uint64_t starttime;
|
uint64_t starttime;
|
||||||
uint8_t tabs[10];
|
uint8_t tabs[16];
|
||||||
|
|
||||||
uint32_t filecount; // how many files have been read in (because of included files from source
|
uint32_t filecount; // how many files have been read in (because of included files from source
|
||||||
public:
|
public:
|
||||||
|
2
qasm.ini
2
qasm.ini
@ -31,7 +31,7 @@ merlincompatible=true
|
|||||||
symcolumns=3
|
symcolumns=3
|
||||||
|
|
||||||
[reformat]
|
[reformat]
|
||||||
tabs=12; 18; 30;
|
tabs=12; 18; 30
|
||||||
;tabs=0;0;0
|
;tabs=0;0;0
|
||||||
|
|
||||||
|
|
||||||
|
@ -13,10 +13,10 @@
|
|||||||
xc
|
xc
|
||||||
mx %00
|
mx %00
|
||||||
|
|
||||||
|
|
||||||
*==========================================================
|
*==========================================================
|
||||||
* monitor addresses
|
* monitor addresses
|
||||||
|
|
||||||
|
|
||||||
TEXT = $FB39 ;Reset text window
|
TEXT = $FB39 ;Reset text window
|
||||||
TABV = $FB5B ;Complete vtab, using contents of 'A'
|
TABV = $FB5B ;Complete vtab, using contents of 'A'
|
||||||
MONBELL = $FBE4 ;random bell noise!
|
MONBELL = $FBE4 ;random bell noise!
|
||||||
|
@ -308,5 +308,5 @@ startF0
|
|||||||
inc expr,x
|
inc expr,x
|
||||||
sbcl lexpr,x
|
sbcl lexpr,x
|
||||||
lst off
|
lst off
|
||||||
sav ./test.bin
|
sav /tmp/test.bin
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user