FUSION-C the C library for MSX (SDCC)

FUSION-C the C library for MSX (SDCC)

by ericb59 on 15-01-2019, 09:27
Topic: Development
Languages:

FUSION-C Is a C library, 100% dedicated to MSX. Functions dedicated to the hardware of the MSX are available in order to easily code games or tools for our machines: MSX1, MSX2, MSX2 + or MSX Turbo-R.
FUSION-C is intended to make programs that run under MSX-DOS 1 or 2, this does not prevent to transform your programs in ROM.
With FUSION-C you have more functions than under Basic, you will find functions for

  • Screen modes management from screen 0 to screen 8
  • Drawing
  • Copy of graphic area in VRAM or RAM
  • Sprites management
  • File management under MSX-DOS
  • Keyboard and joystick control
  • Management of the Memory Mapper under MSX-DOS2
  • Management of the PSG for the sound part
  • Player of music files .PT3
  • AYFX music file player for sound effects
  • etc

FUSION-C use the Cross Compiler C, SDCC (Version 3.6 preferably), compilations scripts are provided with the library.
The library is provided with all the source codes, so you can modify it and change it to your needs.

For simplicity I recommend a suitable tools-chain, compatible for Mac OS / Windows / Linux. This tools-chain consists of SDCC 3.6, the Hex2Bin module that converts the code from SDCC into a code usable under MSX-DOS, the code editor Sublime Text, and openMSX emulator.
Once the tools-chain is configured, a simple press of CTRL + B in Sublime Text starts the compilation of your code and its execution in openMSX.

The configuration of the Tools-chain, is explained in a 280 pages 's Paper book "Fusion-c Complete journey" available on Amazon for 12.99 Euros.
This book in English, supplements the documentation provided with the library by essential information about the MSX, its environment, the configuration of the tool-chain, and for beginners all the information to start coding in C, as well as a comparison of MSX Basic VS Fusion-C instructions.
Buy the book! it will be a kind of reward for the work done!

Fusion C is available for free at: www.repro-factory.com
in the FUSION-C section.

You can leave here, your comments, suggestions, problems & bugs encountered ...

Have a good coding day !

Media browser (5)

  • FUSION-C the C library for MSX (SDCC)
  • FUSION-C the C library for MSX (SDCC)
  • FUSION-C the C library for MSX (SDCC)
  • FUSION-C the C library for MSX (SDCC)
  • FUSION-C the C library for MSX (SDCC)

Comments (43)

By gdx

Prophet (2492)

gdx's picture

15-01-2019, 09:42

Good job Eric! I'm impressed.

By Grauw

Enlighted (7797)

Grauw's picture

15-01-2019, 09:56

Sounds like a great library for MSX C programmers, and also it's interesting that you combine it with a book! Seems really useful for starting C programmers especially! A lot of effort must've gone into this.

By alexito

Champion (283)

alexito's picture

15-01-2019, 10:02

I bought mine from Amazon with Free Shipping.

Sound very interesting because I never really programming in C ever.

Great job Eric.

Wink

By fr3nd

Resident (58)

fr3nd's picture

15-01-2019, 10:18

It looks promising. Will the source code be released? Is it possible to collaborate to the project in GitHub?

By Grauw

Enlighted (7797)

Grauw's picture

15-01-2019, 10:26

@fr3nd "Fusion C is available for free at: www.repro-factory.com in the FUSION-C section."

Did you miss that part? It was a bit hidden in a little sentence at the bottom :).

By Pencioner

Paladin (811)

Pencioner's picture

15-01-2019, 10:26

Great, thanks Eric!

By ericb59

Paladin (787)

ericb59's picture

15-01-2019, 11:13

Fusion-c library is provided with all source code (C and ASM source codes are include), also include a script to compile the library with new functions, or if you make changes in functions's sources code.
You can collaborate of course. If you have idea, new functions, bugs, let me know. All your ideas and new functions can be included in further release ... Share you work Big smile

