See attached. I think you will need to define ERR_SYNTAX in the fasm.h
file as the next available error numbrer.
Ken
On 6/29/17 5:34 AM, Kurt McCullum wrote:
Thanks for trying to get that file John. No worries if you can’t get it.
Kurt
*From:*M100 [mailto:m100-boun...@lists.bitchin100.com] *On Behalf Of
*John R. Hogerhuis
*Sent:* Wednesday, June 28, 2017 2:56 PM
*To:* m...@bitchin100.com
*Subject:* Re: [M100] NEC barcode file
On Mon, Jun 26, 2017 at 2:07 PM, Kurt McCullum <kurt.mccul...@att.net
<mailto:kurt.mccul...@att.net>> wrote:
I'll let you both know if it turns up. Glad to know it's out there.
Kurt
So I tried using my CCR-82. Seems like it needs its belt(s) replaced.
If I can dig up another cassette player I may just rip the whole tape
into Audacity and deal with it there.
-- John.
/*
================================================================================
Split the provided line into space and comma separated arguments and populate
the pAsm->argv[] array with pointers to those NULL terminated args.
Example lines:
SOME_NAME equ 1<<2
field opcode[3:0]
field mux_sel[10] values { iq, pp }
jump label_name, mux_sel=iq
label_name:
set mux_sel = iq
data 4
data 4,mux_sel=pp
================================================================================
*/
int split_line( asm_context_t* pAsm, char * line)
{
char *p;
int comma_found, equal_found;
char *possible_end;
char delim;
// Initialize arg count to zero
pAsm->argc = 0;
p = line;
// Skip space to first argument
while (*p == ' ')
p++;
if (*p == CR || *p == LF)
return 0;
// Save pointer to first argument
pAsm->argv[pAsm->argc++] = p;
// NULL terminate the first argument at first space or EOL
while (*p != ' ' && *p != '\t' && *p != CR && *p != LF && *p != '\0')
p++;
if (*p != '\0')
{
*p = '\0';
p++;
}
// Skip whitespace to next arg
while (*p == ' ' || *p == '\t')
p++;
// Now split the rest of the line based on comma or space separation
delim = ',';
if (strchr(pAsm->orig_line, '{') != 0 || strchr(pAsm->orig_line, ',') == 0)
delim = ' ';
if (delim == ' ' && strchr(pAsm->orig_line, '=') != 0)
delim = ',';
while (*p != '\0')
{
// Save pointer to this arg
pAsm->argv[pAsm->argc++] = p;
// Test for '{' opening brace
if (*p == '{')
{
// Skip to ending '}'
while (*p != '}' && *p != '\0')
p++;
// Test if closing '}' found prior to EOL
if (*p == '}')
{
// Skip the closing '}'
p++;
}
else
{
// Error, no closing '}'
printf("Line %d: No closing '}' character found\n",
pAsm->lineno);
return ERR_SYNTAX;
}
}
// Now find end of comma or space delimited arg
while (*p != delim && *p != '\0' && *p != CR && *p != LF)
p++;
// Test for end of line and break loop if at end
if (*p == '\0')
break;
// NULL terminate the arg
*p++ = '\0';
// Test for 'equ' and change delimiter to ',' if found. We do
// this so we can have spaces in a complex expression. The
// expression should be a single arg, so we don't want to split
// based on spaces.
if (strcasecmp(pAsm->argv[pAsm->argc-1], "equ") == 0)
delim = ',';
// Skip white space to next arg
while (*p == ' ' || *p == '\t')
p++;
}
// Debug print the arguments
if (pAsm->debug_level > 1)
{
int x;
printf(" arg #: %d\n", pAsm->argc);
for (x = 0; x < pAsm->argc; x++)
printf(" arg %d: \"%s\"\n", x, pAsm->argv[x]);
}
return 0;
}