Author Topic: MESCC / Mike's Enhanced Small C Compiler for CP/M  (Read 3714 times)

0 Members and 1 Guest are viewing this topic.

Offline FloppySoftware

  • CPC6128
  • ****
  • Posts: 243
  • Country: es
  • The best team: Amstrad PCW, CP/M, and the Z80 cpu.
    • Floppy Software
  • Liked: 234
  • Likes Given: 171
Hi all!
 
I've just uploaded to my website a new release of MESCC (v1.07).

MESCC is my project of a C compiler for the CP/M operating system and the Z80 cpu.
 
As it is written in MESCC, can compile itself.
 
MESCC generate Z80 assembler code that can be assembled with ZSM/Z80ASMUK (also included), in order to generate an HEX file.
 
The HEX file can be converted to an executable COM file with LOAD or HEXCOM (both supplied with CP/M) or HEXTOBIN or HEXTOCOM (both included with MESCC).
 
Also, an optimizer is included.
 
It is supplied with a bunch of libraries and examples: mescc.h, alloc.h, clock.h, conio.h, cpm.h, ctype.h, fileio.h, fprintf.h, mem.h, printf.h, rand.h, setjmp.h, sprintf.h, string.h, xprintf.h and z80.h.
 
I use it for (nearly) all my software projects.
 
It is released under the GNU GPL license, and you can download it in binary and source code form, from my website.
 
floppysoftware.es < NEW URL!!!
cpm-connections.blogspot.com.es

Offline TFM

  • Visit the mysteries of the CPC at www.futureos.de
  • Supporter
  • 6128 Plus
  • *
  • Posts: 9.899
  • Country: aq
  • Space Chicken for FutureOS is free!
    • index.php?action=treasury
    • FutureOS - The revolution on CPC!
  • Liked: 1983
  • Likes Given: 4650
Re: MESCC / Mike's Enhanced Small C Compiler for CP/M
« Reply #1 on: 02:51, 31 August 15 »
Very interesting!  :)  Does it compare to ANSI C or to Small-C?


And.... is there some documentation about its commands?

TFM of FutureSoft
Also visit the CPC and Plus users favorite OS: FutureOS - The Revolution on CPC6128 and 6128Plus

Offline FloppySoftware

  • CPC6128
  • ****
  • Posts: 243
  • Country: es
  • The best team: Amstrad PCW, CP/M, and the Z80 cpu.
    • Floppy Software
  • Liked: 234
  • Likes Given: 171
Re: MESCC / Mike's Enhanced Small C Compiler for CP/M
« Reply #2 on: 17:34, 31 August 15 »
Very interesting!  :)  Does it compare to ANSI C or to Small-C?


And.... is there some documentation about its commands?
Small-C, not ANSI C.  :o
The documentation is on the ZIP distribution file.  8)
 
floppysoftware.es < NEW URL!!!
cpm-connections.blogspot.com.es

Offline TFM

  • Visit the mysteries of the CPC at www.futureos.de
  • Supporter
  • 6128 Plus
  • *
  • Posts: 9.899
  • Country: aq
  • Space Chicken for FutureOS is free!
    • index.php?action=treasury
    • FutureOS - The revolution on CPC!
  • Liked: 1983
  • Likes Given: 4650
Re: MESCC / Mike's Enhanced Small C Compiler for CP/M
« Reply #3 on: 20:49, 31 August 15 »
Small-C, not ANSI C.  :o
The documentation is on the ZIP distribution file.  8)


That's nice! So I will give it a try and see in my FIOLIB for FutureOS works with it!  :) :) :)
TFM of FutureSoft
Also visit the CPC and Plus users favorite OS: FutureOS - The Revolution on CPC6128 and 6128Plus

Offline GeoffB17

  • 6128 Plus
  • ******
  • Posts: 753
  • Country: gb
  • PCW since '85
  • Liked: 160
  • Likes Given: 8
