sdcc_msx new C/ASM programming framework for MSX1/linux

By salutte

Supporter (2)

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

26-06-2019, 09:57

Hi all! I'm Manel and I'm new here.

I'm presenting here my pet project since last Summer, a tool for mixed development MSX/linux, allowing to compile the same code for both platforms for ease debugging capabilities. Also within the framework are a few tools that might be interesting: k5link: a linker for sdcc object code that generates megaroms with a konami5 mapper. The midi2msx tool that preprocesses midi files to be played with the PSG, and the gif2msx, a tool that preprocesses short videos to be played in interlaced color in MSX1. This isn't a fully fledged professional project. It's just my pet project, but it just reached a state where it might be useful for people, and thus I think it's worth to make it public. (Basically, if I had to wait for it to be perfect to make it public , this would never happen). It's not even versioned, but you could consider it 0.00-pre-alpha.

Here is the datasheet/FAQ:

Name: sdcc_msx (really looking for something better)

Goal: Create Konami5 Megaroms for MSX using mainly C language using sdcc (albeit accepting asm to accelerate sections). At the same time, compile the same code using gcc, and using a msx hardware abstraction layer, to create native linux executables.

Why native linux instead of emulator? GCC is way more mature than SDCC, and the error messages and warnings are more informative, allowing for the detection of more bugs during compilation time. Also native code builds/runs faster, and allows for debuggers like gcc, (or printfs) thus allowing for faster optimization of game mechanics.

Where: https://github.com/MartinezTorres/sdcc_msx

Konami-5 mapping: C is not as compact as assembler, but large programs require Megaroms and simply sdcc does not play well natively with ROM mappers. Hence I created a custom linker for sdcc named k5linker, that allows sdcc to call functions and read code from different segments. The mapping is manual and not trivial, but this was the best I could do without modifying sdcc sources, and it allows to infuse very large amounts of data in the ROM.

midi 2 psg: I could not find a fully C player (to run on linux) for popular music trackers such as PT3, and WYZ. I would love to have them! In the mean time I coded a MIDI importer that converts midi files to an internal format to be played by the PSG. The midi importer is *ugly*, and has very hand-coded trade-offs, so it works well for some MIDIs, but complex midis with many many channels may sound excessively messy. On the other gand ayfx sounds (and sound banks) are supported natively for sound effects.

gif 2 msx1: I also included an application to process a small video fragment and play it full screen (and color interlaced) on a msx1. The quality of the resulting video depends of course on the source, but simple and colorful videos look OK'ish. As with the midi player, a lot of hardcoded trade-offs are in place, so we encourage to modify the player to better fit your target videos. Still the MSX code that plays the files has a few remaining bugs.

Videos:

Hello world example. With interlaced fonts and sprites.
https://www.youtube.com/watch?v=KfzDLJv9D04

Test sample for the audio players:
https://www.youtube.com/watch?v=6k8PtknfQLQ

Test video examples:
https://www.youtube.com/watch?v=WJzlVU20RCE
https://www.youtube.com/watch?v=tb6U6Sqt1nY

Bests!

Для того, чтобы оставить комментарий, необходимо регистрация или !login

By ericb59

Paladin (859)

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

26-06-2019, 20:11

Hello,

I have to take a look at this Smile
Good job ! Gif2msx seems impressive.

Did you take a look to Fusion-C ? I included a PT3 player inside.

By salutte

Supporter (2)

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

26-06-2019, 23:18

Thanks!

The core concept of the sdcc_msx is to run the same code (or as much as possible), on intel and z80 platforms. Hence I find sdcc_msx and FUSION-C to be complementary. The provided library in sdcc_msx is minimal because every function implemented must have a C equivalent to be executed natively by a linux computer, and must also be supported by my minimal MSX hardware abstraction layer.

sdcc_msx was started before I knew about FUSION-C, and the few functions that constitute my API were mostly fixed by that time. Otherwise I would have leveraged FUSION-C! I find FUSION-C is impressive and extensive! And your documentation is amazing! Thanks a lot!

About the PT3, I saw in FUSION-C that the player is written in assembly, and I still need the C equivalent for it to be compiled for linux. I ported the ayfx player from assembly to C... I'll eventually port PT3 too Smile thanks for the offer though!

By santiontanon

Paladin (821)

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

27-06-2019, 09:08

Very interesting project!! I haven't tried using C for MSX development, but it's definitively a tempting idea. Looking forward to seeing progress in this project!

By Pencioner

Paladin (930)

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

27-06-2019, 09:42

Always a pleasure to see projects like this one Smile Making tools for people to develop more good things is such a great idea! Will have a look to the sources and try something when i get more time

By ToriHino

Champion (358)

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

27-06-2019, 19:56

Yes this certainly looks promising. And of course even better when sdcc_msx and FUSION-C can be merged together to get best out of both worlds.

By fr3nd

Expert (88)

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

28-06-2019, 11:45

Very interesting project. Can't wait to test it!