Fixed regression caused by missed rename and added support for absolute addressing to prototype assembler

This commit is contained in:
Jeremiah Orians 2016-08-20 14:04:58 -04:00
parent 38a5642a3f
commit 639f429c90
No known key found for this signature in database
GPG Key ID: 7457821534D2ACCD
2 changed files with 17 additions and 8 deletions

View File

@ -87,7 +87,7 @@ Restart:
goto Token_complete; goto Token_complete;
} }
else if((10 == c) || (13 == c)) else if((10 == c) || (13 == c))
{ { /* Deal with \n and \r */
p->type = p->type | EOL; p->type = p->type | EOL;
if(1 > i) if(1 > i)
{ {
@ -99,7 +99,7 @@ Restart:
} }
} }
else if((!(p->type & comment) && !(p->type & string)) && ((32 == c) || (9 == c))) else if((!(p->type & comment) && !(p->type & string)) && ((32 == c) || (9 == c)))
{ { /* Deal with " " and \t */
if(1 > i) if(1 > i)
{ {
goto Restart; goto Restart;
@ -110,17 +110,17 @@ Restart:
} }
} }
else if((!(p->type & comment ) && !(p->type & string)) && ((35 == c) ||(59 == c))) else if((!(p->type & comment ) && !(p->type & string)) && ((35 == c) ||(59 == c)))
{ { /* Deal with # and ; */
p->type = p->type | comment; p->type = p->type | comment;
store[i] = (char)c; store[i] = (char)c;
} }
else if((!(p->type & comment ) && !(p->type & string)) && ((34 == c) ||(39 == c))) else if((!(p->type & comment ) && !(p->type & string)) && ((34 == c) ||(39 == c)))
{ { /* Deal with " and ' */
p->type = p->type | string; p->type = p->type | string;
store[i] = (char)c; store[i] = (char)c;
} }
else if((!(p->type & comment ) && !(p->type & string)) && (58 == c)) else if((!(p->type & comment ) && !(p->type & string)) && (58 == c))
{ { /* Deal with : */
p->type = p->type | label; p->type = p->type | label;
store[i] = (char)c; store[i] = (char)c;
} }
@ -423,7 +423,7 @@ void update_jumps(struct Token* head, struct Token* p)
uint32_t dest = -1; uint32_t dest = -1;
if('@' == p->Text[0]) if(('@' == p->Text[0]) || ('$' == p->Text[0]))
{ {
char temp[256] = {0}; char temp[256] = {0};
strncpy(temp, p->Text, max_string); strncpy(temp, p->Text, max_string);
@ -434,7 +434,16 @@ void update_jumps(struct Token* head, struct Token* p)
if(-1 != (int32_t)dest) if(-1 != (int32_t)dest)
{ {
int16_t dist = 0; int16_t dist = 0;
dist = dest - p->address + 4; if('@' == p->Text[0])
{
dist = dest - p->address + 4;
}
if('$' == p->Text[0])
{
dist = dest;
}
sprintf(p->Expression, "%04x", (uint16_t)dist); sprintf(p->Expression, "%04x", (uint16_t)dist);
} }

View File

@ -17,7 +17,7 @@ def Reset_lilith():
Current_IP = 0 Current_IP = 0
global Watchpoints global Watchpoints
Watchpoints = {0} Watchpoints = {0}
vm.load_lilith(ctypes.create_string_buffer("foo".encode('ascii'))) vm.load_lilith(ctypes.create_string_buffer("rom".encode('ascii')))
def Step_lilith(): def Step_lilith():
global Current_IP global Current_IP