This commit is contained in:
marketideas 2019-11-19 17:09:58 -08:00
parent d3bc1455fa
commit e2dd7ab645
7 changed files with 20 additions and 22 deletions

19
asm.cpp
View File

@ -1331,14 +1331,15 @@ int CLASS::callOpCode(std::string op, MerlinLine &line)
switch (line.expr_shift)
{
case '<':
line.expr_value &= 0xFF;
//line.expr_value &= 0xFF;
break;
case '>':
line.expr_value >>= 8;
line.expr_value &= 0xFFFF;
//line.expr_value &= 0xFFFF;
break;
case '^':
line.expr_value = (line.expr_value >> 16) & 0xFFFF;
line.expr_value = (line.expr_value >> 16);
//line.expr_value = (line.expr_value >> 16) & 0xFFFF;
break;
case '|':
break;
@ -1352,12 +1353,14 @@ int CLASS::callOpCode(std::string op, MerlinLine &line)
line.flags |= FLAG_DP;
break;
case '>':
#if 0
if ((syntax & SYNTAX_MERLIN32) == SYNTAX_MERLIN32)
{
// bug in M32 or not, do what it does
line.flags |= FLAG_FORCEABS;
}
else
#endif
{
line.flags |= FLAG_FORCELONG;
}
@ -1406,13 +1409,6 @@ typedef struct
// these are the regular expressions that determine the addressing mode
// and extract the 'expr' part of the addr-mode
// ^([_,a-z,A-Z,0-9:\]].+)\,[s,S]{1}$ // might be a better syn_s
// "^([:-~][0-Z_-~]*)$" // this is a valid identifier
// "^([$][0-9A-Fa-f]+)$" // hex digit
// "^([%][0-1][0-1_]+[0-1])$" - binary numbera
// "^([0-9]+)$" - decimal number
// "^([:-~][^\],()]*)$" - valid expression
const TaddrMode addrRegEx[] =
{
{ "^(?'expr'.+)\\,[s,S]{1}$", syn_s, "e,s"}, // expr,s
@ -1430,9 +1426,6 @@ const TaddrMode addrRegEx[] =
{"", 0, ""}
};
// keep this next line for awhile
// {"^#{1}(?'shift'[<,>,^,|]?)(.+)$", syn_imm, "immediate"}, //#expr,#^expr,#|expr,#<expr,#>expr
// one or more of any character except ][,();
const std::string valExpression = "^([^\\]\\[,();]+)$";

View File

@ -665,7 +665,7 @@ int CLASS::evaluate(std::string & e, int64_t &res, uint8_t &_shiftmode)
}
else if (token.str == "<")
{
//rhs = (rhs << 8 ) & 0xFFFF;
//rhs = (rhs) & 0xFFFF;
}
else if (token.str == ">")
{

View File

@ -194,9 +194,14 @@ int CLASS::doMVN(MerlinLine &line, TSymbol &sym)
//line.errorText = line.operand_expr2;
}
uint32_t v=(value & 0xFFFFFFFF);
//printf("val1 %08X\n",v);
//printf("val1 %08X\n",line.expr_value);
setOpcode(line, op);
line.outbytes.push_back(value & 0xFF);
line.outbytes.push_back(line.expr_value & 0xFF);
// these bytes are the two bank registers
line.outbytes.push_back((v>>16) & 0xFF);
line.outbytes.push_back((line.expr_value>>16) & 0xFF);
line.outbytect = res;
}

View File

@ -18,15 +18,15 @@ uint32_t CLASS::doShift(uint32_t value, uint8_t shift)
{
if (shift == '<')
{
value = (value) & 0xFF;
value = (value) & 0xFFFFFF;
}
if (shift == '>')
{
value = (value >> 8) & 0xFF;
value = (value >> 8) & 0xFFFFFF;
}
else if ((shift == '^') || (shift == '|'))
{
value = (value >> 16) & 0xFF;
value = (value >> 16) & 0xFFFFFF;
}
return (value);
}

View File

@ -13,13 +13,13 @@ start nop
ldy #$00
]loop sta $800,y
dey
bne ]loop;]loop2
bne ]myvar;
;dw ]loop;]loop2
;bne ]myvar;
bcs ]loop
bpl ]loop
rts
use var
;use var
lst on

Binary file not shown.

Binary file not shown.