Page 53 of 57

Re: Sega Genesis Dev Kit (SGDK)

Posted: Wed May 15, 2019 11:49 pm
by themrcul
Thanks for your continued and great efforts Stef. I'm looking forward to getting my code base up to date with the new version you have released!

Re: Sega Genesis Dev Kit (SGDK)

Posted: Thu May 16, 2019 7:36 am
by cero
As posted in the thread before I sent zlib code in, aplib does not compress better:
viewtopic.php?f=19&t=2275

It may decompress faster, but as long as the compressor is closed source, it is unusable. I do have an unreleased project using zlib, but there's no need to keep it in just for me, since you already decided to remove it. I just want to say it's not a good idea to remove industry standard libs, on any platform having standard zlib/lz4/other libs means you get up to speed faster, without having to investigate something custom to that platform only.

You may know that I code on many platforms. I can say from experience it helps a lot that you can use standard solution X and don't have to use never-heard-of-custom-solution that requires several hours to investigate and setup.

LZ4W is probably ok, I haven't tested it since the compressor requires Java. Different goals for that anyway.

Re: Sega Genesis Dev Kit (SGDK)

Posted: Thu May 16, 2019 9:31 am
by Stef
To be honest i completely forgot about the zlib discussion we had before (i couldn't really remember from where my zlib came :D)
If it was really useful for you, i would say that you should keep it aside (the unit is 100% independent) but definitely i don't want to confuse users with that zlib unit while rescomp doesn't even support ZIP compression.
I think i studied a possible replacement of APLIB with ZLIB but the problem is that ZLIB is definitely heavier than APLIB here despite your efforts to reduce that.

Re: Sega Genesis Dev Kit (SGDK)

Posted: Fri May 17, 2019 4:40 am
by Sik
*insert shameless plug for SLZ* :​v
I mean, SLZ has a tool written in C, only uses up as much RAM as the decompressed data (and the function call :​P) and the SLZ format is documented. And on the Mega Drive side it's literally just a single function call, so it should be easy to learn. Though I should some day make a variant of the 68000-side asm code that's usable from C code in GCC (since the provided C routine is probably quite slower).

Serious question though: how much memory does zlib use? (excluding the decompressed data itself) Because I imagine that's the main factor, with there being only 64KB. If you start using up RAM for other stuff (especially anything that's a buffer) and can't reuse it, this is going to be a real problem. Speed isn't a big deal since you'd use it between two screens anyway (where display is presumably blank anyway). Just try to not waste seconds on it.

Re: Sega Genesis Dev Kit (SGDK)

Posted: Fri May 17, 2019 5:20 pm
by cero
SLZ looks very similar to LZ4 and Stef's LZ4W. The zlib code I had posted needed 4kb, but it's possible to go as low as 765 bytes, based on the 6502 asm implementation.

Re: Sega Genesis Dev Kit (SGDK)

Posted: Fri May 17, 2019 11:17 pm
by Chilly Willy
4KB is pretty low. If I had had code like that, I might have been able to work it into the Neo Myth menu, regardless of the speed issue. At the time, the code needed 32KB (or was it 64KB?), and had to be accessible as bytes. It was too big for what work ram I had, and I couldn't put it in the Neo Myth ram because it could only be accessed as words. I spent some time trying to rewrite all the byte accesses to words, but gave it up as a lost cause.

Re: Sega Genesis Dev Kit (SGDK)

Posted: Wed May 22, 2019 3:03 pm
by Yukiko

Code: Select all

 - added smart sprite cutting (detect empty space in sprite)
 - can now disable map optimization for IMAGE resources (see rescomp.txt for more information)
Yes, yes, yes! Now I get to be lazy!

Re: Sega Genesis Dev Kit (SGDK)

Posted: Thu May 23, 2019 11:44 am
by Stef
That was 2 features really important to add :D

Re: Sega Genesis Dev Kit (SGDK)

Posted: Sat May 25, 2019 10:13 pm
by cloudstrifer
Thank you for a new SGDK version.
Stef wrote:
Thu May 23, 2019 11:44 am
That was 2 features really important to add :D
Stef, is there an option to keep duplicated frames or other alternative to show 2 or 3 identical frames in a row?

frame 1 = 2 frames
frame 2 = 5 frames

