0:A:LINQ -Z -Ptext=0,data,bss -C100H -
OTESTAND.COM 0:A:CRTCPM.OBJ TESTAND.OBJ 0:A:LIBC.LIB
(on my system I have an ENVIRON file on the A: drive in user 0 that sets TMP to use drive M: - my ramdisk, so the output you see may be slightly different). For the above program run, I typed '123' and pressed the enter key. You can
see it has echoed the wrong variable by outputting the 0.
To get a listing you can stop the compilation after the code generation phase, use the -S switch
C>c -s test.c
A:C COM
Hi-Tech C Compiler (CP/M-80) V3.09-9
Copyright (C) 1984-87 HI-TECH SOFTWARE
C>
Now you can assemble using ZAS and specify a listing file
A:ZAS COM
C>
I won't include the listing TEST.PRN file output here for brevity.
Now link it together with the library routines and get a symbol file using the -d switch
(here I'm using the interactive prompting mode of the HI-TECH linker with line
continuation) -
C>linq
A:LINQ COM
link> -d -Z -Ptext=0,data,bss -C100H -Otest.com \
link> 0:a:crtcpm.obj test.obj 0:a:libc.lib
C>
Now run the debugger (the symbol file is L.SYM)
A:DEBUG COM
HI-TECH C DEBUGGER (Z80)
Copyright (C) 1984, 1986 HI-TECH SOFTWARE
:
I won't go through the debugging details here - instead refer to the debugger documentation
(which has this very same example) in
It shows you how to patch the incorrect reference to the variable j.
I hope this gives you a better idea.
Tony