Re: MESCC / Mike's Enhanced Small C Compiler for CP/M
« Reply #4 on: 21:03, 31 August 15 »
Hmm, I wonder at what point an 'enhanced' 'small' C becomes equivalent to a 'standard' (ansi ?) C?   Maybe all somewhat academic, as long as the system covers the areas you need.   Always a problem if the system is too big, and clutters up with a lot of excess complications.
 
Not long after I got my PCW, I got the HiSoft C package, which seemed OK at the time, but I soon felt that it's single process (source code ---> .com) was not ideal.   There were some other options, and I got a copy of Eco-C, which seemed far more of a standard system (ansi ?), and also had a similar process to that described for MESCC, i.e. the initial compile generated an ASM file (which could then be edited/manipulated/studied/learned from), and a subsequent process generated the REL file and then the .com (assembler and linker).   The system seemed to be quite good, and clearly it was a help having printed manuals (I am always comfortable with them) and it was useful that the Eco-C system specifically referred to a published book for reference (said book I already had).  Book prob long out of print?  C Programming Guide by Purdum, Que Publishing, 1983.
 
I still have the Hisoft system, and this is on a disk that is readable, so I could still use it.   I've got a problem with the Eco-C!   I did have the system on a 5.25" floppy, so it SHOULD have been readable, but when I tried to read the disk I got a grating/crunching noise, and found that the floppy was disintegrating in the drive.   Had to go into the drive and clean the heads before it would work again!   I still have the original master disks, but one is an 8" disk (why ??? ) and then a pair of 3" disks specially prep for the PCW.   I may get around to getting the 3" disks converted (my 3" drive is dead), however I've downloaded Eco-C from the web although it's a slightly earlier version, so I may try to get it running again?
 
