[MSX-C] Q&A official thread

Pagina 48/57
41 | 42 | 43 | 44 | 45 | 46 | 47 | | 49 | 50 | 51 | 52 | 53

Van Wolverine_nl

Paragon (1159)

afbeelding van Wolverine_nl

14-09-2016, 10:08

kanima wrote:
Wolverine_nl wrote:

Ok, someone on irc chat tolf me it is just a variable.
Looking for a poke equilivant in Msx-c
Didnt find one just yet.

Try:

char *cliksw = (char*)0xf3db;
*cliksw = 0;

Thanks kanima, yours works like a charm, I totally appreciate it,
i was messing with

char value = 0
char *CLICKSW = 0xf3db;
value = *CLICKSW & 0;

but that didn't work, but yours does, I just had to put a space-bar between char and * before address.
A world just opened up Wink I am busy with msx-c for a while, but never needed to poke around.

Van AxelStone

Prophet (3094)

afbeelding van AxelStone

15-09-2016, 07:41

Wolverine_nl wrote:

Thanks kanima, yours works like a charm, I totally appreciate it,
i was messing with

char value = 0
char *CLICKSW = 0xf3db;
value = *CLICKSW & 0;

but that didn't work, but yours does, I just had to put a space-bar between char and * before address.
A world just opened up Wink I am busy with msx-c for a while, but never needed to poke around.

It's due to your cliksw declaration, it's not really defined as a memory pointer to that address Smile . There is a lot of references to memory addresses as bit JIFFY in this thread. In fact, I think that you use JIFFY, maybe? Smile

Manuel wrote:

Perhaps openMSX can be used for this, at least to capture the ROM register writes. Then convert that log into the right raw format.

Didn't thought about it, I'll give a try. Thanks for suggestion.

Van Wolverine_nl

Paragon (1159)

afbeelding van Wolverine_nl

15-09-2016, 08:58

Yes, I have JIFFY in there as well Wink

Van Wolverine_nl

Paragon (1159)

afbeelding van Wolverine_nl

25-10-2016, 12:39

Question, did anybody use structs yet in ASCII MSX-C? most works, only for some reason, like a few other things, there seems to be a linear and order importance in this, which in modern C wouldn't matter.
I use them in my project ofcourse, but now I seem to hit a wall when trying to use a struct from an included header file.

Van DarkSchneider

Paladin (942)

afbeelding van DarkSchneider

25-10-2016, 19:15

Please more details. I use structs daily. Probably the 6 characters long (symbols used by M80) needs to be used like with other symbols.

Van Wolverine_nl

Paragon (1159)

afbeelding van Wolverine_nl

25-10-2016, 20:08

no, it is when i include a file with the struct defined in the main c file and there the compiler says that when i call the struct somewhere it is undeclared, which it isn't.

Van Manuel

Ascended (18732)

afbeelding van Manuel

25-10-2016, 23:11

Create a minimal example and try again... then show here if it still gives a problem.

Van DarkSchneider

Paladin (942)

afbeelding van DarkSchneider

26-10-2016, 10:50

Try to define them with typedef:

mytype.h file:

typedef struct {
  type var1;
  type var2;
  ...
} MyType;

In the C code:

#include "mytype.h"

MyType var;

Van Wolverine_nl

Paragon (1159)

afbeelding van Wolverine_nl

26-10-2016, 10:56

DarkSchneider wrote:

Try to define them with typedef:

mytype.h file:

typedef struct {
  type var1;
  type var2;
  ...
} MyType;

In the C code:

#include "mytype.h"

MyType var;

Ok, I will try to typedef the sob Wink
I got a perfect result within the main c file, only want to keep thing neat and put it in a library.
Will let you know if it works in my code.

Van ARTRAG

Enlighted (6832)

afbeelding van ARTRAG

29-10-2016, 10:35

For the sake of comparison, this is a sample code developed for Hitech-C (cross compiler v7.8pl2) with its compiled counterpart. Look at the LST files to see the generated code.
This is the main file compiled (LINK).
Could someone try to compile it in MSX-C and post the ASM?
https://github.com/artrag/C-experiments-for-msx

Manuel, the SYM file seems not supported anymore by the last openmsx debugger.
Is this a problem of mine or a real issue in the last openmsx release?

Pagina 48/57
41 | 42 | 43 | 44 | 45 | 46 | 47 | | 49 | 50 | 51 | 52 | 53