<< Previous Message Main Index Next Message >>
<< Previous Message in Thread This Month Next Message in Thread >>
Date   : Tue, 16 Nov 1982 19:10:19-PST (Tue)
From   : UCBARPA.dag@Ucb-C70 (David Allen Gewirtz)
Subject: CHDIR, NOCLR, and BDS C 1.5

       I have uploaded the file CPM;NOCLR C to MC.

NOCLR contains a function called noclrex() which is used
to perform a hack on programs like CHDIR, when compiled with
version 1.50 of the BDS C Compiler.  IT appears that Leor's
newest version has the runtime system (C.CCC) clear out the
external data area before actually executing the compiled
program.  

Now this is all well and good for nearly all of the programs
written.  One program that does not work well when the externals
are initialized is Rick Conn's CHDIR.C program.  What CHDIR does
is create directory names and place them in tables that are
external variables to the compiler.  When the user is done entering
names, CHDIR writes itself back out to disk, including the external
data, so that the next time it runs, it is already initialized.

The problem is that when a compiled program is run, before any
of the user-written code is executed, it performs a number of
initializations, including clearing external data.

NOCLR is used to cause the run-time package to skip the stage
where it clears the external data by poking a jump instruction
into memory.  When CHDIR is executed initially, the external
data is cleared.  The, when noclrex() is called, a jump instruction
is used to bypass the segment that clears the externals.  Finally,
when the program is written out with changes, this bypass is left
in so the externals won't be cleared the next time through.

Because some people do not like to have their programs hacked up
and because this only affects those using version 1.5 of the 
compiler, I have not made any changes to CHDIR.C.  SHould
you need to bypass the phase that clears externals, simply
poke a JMP XXXX into the runtime space or use NOCLR.C.
A call of noclrex() early on in the program (any time before
write-out) will solve the problem.

If, for some reason, it doesn't work, check the addresses in NOCLR
and C.CCC.  My version of C.CCC comes from a pre-release version
of BDS C 1.5 and may not be the same as yours.

Finally, I would appreciate it if someone would move NOCLR to
a proper archive directory.

Enjoy,.
David
<< Previous Message Main Index Next Message >>
<< Previous Message in Thread This Month Next Message in Thread >>