As an aside, the 'dud' floppy was a Wabash, supposed to be a 'good' US Mfg.   When I checked up on the web, I found other references to people having EXACTLY the same problem with Wabash disks, where the head rips the magnetic coating off and leaves a transparent track!!   All my cheap/nasty floppies are working fine!!   The Wabash ones were only a few years older (from '84).
 
Don't know if the XPCW stuff would work with the other compilers, prob should.   Have to look at the compile processes and see.
 
Best wishes to fellow C programmers..
 
Geoff

Offline FloppySoftware

  • CPC6128
  • ****
  • Posts: 243
  • Country: es
  • The best team: Amstrad PCW, CP/M, and the Z80 cpu.
    • Floppy Software
  • Liked: 234
  • Likes Given: 171
Re: MESCC / Mike's Enhanced Small C Compiler for CP/M
« Reply #5 on: 21:58, 31 August 15 »

That's nice! So I will give it a try and see in my FIOLIB for FutureOS works with it!  :) :) :)

I had a look to your FIOLIB disk, and I don't see any special problem to change to MESCC, but you should have in mind some things:
 
- MESCC doesn't uses ZMAC, but ZSM (alias Z80ASMUK).
- MESCC is a CP/M native compiler (but the code that generates is plain Z80 assembler, not CP/M dependent).
- MESCC libraries are CP/M oriented (but some are really no CP/M dependent, an the others can be easily modified,
   including mescc.h, the CP/M runtime).
- Sorry, no floats.
 
What's the Small-C version used with FIOLIB?
 
 
 
 
floppysoftware.es < NEW URL!!!
cpm-connections.blogspot.com.es

Offline FloppySoftware

  • CPC6128
  • ****
  • Posts: 243
  • Country: es
  • The best team: Amstrad PCW, CP/M, and the Z80 cpu.
    • Floppy Software
  • Liked: 234
  • Likes Given: 171
Re: MESCC / Mike's Enhanced Small C Compiler for CP/M
« Reply #6 on: 22:11, 31 August 15 »
Hmm, I wonder at what point an 'enhanced' 'small' C becomes equivalent to a 'standard' (ansi ?) C?   Maybe all somewhat academic, as long as the system covers the areas you need.   Always a problem if the system is too big, and clutters up with a lot of excess complications.
 
Not long after I got my PCW, I got the HiSoft C package, which seemed OK at the time, but I soon felt that it's single process (source code ---> .com) was not ideal.   There were some other options, and I got a copy of Eco-C, which seemed far more of a standard system (ansi ?), and also had a similar process to that described for MESCC, i.e. the initial compile generated an ASM file (which could then be edited/manipulated/studied/learned from), and a subsequent process generated the REL file and then the .com (assembler and linker).   The system seemed to be quite good, and clearly it was a help having printed manuals (I am always comfortable with them) and it was useful that the Eco-C system specifically referred to a published book for reference (said book I already had).  Book prob long out of print?  C Programming Guide by Purdum, Que Publishing, 1983.
 
I still have the Hisoft system, and this is on a disk that is readable, so I could still use it.   I've got a problem with the Eco-C!   I did have the system on a 5.25" floppy, so it SHOULD have been readable, but when I tried to read the disk I got a grating/crunching noise, and found that the floppy was disintegrating in the drive.   Had to go into the drive and clean the heads before it would work again!   I still have the original master disks, but one is an 8" disk (why ??? ) and then a pair of 3" disks specially prep for the PCW.   I may get around to getting the 3" disks converted (my 3" drive is dead), however I've downloaded Eco-C from the web although it's a slightly earlier version, so I may try to get it running again?
 
As an aside, the 'dud' floppy was a Wabash, supposed to be a 'good' US Mfg.   When I checked up on the web, I found other references to people having EXACTLY the same problem with Wabash disks, where the head rips the magnetic coating off and leaves a transparent track!!   All my cheap/nasty floppies are working fine!!   The Wabash ones were only a few years older (from '84).
 
Don't know if the XPCW stuff would work with the other compilers, prob should.   Have to look at the compile processes and see.
 
Best wishes to fellow C programmers..
 
Geoff

Do you have this Eco-C version?
 
http://www.z80.eu/downloads/ECO-C343.zip
 
Regarding ANSI / K&R / Small-C subject, I use MESCC for all my C projects, mainly because is good for me: I have the source code, I know the source code, I can enhance / debug it, and it's CP/M native.
 
I love it.  :)
floppysoftware.es < NEW URL!!!
cpm-connections.blogspot.com.es

Offline TFM

  • Visit the mysteries of the CPC at www.futureos.de
  • Supporter
  • 6128 Plus
  • *
  • Posts: 9.899
  • Country: aq
  • Space Chicken for FutureOS is free!
    • index.php?action=treasury
    • FutureOS - The revolution on CPC!
  • Liked: 1983
  • Likes Given: 4650
Re: MESCC / Mike's Enhanced Small C Compiler for CP/M
« Reply #7 on: 22:21, 31 August 15 »
Dunno... it's just called Small C. It's all on the disc (IIRC). Thanks's! I will have to take a deeper look into it.  :)
TFM of FutureSoft
Also visit the CPC and Plus users favorite OS: FutureOS - The Revolution on CPC6128 and 6128Plus

Offline GeoffB17

  • 6128 Plus
  • ******
  • Posts: 753
  • Country: gb
  • PCW since '85
  • Liked: 160
  • Likes Given: 8
Re: MESCC / Mike's Enhanced Small C Compiler for CP/M
« Reply #8 on: 22:39, 31 August 15 »
REgarding the Eco-C - YES, the link you show IS the one I've just downloaded.   This is v 3.43.   The one I have/had is v 3.47.   I've compared the files, much is very similar, just that my version came with a different compile/link process, the earlier version used MS M80 and L80.   But I've also found the SL process as a separate download, so I could just about reconstruct 3.47??

And ABSOLUTELY YES, I fully accept your point, and I would agree entirely.   Using any such system - whatever language - is MASSIVELY about familiarity.   Once you've invested your time in a partic system, as you clearly HAVE done with your MESCC, why on earth go to something else unless it offers something dramatic extra that you just CANNOT do with the existing system.    C is always extensible anyway, you can achieve a lot just by extending the system, which clearly you are doing already.

Could say a LOT more relating to my development work regarding C, Clipper, etc in the PC environment, but not relevant to CPC forum!

Geoff

Data-Sage

Offline AMSDOS

  • Supporter
  • 6128 Plus
  • *
  • Posts: 3.919
  • Country: au
    • index.php?action=treasury
    • Programs for Turbo Pascal 3
  • Liked: 1132
  • Likes Given: 1902
Re: MESCC / Mike's Enhanced Small C Compiler for CP/M
« Reply #9 on: 00:13, 06 September 15 »
Dunno... it's just called Small C. It's all on the disc (IIRC). Thanks's! I will have to take a deeper look into it.  :)


Think it was Ron Cain's original that came from Dr Dobbs Journal.


Eco-C is a fairly complete implementation of standard C sold commercially for $350 (according to my source).
* Using the old Amstrad Languages :D   * with the Firmware :P
* I also like to problem solve code in BASIC :)   * And type-in Type-Ins! :D

