C compiler??

Página 3/4
1 | 2 | | 4

Por AuroraMSX

Paragon (1901)

Imagen del AuroraMSX

29-01-2005, 13:04

C sucks on micros. It doesn't make sence

scuse my language, but that's complete and utter b*lls**t.

Loads of embedded software applications run on 'old' slow 8-bit microcontrollers and are definitely programmed in C. One just needs to have a very good optimizing C compiler.

If a C compiler for MSX could include (either in language extensions or by means of libraries) eg. memory mapper and interrupt routine support, I can assure you that you'll get applications that are just as efficient as written directly in ASM, but in only about 75% of the development time. Maybe even less...

Por karloch

Prophet (2137)

Imagen del karloch

29-01-2005, 14:08

If a C compiler for MSX could include (either in language extensions or by means of libraries) eg. memory mapper and interrupt routine support, I can assure you that you'll get applications that are just as efficient as written directly in ASM, but in only about 75% of the development time. Maybe even less...
I agree with you. With C you can (if you want, of course) code apps to a level that is very near to assembler (take a look to Uzix). Anyway, PASCAL already have libs for memory mapper and interrupt support, isn't it? although PASCAL is not C...

Por [D-Tail]

Ascended (8249)

Imagen del [D-Tail]

29-01-2005, 14:49

What would in your opinion be the best C-compiler then? ASCII-C? HiTech C?

Por AuroraMSX

Paragon (1901)

Imagen del AuroraMSX

29-01-2005, 15:31

ASCII C delivers faster (better?) code, but I *really* hate the K&R style syntax. Also the lack of a proper void type kind of disturbs me...
HiTech C delivers less efficient code, but at least has normal ANSI syntax.

IMHO there's no real winner, yet.

Por Arjan

Paladin (742)

Imagen del Arjan

29-01-2005, 16:29


I agree with you. With C you can (if you want, of course) code apps to a level that is very near to assembler (take a look to Uzix).

In terms of what? Speed? Code-size? IMHO the only point of using C right now is to shorten development time. HiTech C has really crappy code generation which can be easily outperformed by writing asm yourself (as in: all code can easily be made 300% faster, or more). Probably all compilers that target the z80 have bad code optimizers...

Por Grauw

Ascended (10066)

Imagen del Grauw

30-01-2005, 04:04

applications that are just as efficient as written directly in ASM
Er, excuse me, but that's nonsense. C has a lot in common with ASM, they basically operate on the same level and you can do everything with C that you can with ASM. You don't hear me say it would be inconvenient to have a good C compiler or some C/ASM hybrid language. But no way that in C you can optimize code as much as you can in assembly. I think I can safely state that an optimized assembly version will easily be twice as fast as its C equivalent.

Uzix is a pretty slow OS (no offense), and so it WiOS, both are coded in C. But, I think a good balance between development and execution speed could be achieved by first developing your code in C, and then optimizing certain routines which are executed often. Basically, taking the C output and then optimizing it by hand. This allows you to quickly develop a base in C, and then worry about optimizations later when everything is working solidly.

Actually, because C is just way more structured, it will avoid a lot of bugs, and thus saves quite some time. I think that's the most important reason why C is faster to develop for. Some kind of hybrid language, with C structures but with a more assembly-approach (e.g. without all that weird stack-stuff and with more control over which registers are used where), could be a nice idea.

~Grauw

Por Edwin

Paragon (1182)

Imagen del Edwin

30-01-2005, 13:06

Looking at plain code generation, a good C compiler should be able to generate code that is not significantly less efficient than you would manually. Of course it is doubtful that the MSX compilers were ever developed that far.

The real problem is the way you use C. Simple things like local variables and parsing parameters are quite unpleasant as they require dynamic allocation of memory. Which usually means using the stack. Retrieving data from the stack requires either the calculation of the right address or the use of IX/IY to fetch them with an offset (using only 8 bit registers). This is not very efficient. A high call frequency would quickly bring the z80 to its knees.

If you want C code to behave more like asm, you could probably attempt to use only global or static variables and not parse anything to functions. However, this would make the code rather difficult to read and defeat the point of using C in the first place. Of course, even then you still need an efficient generation of code from the rest.

Personally I think that the z80 is not suitable for higher programming languages and I would never use them myself. Besides, the limited resources available on MSX machines are easily controlled by hand in asm code.

Por AuroraMSX

Paragon (1901)

Imagen del AuroraMSX

30-01-2005, 20:15

C has a lot in common with ASM, they basically operate on the same level

Let's keep excusing Smile, because that is nonsense. C is just another 3rd generation, procedural programming langue, just like eg. Pascal.

For the rest of your post: I agree Smile

Por pitpan

Prophet (3145)

Imagen del pitpan

30-01-2005, 20:30

Yes. MSX deserves the best: only asm, please!

A word from our sponsors: USE/BUY/ENJOY asMSX v.0.11!!!!! Wink

Por arnold_m

Master (173)

Imagen del arnold_m

29-03-2005, 23:17

Some remarks about HiTech-C:
HiTech-C's assembler can do macros but the syntax for the definition is somewhat unusual, e.g.:
macro pop2, rp1, rp2
pop rp1
pop rp2
endm
To get limited support for subdirectories during compilation use cc.com, your program must still be in one subdirectory, but the standard header files and libraries can be in another. For subdirectory support during execution link with libdos2.
Cc.com and libdos2 are written by me and available from http://banzai.msx.nu/dev/software.html

I'm still dreaming of writing an optimiser that will improve constructs like:
ld (ix-2),l
ld (ix-1),h
ld l,(ix-2)
ld h,(ix-1)

Arnold (aka Yeti^)

Página 3/4
1 | 2 | | 4