The "backwards compatibility" has its limits... for controllers, there is now a mask you should use for just the buttons - use (val & BUTTON_ALL) instead of plain old (val). If you force the support for pads to three button pad mode (for example, JOY_setSupport(PORT_1, JOY_SUPPORT_3BTN); ), then you'll have complete backwards compatibility since the TYPE for 3 button pads is 0.KanedaFr wrote:little bug on the joy support :
readJoypad return joy state and type
unfortunatly type is also used when it calls joyEventCB
so change is not 0 when released but type << 12 ...
I would prefer to keep the initial mode : 0 for release, button for press
Sega Genesis Dev Kit (SGDK)
Moderator: Stef
-
- Very interested
- Posts: 2993
- Joined: Fri Aug 17, 2007 9:33 pm
-
- Very interested
- Posts: 3131
- Joined: Thu Nov 30, 2006 9:46 pm
- Location: France - Sevres
- Contact:
Well that is not a big deal anyway, i separated type and state because i think it is less confusing this way too 
Now we have :
which return type for the specified joypad and the readJoypadState(..) does not return anymore joypad type in high nibble.

Now we have :
Code: Select all
u8 JOY_getJoypadType(u16 joy);
-
- Very interested
- Posts: 2993
- Joined: Fri Aug 17, 2007 9:33 pm
-
- Very interested
- Posts: 710
- Joined: Sat Feb 18, 2012 2:44 am
I'm seeing what looks like to be a bug with fastMemsetU16.
Output (values are in hexidecimal):
switching to memsetU16 gives the correct output:
I kept wondering why my coins were all screwed up 
DJCC
Code: Select all
#define MAX_COINS_IN_LEVEL 256
u16 coinMap[MAX_COINS_IN_LEVEL];
fastMemsetU16((u16*)coinMap, 1, MAX_COINS_IN_LEVEL);
PrintNumber(coinMap[0]); // helper printing function
PrintNumber(coinMap[1]);
PrintNumber(coinMap[2]);
Code: Select all
Message : 00000001
Message : 00000101
Message : 00000101
switching to memsetU16 gives the correct output:
Code: Select all
Message : 00000001
Message : 00000001
Message : 00000001

DJCC
-
- Very interested
- Posts: 2993
- Joined: Fri Aug 17, 2007 9:33 pm
Change line 347 of memory.c from
to
Code: Select all
value32 = cnv_8to32_tab[value];
Code: Select all
asm("move.w %0,%1\n\t"
"swap %1\n\t"
"move.w %0,%1\n"
: "=d" (value), "=d" (value32) : : "cc" );
-
- Very interested
- Posts: 710
- Joined: Sat Feb 18, 2012 2:44 am
Tried it out and now it's giving me:
Code: Select all
Message : 00000001
Message : 00000000
Message : 00000000
-
- Very interested
- Posts: 2993
- Joined: Fri Aug 17, 2007 9:33 pm
A first word can be written by itself for odd word addresses, then it tries writing longs. So it seems like the asm isn't working... okay, try this:
Had value as an output register, which was probably the problem.
Code: Select all
asm("move.w %1,%0\n\t"
"swap %0\n\t"
"move.w %1,%0\n"
: "=d" (value32) : "=d" (value) : "cc" );
-
- Very interested
- Posts: 710
- Joined: Sat Feb 18, 2012 2:44 am
-
- Very interested
- Posts: 2993
- Joined: Fri Aug 17, 2007 9:33 pm
-
- Very interested
- Posts: 710
- Joined: Sat Feb 18, 2012 2:44 am
-
- Very interested
- Posts: 2993
- Joined: Fri Aug 17, 2007 9:33 pm
-
- Very interested
- Posts: 3131
- Joined: Thu Nov 30, 2006 9:46 pm
- Location: France - Sevres
- Contact:
Very stupid bug, to keep all C you just need to change the
by
but asm part is faster as you can use the swap instruction.
Code: Select all
value32 = cnv_8to32_tab[value];
by
Code: Select all
value32 = (value << 16) | value;
but asm part is faster as you can use the swap instruction.
-
- Very interested
- Posts: 2993
- Joined: Fri Aug 17, 2007 9:33 pm
I was fairly certain << 16 wasn't going to use swap, which is why I recommended the asm. If it didn't use swap, it wouldn't be "fast" at that point, and it was supposed to be the fast version of the routine.Stef wrote:Very stupid bug, to keep all C you just need to change theCode: Select all
value32 = cnv_8to32_tab[value];
byCode: Select all
value32 = (value << 16) | value;
but asm part is faster as you can use the swap instruction.
-
- Very interested
- Posts: 3131
- Joined: Thu Nov 30, 2006 9:46 pm
- Location: France - Sevres
- Contact:
Hehe is was sure that it wouldn't too but in fact it does use the swap instruction ! But the rest of the code is really not the best we can do so i finally rewrote all these methods in pure asm.Chilly Willy wrote: I was fairly certain << 16 wasn't going to use swap, which is why I recommended the asm. If it didn't use swap, it wouldn't be "fast" at that point, and it was supposed to be the fast version of the routine.
I made fastxxx deprecated as now the normal memset and memcpy methods use fast asm code now

Last edited by Stef on Mon Sep 24, 2012 2:14 pm, edited 1 time in total.