Sega Genesis Dev Kit (SGDK)

SGDK only sub forum

Moderator: Stef

themrcul
Very interested
Posts: 119
Joined: Fri Apr 15, 2016 2:21 pm

Re: Sega Genesis Dev Kit (SGDK)

Post by themrcul » Wed May 15, 2019 11:49 pm

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!

cero
Very interested
Posts: 340
Joined: Mon Nov 30, 2015 1:55 pm

Re: Sega Genesis Dev Kit (SGDK)

Post by cero » Thu May 16, 2019 7:36 am

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.

Stef
Very interested
Posts: 3131
Joined: Thu Nov 30, 2006 9:46 pm
Location: France - Sevres
Contact:

Re: Sega Genesis Dev Kit (SGDK)

Post by Stef » Thu May 16, 2019 9:31 am

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.

Sik
Very interested
Posts: 939
Joined: Thu Apr 10, 2008 3:03 pm
Contact:

Re: Sega Genesis Dev Kit (SGDK)

Post by Sik » Fri May 17, 2019 4:40 am

*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.
Sik is pronounced as "seek", not as "sick".

cero
Very interested
Posts: 340
Joined: Mon Nov 30, 2015 1:55 pm

Re: Sega Genesis Dev Kit (SGDK)

Post by cero » Fri May 17, 2019 5:20 pm

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.

Chilly Willy
Very interested
Posts: 2984
Joined: Fri Aug 17, 2007 9:33 pm

Re: Sega Genesis Dev Kit (SGDK)

Post by Chilly Willy » Fri May 17, 2019 11:17 pm

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.

Yukiko
Interested
Posts: 14
Joined: Sat Nov 18, 2017 9:33 am

Re: Sega Genesis Dev Kit (SGDK)

Post by Yukiko » Wed May 22, 2019 3:03 pm

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!

Stef
Very interested
Posts: 3131
Joined: Thu Nov 30, 2006 9:46 pm
Location: France - Sevres
Contact:

Re: Sega Genesis Dev Kit (SGDK)

Post by Stef » Thu May 23, 2019 11:44 am

That was 2 features really important to add :D

cloudstrifer
Very interested
Posts: 118
Joined: Mon Feb 19, 2018 7:31 pm

Re: Sega Genesis Dev Kit (SGDK)

Post by cloudstrifer » Sat May 25, 2019 10:13 pm

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!

Stef
Very interested
Posts: 3131
Joined: Thu Nov 30, 2006 9:46 pm
Location: France - Sevres
Contact:

Re: Sega Genesis Dev Kit (SGDK)

Post by Stef » Mon May 27, 2019 2:12 pm

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)

Mixail
Very interested
Posts: 133
Joined: Thu Nov 18, 2010 4:47 pm

Re: Sega Genesis Dev Kit (SGDK)

Post by Mixail » Mon Jan 20, 2020 2:29 pm

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];
	
    	
}

Stef
Very interested
Posts: 3131
Joined: Thu Nov 30, 2006 9:46 pm
Location: France - Sevres
Contact:

Re: Sega Genesis Dev Kit (SGDK)

Post by Stef » Mon Jan 20, 2020 11:15 pm

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 :)

Chilly Willy
Very interested
Posts: 2984
Joined: Fri Aug 17, 2007 9:33 pm

Re: Sega Genesis Dev Kit (SGDK)

Post by Chilly Willy » Tue Jan 21, 2020 1:46 pm

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.

Stef
Very interested
Posts: 3131
Joined: Thu Nov 30, 2006 9:46 pm
Location: France - Sevres
Contact:

Re: Sega Genesis Dev Kit (SGDK)

Post by Stef » Wed Jan 22, 2020 6:56 pm

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).

Chilly Willy
Very interested
Posts: 2984
Joined: Fri Aug 17, 2007 9:33 pm

Re: Sega Genesis Dev Kit (SGDK)

Post by Chilly Willy » Wed Jan 22, 2020 10:01 pm

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.

Post Reply