problem with osdk ?

Questions, bug reports, features requests, ... about the Oric Software Development Kit. Please indicate clearly in the title the related element (OSDK for generic questions, PictConv, FilePack, XA, Euphoric, etc...) to make it easy to locate messages.

mmu_man
Flight Lieutenant
Posts: 322
Joined: Thu Sep 21, 2006 7:45 pm
Location: 26000 Valence, FRANCE
Contact:

problem with osdk ?

Post by mmu_man »

I'm not sure what's causing it... I can't seem to declare static inline funcs, but declaring them non inline errors out because of duplicated symbol.
But the first error is strange.

Code: Select all

D:\oric\ALCHIM~2>call osdk_build
Building the program ALCH7INV at adress $600
Compiling main.C
  - preprocess
  - compile
  - convert C to assembly code
  - cleanup output
Compiling fpmath.C
  - preprocess
  - compile
  - convert C to assembly code
  - cleanup output
Linking
Assembling
 INDIRS_AD((fp),8,tmp1)
D:\oric\ALCHIM~2\main.s(56):  070d:Syntax error
 INDIRS_AD((fp),8,tmp1)
D:\oric\ALCHIM~2\main.s(183):  07d2:Label defined error
 INDIRS_AD((ap),0,tmp1)
D:\oric\ALCHIM~2\main.s(251):  0843:Label defined error
 INDIRS_AD((ap),0,tmp1)
D:\oric\ALCHIM~2\main.s(320):  08b6:Label defined error
 INDIRS_AD((ap),0,tmp1)
D:\oric\ALCHIM~2\main.s(388):  0927:Label defined error
 INDIRS_AD((fp),8,tmp1)
D:\oric\ALCHIM~2\main.s(488):  09ce:Label defined error
 INDIRS_AD((ap),0,tmp1)
See http://revolf.free.fr/oric/alchimie7.zip

Btw, it doesn't seem to like union of structs very well (refuses some casts).
User avatar
Chema
Game master
Posts: 3019
Joined: Tue Jan 17, 2006 10:55 am
Location: Gijón, SPAIN
Contact:

Post by Chema »

Not sure, but IIRC the compiler first generates a pseudocode that is then translated to 6502 asm. This pseudocode is not 8-bit among other things and this is the main reason why the compiler generates so much and so fat code.

