New Hitech C Z80 compiler for Windows/Linux?

Page 2/3
1 | | 3

By Roland007

Expert (80)

Roland007's picture

21-03-2018, 20:58

A new MSX-C compiler would be nice. The libraries ASCII made are not something that should keep us back. Turbo Pascal has inline assembly that allows us to call every routine in the rom. Although I am not sure, I suppose ASCII libraries do exactly that: jump to rom.

But now reality check: who cares enough to put significant amounts of time in it? On MSX, both Pascal and C have been dead for a long time and now coding on MSX is a hobby where you learn to live with the bugs and limitations. Without these bugs and limitations, it wouldn't be a hobby or MSX development. Big smile

By DarkSchneider

Paladin (862)

DarkSchneider's picture

31-03-2018, 17:27

I'd like to develop for MSX without bugs and limitations from the tools perspective. The limitations would come from the system itself, that are the limitations I like. About tools, the more good the better.

About the ASCII libs, are a good starting point. Not only the own MSX-library for accesing the MSX features, but the ones to compile for DOS/DOS2 are included, and I think others like SDCC lacks them. Konamiman recently put the CRT0 for DOS.
https://www.konamiman.com/msx/msx-e.html#sdcc

The real solution would be SDCC as is the only one in development, but it goes so slow, and lacks so many things for MSX that should be ported.

For the MSX itself, a new MSX-C would be the best as there is already so much to use.

By PingPong

Prophet (3436)

PingPong's picture

31-03-2018, 19:24

DarkSchneider wrote:

The real solution would be SDCC as is the only one in development, but it goes so slow, and lacks so many things for MSX that should be ported.

I doubt that the quality of SDCC code is worst than the msx-c compiler. I also doubt that machine code is slower on sdcc
Instead i think that msx-c can sometime generate more fast code because does not support the modern ansi 'c' features.

By DarkSchneider

Paladin (862)

DarkSchneider's picture

31-03-2018, 20:59

I meant the development of the compiler itself, and all around it (like MSX libs), not the generated code.

One thing I miss on SDCC is a fastcall for functions, passing parameters into registers instead all them into the stack.

By PingPong

Prophet (3436)

PingPong's picture

01-04-2018, 01:24

DarkSchneider wrote:

I meant the development of the compiler itself, and all around it (like MSX libs), not the generated code.

One thing I miss on SDCC is a fastcall for functions, passing parameters into registers instead all them into the stack.

a similar thing (from sdcc doc)
3.9 Naked Functions
A special keyword may be associated with a function declaring it as _naked. The _naked function modifier attribute prevents the compiler from generating prologue and epilogue code for that function. This means that the user is entirely responsible for such things as saving any registers that may need to be preserved, selecting the proper register bank, generating the return instruction at the end, etc. Practically, this means that the contents of the function must be written in inline assembler. This is particularly useful for interrupt functions, which can have a large (and often unnecessary) prologue/epilogue.

By DarkSchneider

Paladin (862)

DarkSchneider's picture

01-04-2018, 08:14

That is great!

That allows any already made ASM functions (i.e. the one done for MSX-C and its calling convention) to be used. For calling from C, simply put the code using inline asm for calling, to set the parameters properly in registers and call the function.

But a fastcall would be also fine for C functions with fast parameters. Could request be made?

As said, currently I have the hopes at SDCC as is the only one in development. But currently can't use for the ongoing proyects for MSX.

By Wlcracks

Champion (321)

Wlcracks's picture

01-04-2018, 08:48

This demo is completely made in SDCC YabYum.rom
SDCC works perfectly for MSX. It's not plug and play, it has lots 'o traps, but it is beeing updated almost daily. Importing ASM very easy, just some minor dialect problems occur and some illegal instructions do not compile. .db will do the trick. Start with a small "first steps" project, and expand later.
If i can do it, why cant you? ;)

By DarkSchneider

Paladin (862)

DarkSchneider's picture

01-04-2018, 08:51

Well I am interested on making MSX-DOS2 programs, and I don't know the state of that on SDCC. I know CRT0 lib was released recently, but not much info.

By Wlcracks

Champion (321)

Wlcracks's picture

01-04-2018, 10:46

Not sure what the difference are between MSX-DOS and MSX-DOS2, in the means of requirements of a header, but a MSX-DOS program works on MSX-DOS2, so i guess this would be a good start???!! konamiman sdcc msxdos header

By DarkSchneider

Paladin (862)

DarkSchneider's picture

01-04-2018, 11:25

Currently z88dk is using SDCC as C compiler. And it has many standard libraries already made (like the I/O ones).
https://www.z88dk.org/forum/index.php
See Library Documentation section.
https://www.z88dk.org/wiki/doku.php

Its malloc allows mutiple heaps, that is an incredible powerful feature.
https://www.z88dk.org/wiki/doku.php?id=library:memory_allocation

Don't know if bare SDCC includes all that.

What I think they lack, and is a mandatory one, is file I/O support. No files, no DOS programs can be made.

I think the MSX ones are not hard to make, it needs one for calling BIOS, and most of function are wrappers that use this one.
As all parameters are passed in the stack, is easy to specify on the function prototype the order, and POP them to the registers, then call BIOS. Or create an auxiliar registers struct like the MSX-C ASCII libs made, fill it and send to function.

Page 2/3
1 | | 3