Home Computing Weekly Programs
Popular Computing Weekly Programs
Your Computer Programs
Updated Other Program Links on Profile Page (Update April 16/15 phew!)
Programs for Turbo Pascal 3

Offline GeoffB17

  • 6128 Plus
  • ******
  • Posts: 753
  • Country: gb
  • PCW since '85
  • Liked: 160
  • Likes Given: 8
Re: MESCC / Mike's Enhanced Small C Compiler for CP/M
« Reply #10 on: 01:03, 06 September 15 »
Hello,
 
Regarding Eco-C - I'm pretty sure I didn't pay anything like $350.   Maybe some time before, when it was a fully commercial product, it may have been that, but I got it at a time when a lot of packages were being sold for PCW users, and somewhat lower prices.   DR released a few things, like DR-Draw, and C-BASIC.
 
I got the Hisoft product, and it was OK, but as noted in an earlier message, it was a one operation compile and I was more interested in getting inside the process.   The Eco-C system required 3 'commands'.   The first ran 3 or 4 stages and produced a .MAC (assemply language listing) file (which could in effect be inspected, and modified by hand if required).   Stage 2 used an assembler to produce the .REL file, the third stage used the linker to generate the .COM.
 
I've just run through some things, and I noted that Eco-C took quite some time, but I found the setting to use M: for temp files and this improved things.   Certainly, Hisoft was faster overall.
 
I understand that Hisoft is more K&R standard, while Eco-C is more ansi.
 
I needed a little prog, to in effect replicate the DOS 'cls' command.
 
I wrote a little prog using C-BASIC.  Pretty much a 1 line prog.   C-BASIC produced a 157F .COM file pretty quickly.   I then wrote a C prog, which had a few more lines but was essentially the same, just printing the ESC codes for clear screen.   First I created a prog using Hisoft, this was a bit slower to produce than C-BASIC, but needed just one command.   The .COM file was 1278 bytes (hex) so was a little smaller than the CB prog.   Both versions took up 6k on the floppy (3 @ 2k blocks).
 
Then I tried the same prog using Eco-C.   This took far longer to complete, even using the RAM disk, however the completed .COM file was 2k (i.e. 1 @ 2k block), actual byte count 05FF bytes.   Actual byte counts determined using the DUMP.COM prog.
 
The Hisoft package (marketed somewhat towards Amstrad machines) does include facilities for using GSX, incl details in the manual for doing this.   Eco-C does not know about GSX, you'd have to work this out for yourself.
 
Geoff

Offline AMSDOS

  • Supporter
  • 6128 Plus
  • *
  • Posts: 3.919
  • Country: au
    • index.php?action=treasury
    • Programs for Turbo Pascal 3
  • Liked: 1132
  • Likes Given: 1902