By fr3nd

Resident (58)

fr3nd's picture

15-01-2019, 12:11

Yes, I saw the link and I went there, but I got confused when I had to go trough a checkout and registering process to download it... I guess I was expecting something more "developer-friendly" to make collaboration easier for everyone...

But please, don't get me wrong... I think this is a really interesting project that can make much easier to develop using modern tools, I just would have liked it to be in GitHub (or Bitbucket) so it's more available to everyone.

By ericb59

Paladin (787)

ericb59's picture

15-01-2019, 14:07

@fr3nd : Yes, GitHub is great and I'm using it also. I've chosen to publish FUSION-C via Repro-factory, to keep an eye on its distribution, i'm just curious to know how many people will download it.
Anyway in the futur the library will be available on GitHub too...

By fr3nd

Resident (58)

fr3nd's picture

15-01-2019, 15:12

ericb59 wrote:

Anyway in the futur the library will be available on GitHub too...

I'm glad to hear that! kudos for the project! I can't wait to test it.

By Danjovic

Rookie (31)

Danjovic's picture

15-01-2019, 15:14

Cool! Gotta try it out on Linux!

By wimpie3

Master (208)

wimpie3's picture

15-01-2019, 16:11

"this does not prevent to transform your programs in ROM"

How do you guys convert an MSX DOS program to a ROM version?

By ericb59

Paladin (787)

ericb59's picture

15-01-2019, 16:19

@wimple3 : with disk2rom utility (included in tools folders). Ok this is not suitable for 32K or 64K rom size but in most cases you can make a rom version of any floppy disk, and put it in a 512K or 1024K Cartridge.

By Victor

Champion (458)

Victor's picture

15-01-2019, 18:27

Congratulations Eric and Fernando...

Thanks for this grat work!

By wimpie3

Master (208)

wimpie3's picture

15-01-2019, 18:52

OK, so this basically means the program cannot be used to make games for the MSDEV competition.

By ToriHino

Champion (267)

ToriHino's picture

15-01-2019, 19:39

wimpie3 wrote:

OK, so this basically means the program cannot be used to make games for the MSDEV competition.

You can always submit for the MSX Freestyle category, as the rules state:
There’s no limit at all. Feel free to use whatever you want (graphic expansions, sound extensions, add-ons, later machines than MSX1, etc.)

By Wolverine_nl

Paladin (1001)

Wolverine_nl's picture

15-01-2019, 20:53

There is a guide online how to create a rom file from SDCC, several, here is one.
But Fusion-C probably has a few libraries using things specifically for DOS 1/2, also probably some CALLSLOT resolves. These need to be altered for a ROM project of course.

I think this is great, thanks Eric! :)

By Josb

Master (195)

Josb's picture

15-01-2019, 21:28

Thanks, I'm stunned by your great job.

By rvanzon

Supporter (14)

rvanzon's picture

15-01-2019, 22:15

Great work Eric and Fernando!
Thanks! Smile

By wimpie3

Master (208)

wimpie3's picture

16-01-2019, 06:50

Is it true what Wolverine says?

By La Gaseta Msx

Supporter (13)

La Gaseta Msx's picture

18-01-2019, 14:12

>>¿How do you guys convert an MSX DOS program to a ROM version?

>> with disk2rom utility (included in tools folders). Ok this is not suitable for 32K or 64K rom size but in most cases you >>can make a rom version of any floppy disk, and put it in a 512K or 1024K Cartridge.

As far as my understanding arrives, you can't.
As MSX-DOS is in a ROM any you are trying to executing another ROM.
Both occupuies the same logic space. Thus, it is not possible.

SDCC with tools can produce a .COM file
But a COM file can not be executed in a ROM.

By ericb59

Paladin (787)

ericb59's picture

18-01-2019, 16:13

La Gaseta Msx wrote:

As far as my understanding arrives, you can't.
As MSX-DOS is in a ROM any you are trying to executing another ROM.
Both occupuies the same logic space. Thus, it is not possible.