That process was done (at least in the past) with preprocessor directives (simple #defines) that reside in the macros.h file.

The problem seems (to me) that there is not a directive for INDIRS_AD.

Checking the file I found several INDIR*_* entries, but not INDIRS_AD. The asm generated file contains those instructions without being translated to asm, which (of course) generate errors.

Not sure why there are some of these left, but in old versions of the compiler I found similar problems, which were corrected in OSDK.

Nothing very useful, I'm afraid... It is Dbug who should try to fix this...

Regards,

EDIT:

Can I guess that the S stands for short, so the entry could be the same as INDIRW_AD which is:

Code: Select all

#define INDIRW_AD(ptr1,y1,tmp2)\
	ldy #y1 ;\
	lda ptr1,y ;\
	sta tmp2 ;\
	iny ;\
	lda ptr1,y ;\
	sta tmp2+1 ;\
maybe worth a try until some expert clears this up?
User avatar
Chema
Game master
Posts: 3019
Joined: Tue Jan 17, 2006 10:55 am
Location: Gijón, SPAIN
Contact:

Post by Chema »

BTW tried the above trick, but could not see if it works or not, as the compiler hangs at the linking step... (just prints Linking and hangs :?)

This seems more grave to me, as it seems it does not like your fpmath.c (fpmath_8_8.h or any other of those?) file. If one defines NOFPMATH it compiles with no error.

On a side note, if you are looking for fast and small code, may I suggest you think about making those math functions in asm and call them from within C?

Not sure, but if they are just things like sin or cos multiplications and divisions, you can have very simple and efficient 6502 code!

Cheers
User avatar
Dbug
Site Admin
Posts: 4459
Joined: Fri Jan 06, 2006 10:00 pm
Location: Oslo, Norway
Contact:

Re: problem with osdk ?

Post by Dbug »

mmu_man wrote:I'm not sure what's causing it... I can't seem to declare static inline funcs, but declaring them non inline errors out because of duplicated symbol.
"inline" is not an ANSI C concept (for what I know), but static functions are, so a static function in a .C file should work.
If it does not, I guess I will have to fix that.
mmu_man wrote:But the first error is strange.

Code: Select all

D:\oric\ALCHIM~2>call osdk_build
Building the program ALCH7INV at adress $600
Compiling main.C
  - preprocess
  - compile
  - convert C to assembly code
  - cleanup output
Compiling fpmath.C
  - preprocess
  - compile
  - convert C to assembly code
  - cleanup output
Linking
Assembling
 INDIRS_AD((fp),8,tmp1)
D:\oric\ALCHIM~2\main.s(56):  070d:Syntax error
 INDIRS_AD((fp),8,tmp1)
D:\oric\ALCHIM~2\main.s(183):  07d2:Label defined error
 INDIRS_AD((ap),0,tmp1)
D:\oric\ALCHIM~2\main.s(251):  0843:Label defined error
 INDIRS_AD((ap),0,tmp1)
D:\oric\ALCHIM~2\main.s(320):  08b6:Label defined error
 INDIRS_AD((ap),0,tmp1)
D:\oric\ALCHIM~2\main.s(388):  0927:Label defined error
 INDIRS_AD((fp),8,tmp1)
D:\oric\ALCHIM~2\main.s(488):  09ce:Label defined error
 INDIRS_AD((ap),0,tmp1)
See http://revolf.free.fr/oric/alchimie7.zip

Btw, it doesn't seem to like union of structs very well (refuses some casts).
A missing macro, I guess I would need to look at the documentation to see what each of these is doing.

Hard to fix in the current state, I have the internet connection on my linux laptop, the main pc is not in working state... grrrr
mmu_man
Flight Lieutenant
Posts: 322
Joined: Thu Sep 21, 2006 7:45 pm
Location: 26000 Valence, FRANCE
Contact:

Post by mmu_man »

I should probably make sure I have the latest osdk...
I'd really like to have an invitro for Alchimie 7 before Alchimie 7 ;)
mmu_man
Flight Lieutenant
Posts: 322
Joined: Thu Sep 21, 2006 7:45 pm
Location: 26000 Valence, FRANCE
Contact:

Post by mmu_man »

I actually had 0.015. Updated to 0.016, but not opt65 busy-loops and takes all the cpu :-(
mmu_man
Flight Lieutenant
Posts: 322
Joined: Thu Sep 21, 2006 7:45 pm
Location: 26000 Valence, FRANCE
Contact:

Post by mmu_man »

Chema wrote:BTW tried the above trick, but could not see if it works or not, as the compiler hangs at the linking step... (just prints Linking and hangs :?)
Yes it happens with 0.016 here too.
On a side note, if you are looking for fast and small code, may I suggest you think about making those math functions in asm and call them from within C?
Because it comes from my Ti92 invitro, and I wanted to try without asm, to keep it portable.
mmu_man
Flight Lieutenant
Posts: 322
Joined: Thu Sep 21, 2006 7:45 pm
Location: 26000 Valence, FRANCE
Contact:

Post by mmu_man »

I'll be trying to simplify the fpfloat code, will see.
Btw, which preprocessor defines does osdk give ?
I recall finding some __ATMOS__ around, no __ORIC__ or __6502__ ?
mmu_man
Flight Lieutenant
Posts: 322
Joined: Thu Sep 21, 2006 7:45 pm
Location: 26000 Valence, FRANCE
Contact:

Post by mmu_man »

Hmm, now I get trouble with extern...
I have in the header:
extern fpfloat __fp_sin_table[COSSIN_TABLE_SZ];
extern fpfloat *__fp_cos_table;

and in fpmath.c:
fpfloat __fp_sin_table[COSSIN_TABLE_SZ];
fpfloat *__fp_cos_table = &__fp_sin_table[COS_TABLE_SZ/4];

And I get:
fpmath.c(11): redeclaration of `__fp_sin_table' previously declared at fpmath_8_8.h(41)
mmu_man
Flight Lieutenant
Posts: 322
Joined: Thu Sep 21, 2006 7:45 pm
Location: 26000 Valence, FRANCE
Contact:

Post by mmu_man »

Worked around it but it shouldn't happen :)
User avatar
Dbug
Site Admin
Posts: 4459
Joined: Fri Jan 06, 2006 10:00 pm
Location: Oslo, Norway
Contact:

Post by Dbug »

Sure, but you are not supposed to use any identifier in C starting by a double underscore. It's reserved to the compiler implementation.

Looks like I will need to publish the source code of the whole package earlier than planned :)
mmu_man
Flight Lieutenant
Posts: 322
Joined: Thu Sep 21, 2006 7:45 pm
Location: 26000 Valence, FRANCE
Contact:

Post by mmu_man »

Sorry to find bugs :O
Btw, I tried using memset() but it didn't seem to work, wrote my own, didn't work either, until I switched the value from unsigned char to unsigned int:

Code: Select all

void mymemset(void *p, unsigned int to, int len)
{
  unsigned char *ptr = p;
  while(len--) {
    *ptr++ = to;
  }
}
hires();
memset((void*)0xa0000,146,10);
works, but not with unsigned char to.
mmu_man
Flight Lieutenant
Posts: 322
Joined: Thu Sep 21, 2006 7:45 pm
Location: 26000 Valence, FRANCE
Contact:

Post by mmu_man »

Ugh, oh, I get a failed ASSERT(sizeof(int16)==2)... something definitely fishy!
I don't think I pass any option that would make that happen...
User avatar
Dbug
Site Admin
Posts: 4459
Joined: Fri Jan 06, 2006 10:00 pm
Location: Oslo, Norway
Contact:

Post by Dbug »

mmu_man wrote:Ugh, oh, I get a failed ASSERT(sizeof(int16)==2)... something definitely fishy!
I don't think I pass any option that would make that happen...
How is defined your "int16" ?

By default in the osdk we have:
char=8 bits
short=int=long=16 bits
float=36 bits (5 bytes internal BASIC ROM format)
mmu_man
Flight Lieutenant
Posts: 322
Joined: Thu Sep 21, 2006 7:45 pm
Location: 26000 Valence, FRANCE
Contact:

Post by mmu_man »

Code: Select all

typedef signed int int16;
but it didn't work.
if I use

Code: Select all

typedef signed long int int16;
it does.
Oddly uint16 doesn't have the problem.
It's the same reason memset() doesn't work I suppose, it takes the int as signed char (hmm houldn't it work anyway ??).
Post Reply