Merge branch 'master' of https://github.com/project64/project64
This commit is contained in:
commit
bf53126ac0
|
@ -11,7 +11,7 @@
|
||||||
|
|
||||||
REGISTER* lookup_register(char* name);
|
REGISTER* lookup_register(char* name);
|
||||||
|
|
||||||
static int parse_error = 0;
|
static ParseError parse_error = ERR_NONE;
|
||||||
static uint32_t m_Address = 0x00000000;
|
static uint32_t m_Address = 0x00000000;
|
||||||
|
|
||||||
void to_lower(char* str)
|
void to_lower(char* str)
|
||||||
|
@ -51,6 +51,12 @@ uint32_t pop_val()
|
||||||
{
|
{
|
||||||
char* v = strtok(NULL, " \t,()");
|
char* v = strtok(NULL, " \t,()");
|
||||||
|
|
||||||
|
if (v == NULL)
|
||||||
|
{
|
||||||
|
parse_error = ERR_EXPECTED_VAL;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
if (isalpha(*v))
|
if (isalpha(*v))
|
||||||
{
|
{
|
||||||
// todo lookup label value
|
// todo lookup label value
|
||||||
|
@ -306,6 +312,8 @@ REGISTER* lookup_register(char* name)
|
||||||
|
|
||||||
bool CAssembler::AssembleLine(char* line, uint32_t* opcode, uint32_t address)
|
bool CAssembler::AssembleLine(char* line, uint32_t* opcode, uint32_t address)
|
||||||
{
|
{
|
||||||
|
parse_error = ERR_NONE;
|
||||||
|
|
||||||
m_Address = address;
|
m_Address = address;
|
||||||
char line_c[128];
|
char line_c[128];
|
||||||
strncpy(line_c, line, 128);
|
strncpy(line_c, line, 128);
|
||||||
|
@ -338,6 +346,11 @@ bool CAssembler::AssembleLine(char* line, uint32_t* opcode, uint32_t address)
|
||||||
for (int i = 0; instruction->syntax[i]; i++)
|
for (int i = 0; instruction->syntax[i]; i++)
|
||||||
{
|
{
|
||||||
instruction->syntax[i](opcode);
|
instruction->syntax[i](opcode);
|
||||||
|
|
||||||
|
if (parse_error != ERR_NONE)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
|
@ -202,11 +202,11 @@ LRESULT CDebugCommandsView::OnOpKeyDown(UINT uMsg, WPARAM wParam, LPARAM lParam,
|
||||||
int textLen = m_OpEdit.GetWindowTextLengthA();
|
int textLen = m_OpEdit.GetWindowTextLengthA();
|
||||||
char text[256];
|
char text[256];
|
||||||
m_OpEdit.GetWindowTextA(text, 255);
|
m_OpEdit.GetWindowTextA(text, 255);
|
||||||
m_OpEdit.SetWindowTextA("");
|
|
||||||
uint32_t op;
|
uint32_t op;
|
||||||
bool bValid = CAssembler::AssembleLine(text, &op, m_SelectedAddress);
|
bool bValid = CAssembler::AssembleLine(text, &op, m_SelectedAddress);
|
||||||
if (bValid)
|
if (bValid)
|
||||||
{
|
{
|
||||||
|
m_OpEdit.SetWindowTextA("");
|
||||||
EditOp(m_SelectedAddress, op);
|
EditOp(m_SelectedAddress, op);
|
||||||
m_SelectedAddress += 4;
|
m_SelectedAddress += 4;
|
||||||
BeginOpEdit(m_SelectedAddress);
|
BeginOpEdit(m_SelectedAddress);
|
||||||
|
|
Loading…
Reference in New Issue