SDCC with tools can produce a .COM file
But a COM file can not be executed in a ROM.

Just download and try Brick Breaker demo
http://msx.ebsoft.fr/bbreaker/

as you see this is Game Demo made with FUSION-C. You have the DISK version, and the ROM Version
Rom version was made with DISK2ROM utility.

By Grauw

Enlighted (7797)

Grauw's picture

18-01-2019, 19:00

La Gaseta Msx wrote:

As far as my understanding arrives, you can't.
As MSX-DOS is in a ROM any you are trying to executing another ROM.
Both occupuies the same logic space. Thus, it is not possible.

SDCC with tools can produce a .COM file
But a COM file can not be executed in a ROM.

You can, it works very well.

How it works is the first 16K of the ROM is a diskROM, one which interfaces with the ROM mapper instead of a disk controller. The remainder of the ROM then contains a disk image, a ROM disk very similar to how a RAM disk works. The program is loaded in the computer's RAM memory exactly like a DOS game.

Downside is that it requires a 64K MSX, and that data needs to be loaded rather than accessing ROM banks directly. Upside is that you have the DOS environment with the full 64K of TPA RAM space available, rather than the first 32K to 48K occupied by ROM (BIOS + ROM data).

The large TPA is useful for any program, but especially for C programs I think. And it's easy to install a custom ISR and to use self-modifying or generated code, and on turboR it will run in fast internal memory. Lastly you can program for one environment and release both a downloadable disk and cartridge ROM version with little extra effort.

By gdx

Prophet (2492)

gdx's picture

19-01-2019, 01:17

wimpie3 wrote:

Is it true what Wolverine says?

Yes because Ericb59 chose the simplest method for developers. Maybe, with next version, we will be able to choose the execution environment of the program during compilation. There are several possibilities on MSX (MSX-DOS command, Disk that boot on sector 0, Binary file under Basic, then ROM 16k, 32k, 48k/64k and megaroms, raw file).

I hope that Fision-C will become so complete someday. I think this will depend on the project participants. For the moment, I imagine that it is not even optimized but it is already a good tool.

By ToriHino

Champion (267)

ToriHino's picture

19-01-2019, 13:25

I received the book today, looks great!

By sinus

Expert (73)

sinus's picture

19-01-2019, 19:20

What I've seen so far is really well done and rational, it breaks with the austerity and complexity of previous options to get to C language on MSX. Of course I am willing to support your efforts, I've bought the book and will try to contribute somehow some day Tongue
I personnaly stood among those who had prefered relying on a proper C language solution instead of developping in a specific Z80 or MSX related language (ASM or compiled BASIC however good they are). For sure I much welcome the energy involved in Fusion-C, authors gathering others' contributions as a shared tools pool. I hope this package with help 'new' guy to join the force and unleash their skills to create even more quality software: a virtuous circle Wink
Thanks,
Sinus

By ericb59

Paladin (787)

ericb59's picture

19-01-2019, 19:35

Thanks
I also hope the developers will use FUSION-C, and the Library will evolve with the needs of the coders. Do not forget to share your work, so that everyone can enjoy, and thus make a futur version 2.0
Wink

By alexito

Champion (283)

alexito's picture

20-01-2019, 17:09

I received mine too. Look awesome. Thanks Eric.

By karloch

Paragon (2033)

karloch's picture

20-01-2019, 23:57

I always wanted a good set of libraries and extensive documentation for developing C in MSX. I already ordered the book Smile Combining FUSION-C with ASMLIB I think many interesting things can be achieved!

By hbarcellos

Hero (557)

hbarcellos's picture

21-01-2019, 03:25

If it's coming from Eric = instant buy for me.
Congratulations! Open Source, Amazingly Useful stuff, optional purchase for a useful and collective item (Book).
All the Best guys.

By wimpie3

Master (208)

wimpie3's picture

21-01-2019, 17:08

