SDCC crt0.s for floppy bload

Страница 3/3
1 | 2 |

By aoineko

Master (163)

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

06-02-2021, 21:44

ocitygate wrote:

Important that --code-loc 0xC020 is exactly 0x20 higher that the first address.

I feel like there's something weird with your memory address values. It seems to me that if your header is placed in A000h, it means that you are aiming at an MSX with at least 24K of memory. In this case, your code should be just after (around A020h). If you aim at an MSX with 32K, these values should be 8000h and 8020h. And for 16K, C000h and C020h.

By aoineko

Master (163)

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

07-02-2021, 00:39

By the way, if you don't like to waste a few bytes like me, you can place your code segment at _HEADER + 7 (the header is 7 bytes long).
To do that, just put the _CODE segment just before the init: label in your crt0, then use --code-loc 0xA007 in your SDCC command line (if your program starts at 0xA000).
That's it! Not only have you saved a few bytes on your binary file size, but above all, you no longer have the risk of overlap between the code in your crt0 and the one in your C file(s).
You can check the crt0 I use in my game library for Basic binary program: https://github.com/aoineko-fr/CMSX/blob/master/cmsx/src/crt0...

By DamnedAngel

Master (226)

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

07-02-2021, 02:25

ocitygate wrote:

I want to code C for my first generation MSX (Toshiba HX-10), but since I do not have any disk controllers and therefore no MSX DOS, I need to load my programs through the cassette interface with the BLOAD command in MSX BASIC.

Hi ocitygate,

You might want to take a look at my SDCC templates for MSX. The config files and build scripts get your addresses just right and, on top of that, they offer a lot of common services, including references for integration with MSX-BASIC for BIN programs and symbol exporting to be used along OpenMSX Debugger.

In case you are under Windows and have a taste for MS Visual Studio, the templates integrate nicely with the IDE. But if you aren't, then you can use whatever IDE pleases you most and call the build script manually.

You can find the templates at https://github.com/DamnedAngel/MSX-Templates-for-VisualStudio.

cheers,

By ocitygate

Expert (67)

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

13-02-2021, 19:23

Thanks Angelo, I am taking a look.
I am on Windows and use Visual Studio (C++ and C#) but I use it just for Windows programming.
For MSX I'm using SDCC compiler. I tried MSX-C but I prefer keeping my development environment on Windows.
What I like the most about SDCC is that you can embed Z80 assembly in your code.
For emulation I'm using blueMSX on Windows and fMSX on my Android phone.
Tried OpenMSX but did not like Catapult. Too much configuration which I do not need.
Thanks for replying to my post.

Страница 3/3
1 | 2 |