FUSION-C the C library for MSX (SDCC)

FUSION-C the C library for MSX (SDCC)

by ericb59 on 15-01-2019, 09:27
Обсуждение: Development
Языки:

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)

Комментарии (72)

By gdx

Enlighted (6422)

Аватар пользователя gdx

15-01-2019, 09:42

Good job Eric! I'm impressed.

By Grauw

Ascended (10818)

Аватар пользователя Grauw

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

Paladin (761)

Аватар пользователя alexito

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

Expert (112)

Аватар пользователя fr3nd

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

Ascended (10818)

Аватар пользователя Grauw

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

Scribe (1609)

Аватар пользователя Pencioner

15-01-2019, 10:26

Great, thanks Eric!

By ericb59

Paragon (1124)

Аватар пользователя ericb59

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

Expert (112)

Аватар пользователя fr3nd

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

Paragon (1124)

Аватар пользователя ericb59

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

Expert (112)

Аватар пользователя fr3nd

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

Champion (344)

Аватар пользователя Danjovic

15-01-2019, 15:14

Cool! Gotta try it out on Linux!

By wimpie3

Champion (436)

Аватар пользователя wimpie3

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

Paragon (1124)

Аватар пользователя ericb59

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 (509)

Аватар пользователя Victor

15-01-2019, 18:27

Congratulations Eric and Fernando...

Thanks for this grat work!

By wimpie3

Champion (436)

Аватар пользователя wimpie3

15-01-2019, 18:52

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

By ToriHino

Paladin (925)

Аватар пользователя ToriHino

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

Paragon (1160)

Аватар пользователя Wolverine_nl

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 (206)

Аватар пользователя Josb

15-01-2019, 21:28

Thanks, I'm stunned by your great job.

By rvanzon

Rookie (17)

Аватар пользователя rvanzon

15-01-2019, 22:15

Great work Eric and Fernando!
Thanks! Smile

By wimpie3

Champion (436)

Аватар пользователя wimpie3

16-01-2019, 06:50

Is it true what Wolverine says?

By La Gaseta Msx

Supporter (13)

Аватар пользователя La Gaseta Msx

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

Paragon (1124)

Аватар пользователя ericb59

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

Ascended (10818)

Аватар пользователя Grauw

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

Enlighted (6422)

Аватар пользователя gdx

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

Paladin (925)

Аватар пользователя ToriHino

19-01-2019, 13:25

I received the book today, looks great!

By sinus

Expert (85)

Аватар пользователя sinus

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

Paragon (1124)

Аватар пользователя ericb59

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

Paladin (761)

Аватар пользователя alexito

20-01-2019, 17:09

I received mine too. Look awesome. Thanks Eric.

By karloch

Prophet (2159)

Аватар пользователя karloch

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 (649)

Аватар пользователя hbarcellos

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

Champion (436)

Аватар пользователя wimpie3

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

Paragon (1124)

Аватар пользователя ericb59

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

Champion (436)

Аватар пользователя wimpie3

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

Champion (436)

Аватар пользователя wimpie3

22-01-2019, 12:51

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

By ericb59

Paragon (1124)

Аватар пользователя ericb59

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

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

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

Paladin (761)

Аватар пользователя alexito

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

Paragon (1124)

Аватар пользователя ericb59

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

Paladin (925)

Аватар пользователя ToriHino

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 (279)

Аватар пользователя wilsonpilon

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

05-02-2019, 18:44

Hi,
I just received the book, looks good

By Fideton

Supporter (1)

Аватар пользователя Fideton

20-02-2019, 22:08

I have just received my book too. Great work!

By SvaboMSX

Resident (40)

Аватар пользователя SvaboMSX

02-05-2019, 19:44

Mine arrived today !
looking foward for some experiments and learnings!
Thank you for your work!

By SvaboMSX

Resident (40)

Аватар пользователя SvaboMSX

03-05-2019, 01:07

Somehow I got it running on my side.
After successful compilation always a new instance of openmsx ist started.

