Hi,
the Cowgol development environment evolved...
Now, it's possible to mix Cowgol, C and assembler source files to build a CP/M executable.
The Cowgol command line accepts now also C files to be compiled, besides Cowgol files and assembler files.
Example:
( -lc means LIBC.LIB will be added in the final LINK command line)
cowgol -lc msort.cow merges.c rand.as
COWGOL COMPILER (CP/M-80) V2.0
Copyright (C) David Given
MSORT.COW
0:COWFE MSORT.COW $CTMP1.$$$
COWFE: 18kB free
> MSORT.COW
done: 16kB free
0:COWBE $CTMP1.$$$ MSORT.COO
COWBE: 22kB free
__main
print_char
print
UIToA
print_i16
random
done: 20kB free
MERGES.C
0:CPP -DCPM -DHI_TECH_C -Dz80 -I MERGES.C $CTMP1.$$$
0:P1 $CTMP1.$$$ $CTMP2.$$$ $CTMP3.$$$
0:CGEN $CTMP2.$$$ $CTMP1.$$$
0:OPTIM $CTMP1.$$$ $CTMP2.$$$
0:Z80AS -J -N -oMERGES.OBJ $CTMP2.$$$
Z80AS Macro-Assembler V4.8
Errors: 0
Jump optimizations done: 6
Finished.
RAND.AS
0:Z80AS -J -ORAND.OBJ RAND.AS
Z80AS Macro-Assembler V4.8
Errors: 0
Finished.
ERA $CTMP1.$$$
ERA $CTMP2.$$$
0:COWLINK COWGOL.COO MSORT.COO -o $CTMP1.$$$
COWLINK: 46kB free
Adding input file: COWGOL.COO
Adding input file: MSORT.COO
Analysing...
Workspace sizes:
#0: 2040 bytes
#1: 0 bytes
#2: 0 bytes
#3: 0 bytes
Creating output file: $CTMP1.$$$
Copying from input file: COWGOL.COO
Copying from input file: MSORT.COO
done: 42kB free
ERA MSORT.COO
0:COWFIX $CTMP1.$$$ $CTMP2.$$$
0:Z80AS -J -N -O$CTMP1.$$$ $CTMP2.$$$
Z80AS Macro-Assembler V4.8
Errors: 0
Jump optimizations done: 18
Finished.
0:LINK -Z -Ptext=100H,data,bss -C100H -OMSORT.COM $CTMP1.$$$ MERGES.OBJ RAND.OBJ LIBC.LIB
ERA $CTMP1.$$$
ERA $CTMP2.$$$
ERA $$EXEC.$$$
msort
Unsorted array: 9354,7162,28553,30556,10608,10552,5922,26465,7626,3830,31116,27859,21585,5103,14685,406,14835,21267,25790,22755,24183,8389,26148,10846,6428,23,6546,27322,22241,21618,10564,2561,20164,32466,3737,31288,27915,6143,25355,24248,31737,15674,2602,14885,6577,
20497,26045,6944,28261,22411,20546,19258,18193,14838,21911,18008,18221,21637,22606,20017,3290,3050,11221,13429,31986,13744,11206,27298,1215,2386,25154,8291,31467,9004,822,25210,18965,13813,23826,27704,28672,18488,17938,31285,25989,12566,29003,13793,1603,
30672,16607,9992,14873,13442,3576,29056,27096,8090,8691,18207,29627,556,12838,5942,31856,22034,8829,12211,15944,7941,5771,12642,25186,6219,26837,5652,18010,17455,5574,19389,25207,17051,4892,20306,1889,3514,722,3303,26392,17965,21893,6414,24385,510,163
...
Sorted array: 23,43,63,136,139,141,214,219,222,326,384,406,430,508,510,510,556,606,722,727,822,838,844,861,959,988,991,1009,1027,1051,1057,1083,1115,1131,1153,1215,1230,1239,1390,1405,1415,1418,1447,1488,1522,1592,1603,1681,1696,1706,1717,1733,1738,1792,1819,1889,1921,
2052,2074,2085,2137,2151,2152,2234,2297,2317,2326,2350,2360,2386,2413,2481,2488,2496,2498,2530,2536,2545,2561,2602,2651,2659,2673,2683,2752,2783,2799,2803,2807,2817,2851,2862,2987,3050,3169,3262,3290,3296,3303,3327,3330,3396,3409,3428,3449,3512,3514,3535,
3566,3576,3693,3713,3737,3763,3781,3830,3834,3883,3886,
... ,25047,25064,25166,25435,508,510,844,1230,1592,2085,2326,2413,2783,2987,4925,5308,5701,5710,5864,5957,6149,6450,6700,6724,7018,7362,7547,8216,8343,25708,25739,25880,26067,26218,26544,26924,26989,27218,27406,27441,27667,27853,28139,28533,28586,28717,28723,
29298,29416,29618,29679,30018,30887,30923,31323,31641,32513,32615,32619,32641,
The program sorts 1000 random integers.
The Cowgol "main" routine calls the assembler routines xrndseed and xrnd to populate a vector of 1000 integers, then calls a C routine that sorts the vector; the texts are printed using Cowgol routines. The C routine calls another (reentrant) C routine
to do the "merge sorting".
See the actual source files here:
https://github.com/Laci1953/Cowgol_on_CP_M/tree/main/Examples
Ladislau
--- SoupGate-Win32 v1.05
* Origin: fsxNet Usenet Gateway (21:1/5)