Fixed bug in Prototype assembler which did the wrong thing with

'FF FF FF FF' strings
This commit is contained in:
Jeremiah Orians 2017-12-23 19:57:39 -05:00
parent c81c2567ab
commit ae9ee1df10
No known key found for this signature in database
GPG Key ID: 7457821534D2ACCD
1 changed files with 18 additions and 1 deletions

View File

@ -534,6 +534,23 @@ void hexify_string(char* s, char* d, int max)
}
}
int get_hex_size(char* a)
{
int count = 0;
while(0 != a[0])
{
switch(a[0])
{
case '0' ... '9':
case 'A' ... 'F':
case 'a' ... 'f': count = count + 1; break;
default: break;
}
a = a + 1;
}
return (count / 2);
}
void process_string(struct Token* p)
{
/* Adjust hex and ascii strings */
@ -542,7 +559,7 @@ void process_string(struct Token* p)
if('\'' == p->Text[0])
{ /* Handle Hex strings */
strncpy(p->Expression, p->Text + 1, max_string);
p->size = strnlen(p->Expression, max_string)/2;
p->size = get_hex_size(p->Expression);
}
else if('"' == p->Text[0])
{ /* Handle ASCII strings */