Documentation for CHKIF.PAS by J.Loke 87Sep07 One of the most annoying errors that can crop up in an assembly language program is the BALANCE error. This occurs when conditional assembly modules or macro statments are not bracketed properly. The assemblers I use only report that such an error has occured, but don't actually locate the error. I found that visual scanning of a program longer than 3000 lines was not very productive. Hence the program CHKIF, written in TURBO Pascal. This scanner processes .ASM, .Z80 or .PRN files, checking that IF-ELSE-ENDIF statements are matched properly. It also handles MACRO/REPT/IRP/IRPC-EXITM- ENDM pseudo-ops, and takes the multi-statement lines of ASM and MAC, etc. provided they are delimited with exclamation marks! Invoking CHKIF without parameters displays a short usage message: "Usage: CHKIF [-Q] -Q=Quiet" For example, to scan the file B:Z3CCP.PRN, you would type: A>CHKIF B:Z3CCP.PRN During scanning, lines with conditional or macro assembly pseudo-ops are displayed on the console. If this chews up the paper on your teletype, use the -Q option to turn off all output except the summary at the end. Errors detected by CHKIF *ENDIF: No matching IF ENDIF detected before IF *IF: Too many IF's Most assemblers handle nesting to 8 levels. CHKIF will report errors above level 8, but can manage 16 levels of nesting in case you really goofed and forgot all your ENDIF's! *ELSE: Missing IF ELSE detected before IF *ELSE: Missing ENDIF IF-ELSE-ELSE construct attempted. Tsk, Tsk! *MACRO: Too many MACRO's Macro nesting beyond level 8. Again CHKIF will handle up to 16 levels before crashing. *EXITM: Missing MACRO EXITM detected before any MACRO pseudo-op *ENDM: Missing MACRO ENDM detected before any MACRO pseudo-op CHKIF: Missing ENDIF. These reports the state of the IF/ELSE/ENDIF Unmatched IF at line ##### stack. The lines reported will help you Unmatched ELSE at line ##### track down that error. CHKIF: Missing ENDM. Similarly, this reports the state of the Unmatched MACRO at line ##### MACRO stack. Disclaimer CHKIF is provided for non-commercial distribution distribution as is. Direct any enquiries to me via EASTWOOD RCP/M Melbourne Australia (03)8704623. End of Documentation