So I modified "compil.bat" that openmsx is only started once. (it is faster if rapidly change source code and compile again for testing

I found here:https://stackoverflow.com/questions/162291/how-to-check-if-a-process-is-running-via-a-batch-script a dos snippet

and modified "compil.bat" at the lower section to this:

:Emulator
SETLOCAL EnableExtensions
set EXE=openmsx.exe
FOR /F %%x IN ('tasklist /NH /FI "IMAGENAME eq %EXE%"') DO IF %%x == %EXE% goto FOUND
echo Not running
goto FIN
:FOUND
echo Running
goto end
:FIN
openMSX\openmsx.exe -machine Philips_NMS_8255 -ext msxdos2 -diska dsk\
:end

By SvaboMSX

Resident (40)

Аватар пользователя SvaboMSX

03-05-2019, 01:50

hey... it's me again...

I have problem to compile, when I print using "Print" and then declare a variable.
Without Printing before declaring a variable the routine works.
Any guidance?

input:

//
// Fusion-C
// My First Program in C
//

#include "fusion-c/header/msx_fusion.h"
#include 

void main(void) 
{
	PrintNumber(5);  // <<--- when I leave this out, then it is compiling. (?)
  	int dk_v = 5;
  	while (dk_v>0){
  		PrintNumber(dk_v);
  	dk_v--;
  	}
  	 Print ("\nhal\n");

}
 

output:

-------- Compilation of : 
test
.
test.c:12: syntax error: token -> 'int' ; column 6
test.c:13: error 20: Undefined identifier 'dk_v'
test.c:14: error 20: Undefined identifier 'dk_v'
test.c:15: error 20: Undefined identifier 'dk_v'
Done.
Running
[Finished in 0.2s]

By ToriHino

Paladin (925)

Аватар пользователя ToriHino

03-05-2019, 07:31

It is only allowed to do variable declarations at the beginning of scope block or function, so use something like:

void main(void) 
{
        int dk_V;

	PrintNumber(5); 
  	dk_v = 5;

And even better, as a good practice always initialize your variables with a value (be it f.e. either 0 or in your case 5);

By SvaboMSX

Resident (40)

Аватар пользователя SvaboMSX

03-05-2019, 08:44

excellent. It is working as you said.
Thank you.

By ericb59

Paragon (1124)

Аватар пользователя ericb59

02-06-2019, 08:50

After more than 220 downloaded Package since 5 months, the world wide's MSX community proved its interest in a complete easy language package usable on recent computers to program our good old MSX !

The new version 1.1 of FUSION-C is available.[/b]

Now more stability, less memory used in compiled programs, a lot BUGS fixed, and new features available.
Some functions have been fully reprogrammed to consume less memory and be faster.
The new functions now allow:
- Manage an MSX mouse
- Have a real time timer variable
- Decompress RLEWB data (Compressor include)
- Read and write data directly on disk's sectors
- Play Samples via a Covox module
- Manage an automatic interruption
- the new crt0 now initialize global variables.
and more...

FUSION-C 1.1 is always free, downloadable from www.repro-factory.com
The book FUSION-C Complete Journey has been updated and corrected, is still available on Amazon:
https://www.amazon.com/FUSION-C-MSX-Library-complete-journey/dp/1730828612/ref=sr_1_3

Code, play, publish!

Eric.

By ToriHino

Paladin (925)

Аватар пользователя ToriHino

02-06-2019, 18:53

Eugeny just released code for TCP/IP UNAPI for Fusion-C on the GR8NET (or any UNAPI compatible device), which can be found here. See the GR8NET manual for more details

By st1ckman67

Supporter (1)

Аватар пользователя st1ckman67

16-06-2019, 19:14

Ok, I've just got the new updated 1.1 book, downloaded and installed everything as per the book instructions.
Everything compiles (test.c) without issue in Sublime and the emulator kicks up.
I then get to the a:\ prompt and I type test and hit enter only to be presented with "ooooooooooooooo" instead of "Hello MSX World".
Have I not done something right, I've also tried compiling the console.c example and it just prints junk to the screen but works perfectly.

Any help would be appreciated.

By sergarbes

Expert (116)

Аватар пользователя sergarbes

21-06-2019, 10:55

I have followed all the steps of the book with an HB-F700P on a macOS Mojave.

Everything compiles correctly. But when executing test.com it prints junk with the same length of the text you want to print.

I have tried the other functions of the msx_fusion.h library as PrintNumber and the same thing is happening.

I have also tried with stdio.h and printf and printed correctly.

What am I doing wrong with the msx_fusion.h library?

Thanks for your help and happy msx coding!

By sergarbes

Expert (116)

Аватар пользователя sergarbes

21-06-2019, 20:10

This is the code

//
// Fusion-C
// My First Program in C
//
//#include
#include "fusion-c/header/msx_fusion.h"

void main(void)
{
//printf("Hello world!\n");
Print("Hello world!");
}

And this is the result

Screenshot

By fregarni

Resident (39)

Аватар пользователя fregarni

02-07-2019, 13:41

Hello, I have the same problem with new version 1.1 of Fusion-C Library when I compile test.c file (shown "ooooooooooooooo" instead of "Hello MSX World"). I've tried to compile fusion.lib from sources and I have the same result. Any solution founded?

Thanks.

By ToriHino

Paladin (925)

Аватар пользователя ToriHino

02-07-2019, 20:50

There is a separate thread for issues related to FUSION-C, so it's better to post your question over there

By sergarbes

Expert (116)

Аватар пользователя sergarbes

04-07-2019, 17:48

ToriHino wrote:

There is a separate thread for issues related to FUSION-C, so it's better to post your question over there

Done. Thank you for the info.

By ericb59

Paragon (1124)

Аватар пользователя ericb59

14-09-2019, 11:00

The new version of FUSION_C 1.2 is available.

What's up...
Fixes, optimizations, and new features, including MSX2 VDP features, Support of the V9990 and GR8NET TCPIP

- CheckBreak: Check Break sequence in MSX-DOS console

- PutCharHex: Pint Hex conversion of a char on console

- PrintHex: Print Hex conversion of an integer on console

- HMMM: Vram to Vram

- LMMC: Ram to Vram Fast Copy Function

- YMMM: Vram to Vram Fast Copy to Y Position

- HMMV: High speed draw filled rectangle

- LMMV: High speed filled rectangle with operator

- MouseReadTo: Fast Read mouse state and buttons to variable structure

- Itoa: Integer to Char conversion

- StrReverse: Reverse a string

- BoxFill: Fast Draw of a box on screen (easy version of HMMV / LMMV)

- BoxLine: Fast Draw of an empty box on screen

Added support for the V9990 by porting the TeamBomba's GFX9K graphics library to SDCC (Thanks to Sylvain). (beta, no manual, but a .h file to read!)

Added TCP TCP Support for GR8NET Cartridge (Thanks to Eugeny) (beta. No manual but a .h to read!)

The library is still free.
To download this version, 2 possibilities:
on the Repro-Factory Site: http://www.ebsoft.fr/shop/es/19-fusion-c
or on GitHub: https://github.com/ericb59

Be happy and code for MSX !
See you

By user888

Expert (72)

Аватар пользователя user888

14-11-2019, 07:39

Good initiative. I bought the book, but please put everything in a git repository to make it a joint effort. It makes the threshold to collaborate and do something back for the community so much lower!

By user888

Expert (72)

Аватар пользователя user888

14-11-2019, 07:40

I think i missed the last link in your last post ;-)

By Gregory

Champion (295)

Аватар пользователя Gregory

17-12-2019, 14:05

Hey Eric,
great to see you share this information with the community.
I've downloaded the free library and ordered the book through amazon.
My question is: 'Is there a complete explanation in the book on how to set up the tool-chain'?
I wanted to get the toolchain from your site but I saw that chrome gives the warning 'not secure'. So I'm reluctant to give all my information on your webshop.
So, is all the software that you bundled in the tool-chain download available as free software on the internet and do you provide links to it in your book?
(I just ordered the book today, so it will be a couple of weeks before I get it).

By Wolverine_nl

Paragon (1160)

Аватар пользователя Wolverine_nl

17-12-2019, 20:36

hi Gregory,
you can also find everything on github, for the toolchain:
https://github.com/ericb59/Fusion-C-v1.2/tree/master/Working...

https://github.com/ericb59/Fusion-C-v1.2/blob/master/FUSION-...

took me 20 seconds too find ;-)

