Hello! I'm Looking for some MSX-C examples that uses glib.h for graphical enviroments

Page 2/3
1 | | 3

By DarkSchneider

Paladin (748)

DarkSchneider's picture

23-05-2018, 10:49

You need to know how sprites works on MSX. Look at the code:
plspr is defined as 0xff, that are full lines, in binary: 11111111, as the sprites are configured as 16x16, they are taken in groups of 4 (don't remember the placement ordering).
plclr is defined as int, 16-bit values, so we have values with wrong data. It is getting values like 0, F, 0, F, 0, F...

So we have an issue with plclr. The color data are 16 bytes, 1 byte per line, so it would be better formed like:
char *plclr[16] = { color_line1, color_line2, ..., color_line16 }
Each color_line is an 8-bit value instead 16-bit.
If not, it is getting the first 0 of the INT value as value for first line of each pair, and values from plclr[8] to forward they are even used.
The color data has its own rules, must look it at the V9938 manual.
http://map.grauw.nl/resources/video/yamaha_v9938.pdf
Look for sprite mode 2, page 106 of the PDF for color format.

By Grauw

Enlighted (7409)

Grauw's picture

23-05-2018, 11:18

Order of 8x8 sprite patterns forming a 16x16 sprite is top left, bottom left, top right, bottom right.

Also described on p. 90 of the V9938 manual btw (or p. 99 in Eugeny’s version, nicer to look at), so you can just look there if you need a reminder.

By Jin

Resident (37)

Jin's picture

23-05-2018, 11:24

DarkSchneider and Grauw thanks for Reply

I learned how to program correctly while ago Big smile

Im gonna try some other functions from glib.h

Thank you very much Big smile

By Jin

Resident (37)

Jin's picture

23-05-2018, 12:37

Hi all! Now im trying to convert a Basic to MSX-C
But it is not working, What am I doing wrong?

By jepmsx

Rookie (23)

jepmsx's picture

23-05-2018, 13:13

Aren't there missing semiconlons after the rnd() lines?
And {} for the loop?

By Manuel

Ascended (14671)

Manuel's picture

23-05-2018, 14:10

And use == for comparing and = for assignment.

By Manuel

Ascended (14671)

Manuel's picture

23-05-2018, 14:12

Other than that, this program does not show any output. No need for glib....

By Wolverine_nl

Paladin (939)

Wolverine_nl's picture

23-05-2018, 15:45

@Jin, you might want to read some basics on MSX-C, it is not like ANSI-C, more of a dead dialect Wink
Some things need extra declarations, which you normally wouldn't do.
Here are some examples of For and While loops and If statements
https://www.msx.org/forum/development/msx-development/msx-c-...
The program is to show text on a graphical bitmap mode 5, it has a few examples on how to handle msx-c code. ;)

By Sylvester

Champion (377)

Sylvester's picture

23-05-2018, 18:47

@jin have a look at https://archive.org/details/TheCProgrammingLanguageFirstEdition MSX-C expects this syntax of C.
And the blog posts of https://www.lavandeira.net/relearning-msx/ are also very useful.

By Wolverine_nl

Paladin (939)

Wolverine_nl's picture

23-05-2018, 20:00

Sylvester wrote:

@jin have a look at https://archive.org/details/TheCProgrammingLanguageFirstEdition MSX-C expects this syntax of C.
And the blog posts of https://www.lavandeira.net/relearning-msx/ are also very useful.

The first one is a great find indeed, it is K&R C, old C dialect if you will.
in ANSI for example, a function:

VOID myFunction (int x, int y)
{
*/ do stuff here */
}

in K&R:

VOID myFunction(x, y)
int x, y;
{
/* do stuff here */
}

and Lavandeira.net has allot of basic things, really from the start, how to set up your compiling workspace etc.

Page 2/3
1 | | 3
My MSX profile