I want to learn MSX-C, where do I start?

Página 1/12
| 2 | 3 | 4 | 5 | 6

Por AxelStone

Prophet (2701)

imagem de AxelStone

19-08-2015, 13:45

Hi people, I've finally decided jump from Turbo Basic to MSX-C due to Basic limitations (specially in memory). I was hesitating between MSX-C or Turbo Pascal but since MSX-C is being used today for MSX comunity I suposse it has better support. I've followed the basic tutorial of Javi Lavandeira's Blog to mount a C enviroment in openMSX, so I'd like to jump to next step, this is:

1.- A good book to learn MSX-C? pdf if possible, I don't like very much read screen and I'd like to print it
2.- A good site of resources? (libs, examples...)
3.- Optional: is there a better enviroment to develop in MSX-C than OpenMSX? It seems that some people uses SDCC in PC, but I have no idea how to configure the enviroment.

Thanks people! Wink

Entrar ou registrar-se para comentar

Por tvalenca

Paladin (728)

imagem de tvalenca

19-08-2015, 14:16

If you'll use any up-to-date compiler (like SDCC you already mentioned), any ANSI-C book will do the job. You only have to be careful if you're using any CP/M C compiler, since they're older than ANSI-C specification.

Por PingPong

Prophet (3459)

imagem de PingPong

19-08-2015, 14:17

Use hitech-c or sdcc and do cross platform compilation

Por anonymous

incognito ergo sum (109)

imagem de anonymous

19-08-2015, 14:39

I feel a bit guilty about advertising my own stuff, but you can start with the MSX-C tutorials I've been writing:

Relearning MSX

I haven't been writing for a while, but there are 18 chapters. That will be enough to keep you busy until I continue posting new chapters (soon).

Por syn

Paragon (1920)

imagem de syn

19-08-2015, 14:46

Don't feel guilty about selfpromotion, you are not the first in the world Big smile

Often I find it annoying though, but in your case you have a 100% legitimate reason to do so Wink

Por anonymous

incognito ergo sum (109)

imagem de anonymous

19-08-2015, 14:57

SDCC compiles fast because it runs on a PC. However, it's not the easiest to set up, and the code it generates isn't the fastest because it always passes arguments to assembler functions via the stack.

By comparison, MSX-C compiles slower (since it runs on the MSX), and it has other limitations such as the size of the source file, which can be handled easily once you know how the compiler works. Check the tutorials on my site for more info on this.

I recommend MSX-C over SDCC, even in spite of the complications, because it generates faster code. MSX-C is actually an MSX version of LSI-C, and it always tries to pass as many parameters as possible via CPU registers, resulting in faster programs.

Something else that you will have to keep in mind is that MSX-C was released before the C language was standardized as ANSI-C, which is very close to modern C. The MSX-C compiler understands K&R C, which has slight differences with ANSI-C. Not a big issue.

Por tvalenca

Paladin (728)

imagem de tvalenca

19-08-2015, 15:25

JaviLM wrote:

SDCC compiles fast because it runs on a PC. However, it's not the easiest to set up, and the code it generates isn't the fastest because it always passes arguments to assembler functions via the stack.

Isn't there a switch to change this behaviour?

Por anonymous

incognito ergo sum (109)

imagem de anonymous

19-08-2015, 15:34

tvalenca wrote:
JaviLM wrote:

SDCC compiles fast because it runs on a PC. However, it's not the easiest to set up, and the code it generates isn't the fastest because it always passes arguments to assembler functions via the stack.

Isn't there a switch to change this behaviour?

In MSX-C there is a compiler directive that forces the code generator to pass the parameters in the stack, apart from a couple other changes in the way it handles integers:

#pragma pdp11mode

The SDCC compiler doesn't have any switch or compiler directive to force parameter passing via registers, that I know of. However, I'm not an expert in SDCC and I may be mistaken. Better let someone else who knows it better confirm whether I'm right or not.

Por PingPong

Prophet (3459)

imagem de PingPong

19-08-2015, 15:43

I am not so sure how much is msx c faster con code generated. Sdcc have poor handling about register parameters but speed is not only about register allocations. I assume giving the compiling platform (a pc) that sdcc is able to perform better optimizations than msx c must because of memory and speed constraints on the compiling platform. Also k&r style is quite different from ansi and for various reasons it does worth to go to ansi.
About setup is a matter of using some binaries avIlanle on internet.
For me sdcc is far a more better way

Por PingPong

Prophet (3459)

imagem de PingPong

19-08-2015, 15:50

Por tvalenca

Paladin (728)

imagem de tvalenca

19-08-2015, 15:50

Almost forgot!

There are some M80/L80 versions that you can download online that comes with an "22NICE.COM" (CP/M emulator for MS-DOS or something) that allows you to run CP/M programs on MS-DOS. Maybe you can use it to run any C compiler for CP/M from DOSBOX... It may be harder to set everything up, but your programs will compile lightning fast.

Página 1/12
| 2 | 3 | 4 | 5 | 6