I have been trying to assemble ZCPR4 (4.0E) which I found on the
Internet.
Im using Al Hawley's ZMAC (ver 1.7 4/9/93) running under MYZ80 (on a
PC).
I was getting an error indicating that more than 8 levels of nested
IF's were used.
I found two places in the Z80 source where ENDIF's were missing from
"IF BANKED"
statements. Now I get a BALANCE error when the program assembles the
"END"
statement, indicating there are more unmatched IF and ENDIF's or
unclosed Macros.
Has anyone got a program that will check or indicate the nesting of
IF's and
Macros within a Z80 source program to check for proper balance.
I remember having one once for checking "{" and "}" within a BDS "C"
program and wondered
if a simular program was available for checking Z80 source code.
Anyone know of such a program ?????
Thanks
Old-Timer (John)
Well, any time I've ever needed something like that, I've just written
it... ;-)
-leor
>
>Help......
>
>I have been trying to assemble ZCPR4 (4.0E) which I found on the
>Internet.
>Im using Al Hawley's ZMAC (ver 1.7 4/9/93) running under MYZ80 (on a
>PC).
>I was getting an error indicating that more than 8 levels of nested
>IF's were used.
>I found two places in the Z80 source where ENDIF's were missing from
>"IF BANKED"
>statements. Now I get a BALANCE error when the program assembles the
>"END"
>statement, indicating there are more unmatched IF and ENDIF's or
>unclosed Macros.
Sounds like the source has had lines either truncated or worse
missing. Ran into some code like that once and it turned out the
source was missing a line every 2000 chars or so rendering it
unuseable.
>Has anyone got a program that will check or indicate the nesting of
>IF's and
>Macros within a Z80 source program to check for proper balance.
>I remember having one once for checking "{" and "}" within a BDS "C"
>program and wondered
>if a simular program was available for checking Z80 source code.
>
>Anyone know of such a program ?????
>Thanks
>Old-Timer (John)
While it's a good programming project to have the computer do it.
However, I've found a well calibrated mark one eyeball and basic
counting skills are enough. Besides once you know that you still
have to fix it without breaking the code.
Allison
Damn! I already had a sort-of preprocessor program that I wrote
for conditional compilation of Clipper (summer87) source, and
just today reworked it to handle asm files. I guess you no
longer need it now :-(
Pete (another Old Timer!)
--
"We have not inherited the earth from our ancestors,
we have borrowed it from our descendants."
> The end result was one IF BANKED statement that had no matching ENDIF.
> I inserted the ENDIF where I thought it should belong and behold the
> program assembled. Now I just have a minor problem with the .PRINTX
> statements that display the code size and free space at the end of the
> assembly.
John, could you please tell me where you had to place this missing
directive so I can see if I had that fixed in a later (4.1) version a
few years ago? TIA.
Hal
> Pete:
> I found it very complicated to try a reason out a computer algorithum
> to check the IF-ENDIF matching. I started with one that was oriented
> toward a preprocessor in the "C" language. It used #if and #endif, but
> always searched for the # sign before the preprocessor statement. Even
> if I found there was a mismatch, it would have been very difficult to
> determine where the mismatch started and where the ENDIF statement
> should be inserted. I guess the human brain is better for looking at
> the code and deciding how thing should be.
John:
Even my prog won't do that, but it will report a misplaced ELSE
or ENDIF and a line number (and a missing ENDIF).
> Im interested in your program. Have you tested it on a complicated
> file? The ZCPR4 source program had over 6300 lines and scores of IF's
> and ENDIF's.
> Old-Timer (John)
I just downloaded the source to try it [I found z40esrc.lbr] and
ASMPP fell over in a big heap :-( It needs rather more work to
handle stuff like
IF WHEEL OR WDU OR WPASS OR WPREFIX OR WHLDIR
which like stuff appears all over the source files. I'll have a
go today at beefing it up -- watch this space... (Check the
article headers if you wanr to go to email.)
Pete