Re: MESCC / Mike's Enhanced Small C Compiler for CP/M
« Reply #11 on: 01:22, 06 September 15 »
The price I have for Eco-C comes from Ecosoft, which were based in Indianapolis and the book is dated from 1985, so by the time you got the product, it probably came down in price, or a good exchange rate between £ and $. There was also competition from other CP/M-80 based C Compilers, Eco-C wasn't the most expensive though, Whitesmith's C for example was sold for $750, but then you've got Aztec C, BDS C which sold for under $200 and offered decent implementations of C for a reasonable price.
* Using the old Amstrad Languages :D   * with the Firmware :P
* I also like to problem solve code in BASIC :)   * And type-in Type-Ins! :D

Home Computing Weekly Programs
Popular Computing Weekly Programs
Your Computer Programs
Updated Other Program Links on Profile Page (Update April 16/15 phew!)
Programs for Turbo Pascal 3

Offline GeoffB17

  • 6128 Plus
  • ******
  • Posts: 753
  • Country: gb
  • PCW since '85
  • Liked: 160
  • Likes Given: 8
Re: MESCC / Mike's Enhanced Small C Compiler for CP/M
« Reply #12 on: 15:06, 06 September 15 »
Hello,
 
Re the Eco-C.   Just for historical interest.
 
I found an advert back about the date mentioned, and yes, it said $350.   Also said $40 for the manual, but maybe that was for separate if you didn't get the complete package.
 
Anyway, I checked re my purchase.   I had noted that I received the package from Grey Matter in the UK on 29th Dec 1986.   Found my credit card statment for Jan 1987, that shows £57.50, incl p&p.   According to other research, the exchange rate was about $1.50 to the £ back then, so I paid about $80 (excl something for p&p).   That's about 20/25% of the official (pre-Amstrad) price!!   I wonder how many copies they sold into the amstrad market??
 
Of course, you can download it for free now!!
 
Geoff

Offline AMSDOS

  • Supporter
  • 6128 Plus
  • *
  • Posts: 3.919
  • Country: au
    • index.php?action=treasury
    • Programs for Turbo Pascal 3
  • Liked: 1132
  • Likes Given: 1902
Re: MESCC / Mike's Enhanced Small C Compiler for CP/M
« Reply #13 on: 12:06, 09 September 15 »
Hello,
 
Re the Eco-C.   Just for historical interest.
 
I found an advert back about the date mentioned, and yes, it said $350.   Also said $40 for the manual, but maybe that was for separate if you didn't get the complete package.
 
Anyway, I checked re my purchase.   I had noted that I received the package from Grey Matter in the UK on 29th Dec 1986.   Found my credit card statment for Jan 1987, that shows £57.50, incl p&p.   According to other research, the exchange rate was about $1.50 to the £ back then, so I paid about $80 (excl something for p&p).   That's about 20/25% of the official (pre-Amstrad) price!!   I wonder how many copies they sold into the amstrad market??
 
Of course, you can download it for free now!!
 
Geoff


Out of curiosity, was that distributed on 3" Disc? That would suggest there was an UK distributer if that was the case.
* Using the old Amstrad Languages :D   * with the Firmware :P
* I also like to problem solve code in BASIC :)   * And type-in Type-Ins! :D

Home Computing Weekly Programs
Popular Computing Weekly Programs
Your Computer Programs
Updated Other Program Links on Profile Page (Update April 16/15 phew!)
Programs for Turbo Pascal 3

Offline GeoffB17

  • 6128 Plus
  • ******
  • Posts: 753
  • Country: gb
  • PCW since '85
  • Liked: 160
  • Likes Given: 8
Re: MESCC / Mike's Enhanced Small C Compiler for CP/M
« Reply #14 on: 13:33, 09 September 15 »
Yes.
 
As noted in message, I bought the package from Grey Matter, who (back then ?) were a major UK distrib of software, mainly for businesses.   They produced a quite substantial catalogue, small print.   I don't see any mention of them nowadays, maybe went out of business.
 
