I added a relevant test, to show that this new library can be used in all C programs.
I choose a simple program, designed to build a .as source file starting from a .sym file.
Instead using only the functions provided by the standard HiTech C library, we will use also specific functions provided by the new allocation package.
The particular C library function important in our test is 'sbrk'. It allocates a buffer in the heap.
It is used by all file related system functions to allocate a 512 buffer, to be used by disk I/O operations.
So, we will include the new '
myalloc.as' in the C command line, to "force" the linker to use the new 'sbrk', instead of the 'sbrk' from CLIB.LIB
D>
Let's verify that the new 'sbrk' is used, and NOT the 'old sbrk' from CLIB.LIB :
D>type t.map
Machine type is Z80
CRTCPM.OBJ text 0 13D data 24DE 1
T.OBJ text 13D 1C4 data 24DF 9A
bss 27B3 6B
MYALLOC.OBJ text 301 418
...
Symbol Table
__Hbss bss 2A29 __Hdata data 27B3 __Htext text 24DE
__Lbss bss 27B3 __Ldata data 24DE __Ltext text 0000
...
_sbrk text 0336 _setfcb text 1C8E _setuid text 1FAC
...
D>
As you noticed, in the list of symbols, sbrk = 0336H, which is inside myalloc.obj address space.
Therefore, the 'new' sbrk will be used.
Let's give it a try...
D>t
t.as t.sym
D>type
t.asGLOBAL _myrealloc
_myrealloc EQU 0051EH
GLOBAL __cpm_clean
__cpm_clean EQU 01FF2H
GLOBAL _total_free
_total_free EQU 00320H
GLOBAL _i
_i EQU 02818H
...
It works OK.
Therefore, the new alloc library can be safely used by C programs.
Ladislau