There are some bugs in the Hi-Tech C runtime library and here are fixes for
three which have caused me grief.

1.   memset()

     The Hi-Tech C implementation of memset() is seriously broken and is
     almost guaranteed to give trouble in any program which uses it.

     The implementation simply does not agree with the function declaration.

2.   bios()

     The Hi-Tech C bios() function did its work by indexing into the jump
     table at the start of the CP/M 2.2 BIOS.  On a banked CP/M 3.x this is
     totally unsupported and very dangerous.  This patch uses the sanctioned
     method of calling BIOS functions via BDOS function 50 on CP/M 3.x while
     still using the jump table on CP/M 2.2.

3.   bdos() and bdoshl()

     These should always have been identical because all versions of CP/M-80
     return from BDOS calls with B = H and A = L.  Furthermore, when an 8-bit
     result is delivered, B = H = 0.

     This patch removes the distinction between the two functions.  Either
     can be called and each will yield the same result as the other.

Applying the patches:

     c -c memset.c
     zas bdos.as
     zas bios.as
     libr d libc.lib bdoshl.obj
     libr r libc.lib bdos.obj bios.obj memset.obj

A modified libc.lib is supplied along with the source code for the patches.

Also included is a rebuilt libf.lib with trigonometric functions yielding
more accurate results than the released version.  See libf.txt for more
information.

Jon Saxton
tesseract@triton.vg
September 2012