Package included the original 8" EcoSoft master disk, with Reg ###, 2 3" Amstrad disks with (I assume) all the software from the 8" disk transferred, the pretty solid (heavy duty ring binder, boxed) manual, although not THAT much in the manual itself.   Maybe Grey Matter had done a deal with EcoSoft, to get the good price??   Is that what you're wondering??
 
Geoff

Offline AMSDOS

  • Supporter
  • 6128 Plus
  • *
  • Posts: 3.919
  • Country: au
    • index.php?action=treasury
    • Programs for Turbo Pascal 3
  • Liked: 1132
  • Likes Given: 1902
Re: MESCC / Mike's Enhanced Small C Compiler for CP/M
« Reply #15 on: 01:23, 10 September 15 »
Yes I thought perhaps the UK distributor brought out a bulk load of it, though the price of Eco-C probably came down from competing C compilers as well.
* Using the old Amstrad Languages :D   * with the Firmware :P
* I also like to problem solve code in BASIC :)   * And type-in Type-Ins! :D

Home Computing Weekly Programs
Popular Computing Weekly Programs
Your Computer Programs
Updated Other Program Links on Profile Page (Update April 16/15 phew!)
Programs for Turbo Pascal 3

Offline FloppySoftware

  • CPC6128
  • ****
  • Posts: 243
  • Country: es
  • The best team: Amstrad PCW, CP/M, and the Z80 cpu.
    • Floppy Software
  • Liked: 234
  • Likes Given: 171
Re: MESCC / Mike's Enhanced Small C Compiler for CP/M
« Reply #16 on: 19:36, 28 January 16 »
I don't pay too much attention to this kind of data, but as it seems important to other people, I would like to post here some timings about MESCC.
 
The following timings have been obtained from a compilation of TE (my small text editor) in CP/M Box (a very accurate PCW emulator for Windows). They have been taken with CP/M Plus DATE program.
 
They include loading time for programs from floppy disk and the time needed for DATE commands (I don't care, really).
 

* te2.png
(10.67 kB, 752x544 - viewed 218 times)

* te3.png
(12.26 kB, 752x544 - viewed 290 times)
[ Invalid Attachment ]
 
Starting time for programs follows:
 
Code: [Select]
hh:mm:ss event
-------- ------------
00:01:33 cc te
00:08:56 ccopt te
05:17:48 zsm te
05:26:39 hextocom te
05:27:40
Measured times for programs follows:
 
Code: [Select]
cc       Compiler  v1.10   00:07:23
ccopt    Optimizer v2.01   05:08:52
zsm      Assembler v2.8    00:08:51
hextocom Loader    v1.05   00:01:01

Some notes follows:
Code: [Select]
Main source code file is 30 Kb in size, but it uses some headers, etc.
 
In MESCC every code has to be compiled with every program, due to lack of relocatable support in ZSM.
 
This include standard libraries.
 
Generated assembler code file is 96 Kb in size, and it has 9127 lines.
 
The optimizer is new, it has been written from scratch, and substitutes the old ccopt.
 
It is slower than the older optimizer, but it is better in optimization results, and more maintainable.
 
It was able to reduce the TE size in 1477 bytes.
 
It is a work in progress yet.
 
There are 97 optimization rules.
 
Use of M: ram drive would give better results for sure.

 
« Last Edit: 19:38, 28 January 16 by FloppySoftware »
floppysoftware.es < NEW URL!!!
cpm-connections.blogspot.com.es

Offline FloppySoftware

  • CPC6128
  • ****
  • Posts: 243
  • Country: es
  • The best team: Amstrad PCW, CP/M, and the Z80 cpu.
    • Floppy Software
  • Liked: 234
  • Likes Given: 171
Re: MESCC / Mike's Enhanced Small C Compiler for CP/M
« Reply #17 on: 23:40, 04 April 16 »
Hi all,
 
I have just updated MESCC to v1.11.
 
Regards.
floppysoftware.es < NEW URL!!!
cpm-connections.blogspot.com.es