Have fun! ;)

By Dolphin101546015

Champion (336)

Аватар пользователя Dolphin101546015

08-01-2020, 09:38

;test.c:159: b=(unsigned char)((unsigned char)col>>2)&7;
	ld	a, 0 (iy)
	rrca
	rrca
	and	a, #0x3f
	and	a, #0x07
	ld	(_b+0), a

*Facepalm*

On every shift operations with speed optimization, SDCC use wrong shift operation, and AND after it, also no optimizations for next operations.
Another one surprize, was using 16 register pairs for unsigned char operations.

By mpsantos7

Supporter (12)

Аватар пользователя mpsantos7

14-04-2020, 18:02

Hi,
Please, Could someone explain how I can put assembly inline routine in fusion C ?
I know there some code with it, but I don`t understand when I use #, (), or things like ld a, 0 (iy)

For example, at this code, I am getting the error message:
testasm.asm:52: Error: machine specific addressing or addressing mode error

#include "fusion-c/header/msx_fusion.h"

void write(void)
{
__asm

ld hl,#0
add de,#8192
ld c,#0

rotina: push hl
ld a,#255
call 0x004d
add hl,de
ld a,c
call 0x004d
add a,#16
ld c,a
pop hl
inc hl
ld a,h
cp #24
jr nz,rotina

ret

__endasm;
}

void main(){
Screen(2);
write();
Screen(0);
}

By ARTRAG

Enlighted (6976)

Аватар пользователя ARTRAG

14-04-2020, 21:27

This is an illegal operation
add de,#8192

By mpsantos7

Supporter (12)

Аватар пользователя mpsantos7

16-04-2020, 16:05

I mistyped it.

The correct is ld de, #8192 . However, Is it really the decimal value 8192 ?

If I put ,
ld a,(1000)
Then will register "a" contain the byte value from address 1000 ?

And what's mean " ld e,4(ix) ; lenght value Byte high" ?

thanks all in advance.

By ToriHino

Paladin (925)

Аватар пользователя ToriHino

17-04-2020, 07:56

Yes, ld de,#8192 loads the decimal value 8192 into register DE (for hexadecimal values ld de,#0x2000 is used).

Yes, using ld a,(1000) means it loads the value stored on address 1000 into register A

And ld e,4(ix) means loads the value of the address IX is pointing to + 4 into register E (an other used notation in other assemlers is also ld e,(ix + 4)).

By gdx

Enlighted (6422)

Аватар пользователя gdx

17-04-2020, 10:05

It's a shame that fusion C has this exotic notation.

By Wolverine_nl

Paragon (1160)

Аватар пользователя Wolverine_nl

17-04-2020, 13:55

gdx wrote:

It's a shame that fusion C has this exotic notation.

It is the assembler that comes with SDCC compiler, SDA that has some exotic notations.

By jelonertz

Supporter (3)

Аватар пользователя jelonertz

28-07-2020, 14:56

Hi Eric,

Thank you for such a good piece of software! Smile

I'm testing Fusion-C 1.2 and I was wondering if there is a way to use the "Sprite Priority Control" bit to use the "OR color" technique to add an additional 3rd color when overlapping just 2 sprites...

Thank you in advance!

By jelonertz

Supporter (3)

Аватар пользователя jelonertz

28-07-2020, 17:31

I found the way! Smile

If you add 64 to the color matrix, you enable the 6th bit (Sprite Priority Control).

Cheers!

By rolandve

Champion (372)

Аватар пользователя rolandve

10-04-2021, 13:02

Sorry for adding to this thread, but it's not a bug and not a real issue: will we see a new updated 64 bit version of the build chain?

By ARTRAG

Enlighted (6976)

Аватар пользователя ARTRAG

31-12-2021, 15:51

Hi Eric, I've just updated SDCC and Fusion-C
Can you confirm that Fusion-C v.1.3 and SDCC 4.1 are not compatible ?