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

صفحة 4/12
1 | 2 | 3 | | 5 | 6 | 7 | 8 | 9

بواسطة anonymous

incognito ergo sum (116)

صورة anonymous

21-08-2015, 08:54

ericb59 wrote:

Neither, He doesn't find good way to make a Floppy version, loading graphics from a floppy.
Perhaps it 's because of his own limitation about MSX understanding, or SDCC limitation... ?

I don't know SDCC very well, but I know that Nestor uses it to develop his applications, and he's doing fine working with files.

ericb59 wrote:

But, how is it easy (or not) making 64K ROM or MegaRom when programing with MSX-C ?

I don't know the details, but if this is very important to you then I can translate the relevant pages of the MSX-C manual. It will take me a few days. From what I can see, MSX-C itself doesn't handle slot switching, and you (or your friend) will have to write code to handle the page switching, detecting available memory, and to keep track of where the application assets are stored. If you're running under MSX-DOS2 this task becomes much easier, but then we're not talking about cartridge software.

ericb59 wrote:

How is it easy (or not) making floppy disk games (loading files) ? with or without MSX-DOS ?

Handling files in MSX-C is trivial. It's exactly the same as in standard C.

بواسطة AxelStone

Prophet (3055)

صورة AxelStone

21-08-2015, 09:09

Yeah Nestor is using SDCC, perhaps he could help some with this topic Smile

About manual, it should be really apreciate to get translated MSX specific parts of the manual. This is, the standar commands are not relevant since you can use any standar C manual, but specific MSX functions not. Clearly it should be a valious msx.org wiki content Wink

@ericb59 Wellcome to MSX-C, let's try our best Wink

بواسطة ericb59

Paragon (1046)

صورة ericb59

21-08-2015, 09:24

Yes, JaviLM, if you can translate thoses parts, it will be verry interresting.

Not Sure I will jump into MSX-C, because all projects I can have are supposed to handle a lot of Data, and have to be stored on large MegaRom. I'm not sure MSX-C can be helpfull for that.
My first think is MSX-C is good to do small softwares, and 32K Roms.
Perhaps I will change my mind with more informations from JaviLM...

بواسطة anonymous

incognito ergo sum (116)

صورة anonymous

21-08-2015, 09:28

DarkSchneider wrote:

