C

Everything about programming, including VDP and Sound programming.
Post Reply
User avatar
Dave
Posts: 623
Joined: 11 Aug 2012 18:16
Contact:

C

Post by Dave » 20 May 2017 18:30

Hi Folks,

I am looking for a C compiler for MTX/FDX/SDX, at the moment, I have Small C running natively under CP/M. As you can imagine, programming on the MTX is a bit of a chore these days, but Small C works well enough under MEMU, so I can edit on my laptop, but am still stuck with using the likes of NewWord as the editor.

What I would like to have is cross compiler that I can use on the PC that would compile to Z80 code that I can just copy the executable over onto MEMU, and ultimately, or a real MTX. As a minimum, the compiler should have libraries that support CP/M, but MTX specific libraries for sound and graphics would be a bonus.

At Memofest 2015, Andy was playing with SDCC and had written some assembler libraries for sound and VDP (they don’t seem to be on Andy's website though?). I was wondering whether Andy had found (or written) a library that allowed SDCC to compile for CP/M 2.2 that I can generate programs for FDX/SDX?

Similarly, I know that Paul was developing with Z88DK, but I'm not sure whether he was doing anything with CP/M - Paul?

So, any suggestions folks?

Regards
Dave

ps - Andy, I sent you an email directly on this question, but it probably is a topic for the forum, hence this post

Bill B
Posts: 132
Joined: 26 Jan 2014 16:31

Re: C

Post by Bill B » 20 May 2017 22:04

Dave,

If you are running small C in MEMU, why not edit your programs using your preferred Windows editor, and then use MEMU and Small C to compile the code, in a similar way to Andy's site shows for Z80 assembler, i.e.:

memu -mon-console -fast cc.com ...

That should give you CP/M executables.

Compiling something to run in MTX native mode is a different order of problem. It requires a C run-time library which calls the relevant MTX ROM entry points instead of CP/M BDOS/BIOS, and a linker which will locate the executable at the appropriate address.

User avatar
Dave
Posts: 623
Joined: 11 Aug 2012 18:16
Contact:

Re: C

Post by Dave » 20 May 2017 22:33

Hi Bill,

thanks a lot for the pointer - no pun intended :-)

I had missed that, that's a good way of editing, then compiling.

Incidentally, I've now dug out a copy of Aztec C - so even better

regards
Dave

User avatar
thewiz
Posts: 116
Joined: 12 Aug 2012 16:08

Re: C

Post by thewiz » 22 May 2017 10:29

Hi Dave,

It's been a while since I looked at z88dk. Some of the compiles worked, some didn't and some corrupted while running. I think the problem was due to the stack being set to 0000 on start which corrupted the interrupt table and sys vars etc.

I prefer assembler so haven't looked at it for some time.

I've been quiet recently as I've been writing a game using the next version of my MTX Assembler Shell. Its based on an arcade game circa 1979.

ttfn
THIS is what Memotech is doing now.

User avatar
Crazyboss
Site Admin
Posts: 220
Joined: 09 Aug 2012 21:45
Location: Sweden
Contact:

Re: C

Post by Crazyboss » 26 May 2017 11:59

I think the SDCC must be the best one, since the other compilers are quite old.
SDCC have been used for many games on the Colecovision. And Its still the prefered compiler there.

Myself I did never learned C, I prefer to use Basic or Pascal. But I think in some way it better to try to do some C.
//CLAUS - Webmaster at www.mtxworld.dk

Post Reply