Got the book yesterday and I'm a bit disappointed. This is basically a reference guide, not a programmer's manual. Perhaps I was expecting too much. Lots of English mistakes too.

By ericb59

Paladin (787)

ericb59's picture

22-01-2019, 12:26

@wimpie : Yes there are English mistakes. I done it with my very bad knowledge of Shakespeare's spoken language ! You can point to me the mistakes and I will correct them.
It's not a programmer's guide, my goal was not to make a C learning Book, there are many books, or websites about that. But, there is a complete C memento that beginners can read to learn C. In any case you must know at least the basics of programming.

@hbarcellos : thank you for your support :-)

By wimpie3

Master (208)

wimpie3's picture

22-01-2019, 12:50

@ericb59 What I expected (and what I would have liked personnaly) is a bit more guidance on how to make sprites move, how to create tiles, basically how to create software on the MSX. The book is now only a reference for the libraries (which is good) and partly an introduction in C (which is also good). However, there is not much material that glues both together. Most examples in the second part are limited to the standard SCREEN 0. Which is not bad, you have to start at the beginning. But begin the book with a library reference talking about screen modes, sprites, sound, followed by a C introduction talking about pointers, variables, functions... without a connection between both sections. How to create sprites? Tiles? Music? This means there is still a lot left to explore and learn for people not used to work with the MSX. The book is IMHO probably too easy for someone who knows the MSX, but too difficult for beginners.

By wimpie3

Master (208)

wimpie3's picture

22-01-2019, 12:51

(arghhh... why can't you correct spelling mistakes here on this forum?)

By ericb59

Paladin (787)

ericb59's picture

22-01-2019, 13:19

wimpie3 wrote:

(arghhh... why can't you correct spelling mistakes here on this forum?)

I do not understand what you 're meaning

Making sprites with Fusion-c is explained in the Book.
An you're right, this is not a guide for people who never tried to code something. This was not my purpose.

By DarkNekros

Supporter (2)

DarkNekros's picture

23-01-2019, 23:33

Thanks Eric for writing a great book (a little hard to read some times (typos, incomprehensible paragraphs, etc), but with a good content).
The first thing I thought about it was: " Shocked! It's a very huge book!!", but finally it comes handy when you have to see the screenshots or read the code. I've almost finished it and now it's time to write down some code!!

By Caetano

Supporter (1)

Caetano's picture

24-01-2019, 15:19

Would be nice to have a digital version of the book, take long time to ship to Brazil Cool

By alexito

Champion (283)

alexito's picture

25-01-2019, 00:22

I have already installed the Fusion C Toolchain + SDCC + SublimeText on my Windows Vista 64 (Athlon X2 CPU 3.2Ghz)
Compiled Successfully the "HELLO WORLD" and "HARDWARE SCROLL" C Programs.

I just follow the instructions in the book everything works good for me at the moment.

Thanks Eric.

By ericb59

Paladin (787)

ericb59's picture

25-01-2019, 15:46

alexito wrote:

I have already installed the Fusion C Toolchain + SDCC + SublimeText on my Windows Vista 64 (Athlon X2 CPU 3.2Ghz)
Compiled Successfully the "HELLO WORLD" and "HARDWARE SCROLL" C Programs.

I just follow the instructions in the book everything works good for me at the moment.

Thanks Eric.

I'm really happy to read such answer Wink

By ToriHino

Champion (267)

ToriHino's picture

26-01-2019, 01:12

Setting up the tool chain indeed worked well by following the steps in the book. Already made some steps on the first project Smile

By wilsonpilon

Champion (269)

wilsonpilon's picture

28-01-2019, 15:47

Hi...

I just received my book. I'm already reading and configuring the system. good job!

By chouimat

Supporter (2)

chouimat's picture

05-02-2019, 18:44

Hi,
I just received the book, looks good

By Fideton

Supporter (1)

Fideton's picture

20-02-2019, 22:08

I have just received my book too. Great work!

My MSX profile