Thank you!

Re: Sega Genesis Dev Kit (SGDK)

Posted: Mon May 27, 2019 2:12 pm
by Stef
What you mean is have independent timing for each animation frame right ? Yeah i plan to add that too.
SPRITE resource still need a bit of work to be fully usable (per frame timing and per frame collision box to start with)

Re: Sega Genesis Dev Kit (SGDK)

Posted: Mon Jan 20, 2020 2:29 pm
by Mixail
Found a bug version 4.1. In version 4.0. everything works.

Code: Select all

#include "genesis.h"

typedef struct {
	
	s16 testA1;
	s16 testA2;
	s16 testA3;
	s16 testA4;
	s16 testA5;
	s16 testA6;
	
	s16 testB1;
	s16 testB2;
	s16 testB3;
	s16 testB4;
	s16 testB5;
	s16 testB6;
	
	s16 testC1;
	s16 testC2;
	s16 testC3;
	s16 testC4;
	s16 testC5;
	s16 testC6;
	
	s16 testD1;
	s16 testD2;
	s16 testD3;
	s16 testD4;
	s16 testD5;
	s16 testD6;
	
	s16 test1;
	s16 test2;
	s16 test3;
	s16 test4;
	s16 test5;
	
	
	

	
} _Enemy;

_Enemy Enemy[5];
_Enemy Enemy_clear[5];

int main()
{	
	
	
    VDP_init ();
	
    Enemy[0] = Enemy_clear[0];
	
    	
}
Error:
`memcpy' referenced in section `.text.startup' of C:\Users\Lenovo\AppData\Local\Temp\ccbsiwte.ltrans2.ltrans.o: defined in discarded section `.text' of memory.o (symbol from plugin)
Work:

Code: Select all

#include "genesis.h"

typedef struct {
	
	s16 testA1;
	s16 testA2;
	s16 testA3;
	s16 testA4;
	s16 testA5;
	s16 testA6;
	
	s16 testB1;
	s16 testB2;
	s16 testB3;
	s16 testB4;
	s16 testB5;
	s16 testB6;
	
	s16 testC1;
	s16 testC2;
	s16 testC3;
	s16 testC4;
	s16 testC5;
	s16 testC6;
	
	s16 testD1;
	s16 testD2;
	s16 testD3;
	s16 testD4;
	s16 testD5;
	s16 testD6;
	
	s16 test1;
	s16 test2;
	s16 test3;
	s16 test4;
	//s16 test5;
	
	
	

	
} _Enemy;

_Enemy Enemy[5];
_Enemy Enemy_clear[5];

int main()
{	
	
	
    VDP_init ();
	
    Enemy[0] = Enemy_clear[0];
	
    	
}

Re: Sega Genesis Dev Kit (SGDK)

Posted: Mon Jan 20, 2020 11:15 pm
by Stef
Oh this one is a weird one ! i've no idea why it happen in SGDK 4.1 and not SGDK 4.0 though...
maybe related to linking ordering. I've to investigate that..
thanks for reporting :)

Re: Sega Genesis Dev Kit (SGDK)

Posted: Tue Jan 21, 2020 1:46 pm
by Chilly Willy
Sounds like an issue in the compiler more than an issue in SGDK itself. I'd look at which compilers each version uses, and if any flags to the compiler changed between versions.

Re: Sega Genesis Dev Kit (SGDK)

Posted: Wed Jan 22, 2020 6:56 pm
by Stef
Indeed, it looks like it eliminated memcpy from linking process (probably from the LTO optimization stuff) while it was required by the code.
Maybe older compiler versions weren't using memcpy to copy structure while newer versions use it when structure size is > a certain limit (which explain why the bug doesn't occur when reducing the structure size). I wonder if removing "-nostdlib" flag from linking process can help here (not sure).

Re: Sega Genesis Dev Kit (SGDK)

Posted: Wed Jan 22, 2020 10:01 pm
by Chilly Willy
If you use -nostdlib and have certain gcc things in the compiled code, you probably need to add -lgcc to the library list. The nostdlib flag makes it skip automatically using libgcc. Of course, that might be more a thing for his makefile, not SGDK in general as it will vary from project to project. I do that on most all my 32X makefiles for that very reason.