There is a way to put some part of code, and data (variables, arrays, probably not using malloc but I don't care) in a specific address like in ASM? For using pages or mappers manually is required to select the 16KB block and not split the data nor broke the code at switch. I guess so because C can make ROM.

Yes, it's easy. Just define variables to point to a memory location. For example, from the COLOR.C sample program that comes with MSX-C:

#define FORCLR (*(TINY *)0xf3e9)   /* foreground color */
#define BAKCLR (*(TINY *)0xf3ea)   /* background color */
#define BDRCLR (*(TINY *)0xf3eb)   /* border color */

From this point on, you can refer to FORCLR, BAKCLR and BDRCLR as TINY variables (TINY is an 8-bit value in MSX-C), and these variables are located in memory addresses 0xF3E9, 0XF3EA and 0xF3EB, respectively. You can read/write these variables freely.

بواسطة AxelStone

Prophet (3055)

صورة AxelStone

21-08-2015, 09:57

JaviLM wrote:
#define FORCLR (*(TINY *)0xf3e9)   /* foreground color */
#define BAKCLR (*(TINY *)0xf3ea)   /* background color */
#define BDRCLR (*(TINY *)0xf3eb)   /* border color */

From this point on, you can refer to FORCLR, BAKCLR and BDRCLR as TINY variables (TINY is an 8-bit value in MSX-C), and these variables are located in memory addresses 0xF3E9, 0XF3EA and 0xF3EB, respectively. You can read/write these variables freely.

And since they are pointers, you can iterate through memory addresses , right? This is, you can upload arrays to one adress and iterate over them. A very interesting feature.

@ericb59 Really C is designed for big projects, it provides needed resources for it. I'm not sure how to make roms >32Kb using C, but nowadays there are other devices in MSX has hard disk (or SD cards). The idea I have is that you can make really big games in C using hard disk as RPGs, strategy, simulation, adventures... how about Monkey Island playable from hard disk? Wink

بواسطة anonymous

incognito ergo sum (116)

صورة anonymous

21-08-2015, 10:02

AxelStone wrote:
JaviLM wrote:
#define FORCLR (*(TINY *)0xf3e9)   /* foreground color */
#define BAKCLR (*(TINY *)0xf3ea)   /* background color */
#define BDRCLR (*(TINY *)0xf3eb)   /* border color */

From this point on, you can refer to FORCLR, BAKCLR and BDRCLR as TINY variables (TINY is an 8-bit value in MSX-C), and these variables are located in memory addresses 0xF3E9, 0XF3EA and 0xF3EB, respectively. You can read/write these variables freely.

And since they are pointers, you can iterate through memory addresses , right? This is, you can upload arrays to one adress and iterate over them. A very interesting feature.

Yes, these obey standard pointer arithmetic. In this example we have three pointers to TINY values, but they could have been pointers to, say, structs representing characters in a game, or bullets flying towards your ship...

بواسطة Sylvester

Hero (537)

صورة Sylvester

21-08-2015, 10:17

For some msx-c examples also have a look at: https://github.com/sndpl/msx-c-intro This repo contains the source code of the second MSX-C book (green cover).

بواسطة AxelStone

Prophet (3055)

صورة AxelStone

21-08-2015, 10:53

Sylvester wrote:

For some msx-c examples also have a look at: https://github.com/sndpl/msx-c-intro This repo contains the source code of the second MSX-C book (green cover).

Great input, thanks for the url. Let's see if a community of MSX-C programmers is created ;)

بواسطة DarkSchneider

Paladin (942)

صورة DarkSchneider

21-08-2015, 13:49

JaviLM wrote:
DarkSchneider wrote:

There is a way to put some part of code, and data (variables, arrays, probably not using malloc but I don't care) in a specific address like in ASM? For using pages or mappers manually is required to select the 16KB block and not split the data nor broke the code at switch. I guess so because C can make ROM.

Yes, it's easy. Just define variables to point to a memory location. For example, from the COLOR.C sample program that comes with MSX-C:

#define FORCLR (*(TINY *)0xf3e9)   /* foreground color */
#define BAKCLR (*(TINY *)0xf3ea)   /* background color */
#define BDRCLR (*(TINY *)0xf3eb)   /* border color */

From this point on, you can refer to FORCLR, BAKCLR and BDRCLR as TINY variables (TINY is an 8-bit value in MSX-C), and these variables are located in memory addresses 0xF3E9, 0XF3EA and 0xF3EB, respectively. You can read/write these variables freely.

That's right!

Then I think only is needed to place the code in specific address, probably is in the part of the manual talking about making ROM. Using memory mappers (computers with >64KB RAM) is pretty easy to handle the 16KB block and pages so there is no problem about that point.

بواسطة hit9918

Prophet (2905)

صورة hit9918

21-08-2015, 17:31

Please fight the babel.
The question is not only what C to use, but what C to write.
A C that every compiler is asked to translate.
Is that even more ado, no, I am actualy trying to make things easy.
But ROM, DOS, BASIC environment, one CP/M compiler vs SDCC, that alone makes six combinations of babel.

@AxelStone, you wanted to make a game, right?
maybe the "hello world" app for the MSX game coder should be this:

	di(); out(0x99, 15); out (0x99,128 + 7); ei();

it makes the border color 15. getting the machine to do something, some first feedback.
based on the out() that can do the vertical roll register and blitter command engine and everything,
on every compiler.

so the first thing an MSX C should have is to make the z80 available:

void di();
void ei();
void halt();

void out(char port, char n);
char in(char port);

void* otir(char port, unsigned char count, void *p); /*returnvalue must be the slided pointer*/
void* otir29(char port, unsigned char count, void *p); /*for MSX1 VDP , 29 cycles*/
void* inir(char port, unsigned char count, void *p);
void* inir29(char port, unsigned char count, void *p);

Let me know in case anywhere there is an in() out() that is specified different.
The otir() can be made based on out() when one has nothing else at hands.

when JaviLM has sprites based on vpoke(), when you got an out() then in 5 minutes you can get his vpoke.
"his" vpoke:
the exact function signature of vpoke() is not so clear,
e.g. how to handle the 128k vram vpoke on a 16bit 64k C.
things get easy when it is based on a compatible out().

صفحة 4/12
1 | 2 | 3 | | 5 | 6 | 7 | 8 | 9