Sega Genesis Dev Kit (SGDK)

SGDK only sub forum

Moderator: Stef

nemezes
Very interested
Posts: 58
Joined: Sat Mar 31, 2018 1:09 pm

Re: Sega Genesis Dev Kit (SGDK)

Post by nemezes » Thu Jul 12, 2018 1:37 pm

Stef wrote:
Tue Jan 16, 2018 1:00 pm
To release some VRAM in the tilemap allocation.
Megadrive allow 32x32, 32x64, 64x32 (default since SGDK 1.31), 64x64 (defaut in SGDK < 1.31), 128x32, 32x128 tilemap size
But almost time 64x32 is enough to do whatever you want and allow to store more tile data in VRAM =)
Of course you can change the VRAM setup if you want =)
I had this same doubt.. I thought the screen virtual area 64x64 was standard for mega drive.

Nice to know about it. :)

Munkyears
Very interested
Posts: 51
Joined: Sat Mar 21, 2009 4:24 pm
Location: Sheffield, England

Re: Sega Genesis Dev Kit (SGDK)

Post by Munkyears » Thu Jan 31, 2019 1:32 am

Hi Stef!!

Random question but have you any plans to incorporate bank switching within SGDK??

Would be mighty helpful!!

Glad to see you are still active!!

Joe
To be this good takes ages, To be this good takes Stef, Kanedafr, ChillyWilly & everyone who has helped me discover what hardwork is!

Dive into the SpritesMind! :)

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

Re: Sega Genesis Dev Kit (SGDK)

Post by Stef » Thu Jan 31, 2019 12:29 pm

Hey :)
Of course i'm still alive ^^ Busy but alive ;)
Adding bank switching isn't something i can really do much for it. I can eventually to register get/set operation to change the bank but except that i do not see how i can work out easily bank switching part with the compiler. It's more something you need to do manually.

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

Re: Sega Genesis Dev Kit (SGDK)

Post by Sik » Fri Feb 01, 2019 5:47 pm

Well, later consoles (and some DOS programs :​v) would resort to "overlays" which are chunks of code that can be loaded and unloaded as needed… I suppose that bank switching support on SGDK would require a scheme like that. And yes, this is something that needs help from the linker (to put data in overlapping regions).

It's doable, but also a pain in the ass.
Sik is pronounced as "seek", not as "sick".

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

Re: Sega Genesis Dev Kit (SGDK)

Post by Mixail » Thu Feb 28, 2019 11:43 am

Does SGDK have an analogue of the memcmp () function?

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

Re: Sega Genesis Dev Kit (SGDK)

Post by Stef » Thu Feb 28, 2019 12:08 pm

Nope, i think it's the first time somebody ask for it ^^
Could be added but you will definitely be faster do it yourself for now ;)

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

Re: Sega Genesis Dev Kit (SGDK)

Post by cero » Thu Feb 28, 2019 6:44 pm

The Linux version of SGDK includes newlib, meaning standard funcs like memcmp are available there.

danibus
Very interested
Posts: 72
Joined: Sat Feb 03, 2018 12:41 pm

Re: Sega Genesis Dev Kit (SGDK)

Post by danibus » Thu Mar 21, 2019 3:42 pm

Just a question about "Sample/Sprite" example in SGDK

Why using

Code: Select all

fix32 enemyPosx[2];
to represent sprite TV position?

I mean, if megadrive only have 0 to 512 pixels, and only from 128 to 128+320px are visible (0 to 320px in SGDK), why using fix32??
Why not using fix16?

Can I use int to check position? Or do I have to check hex numbers instead?

I'm playing with u16, u32, etc for position and don't know how to proceed if one "enemy" exit TV (from right to left) and then appears again in right part... I'm using kdebug to check position but after going left part, position = 0, appears in right part and then position = FFFF.... :?:

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

Re: Sega Genesis Dev Kit (SGDK)

Post by Stef » Fri Mar 22, 2019 10:02 am

fix16 could be enough if you enable your sprite position only when you want to display, but for convenience sometime you need to retain the sprite position even when it's off screen (not too far but still off screen) in which case fix16 can be limiting (fix16 range is limited to -[512.0 to to 511.0]).
Also for very low acceleration / speed, fix32 can be useful (but to be honest fix16 should be enough in 99% of case here).

Also iIt's always better to use signed values for sprite position as definitely your sprite can be in negative position relative to the screen to don't use u16 or u32 for that (you know that you can convert fix16 to signed integer right ?)

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

Re: Sega Genesis Dev Kit (SGDK)

Post by Stef » Tue May 14, 2019 2:20 pm

Updated SGDK to version 1.4 ! Check it out here :
https://github.com/Stephane-D/SGDK/wiki/Download

Full changelog

Code: Select all

COMPILER
* RESCOMP
 - rewrote from scratch in java for easier evolution and easy multi OS support.
 - added smart sprite cutting (detect empty space in sprite)
 - many changes on SPRITE resource, don't forget to read the rescomp.txt file to see changes about this resource.
 - can now disable map optimization for IMAGE resources (see rescomp.txt for more information)
* LZ4W
 - added code sources (java)
 - fixed compression using previous data block in ROM (updated packer to version 1.4)
* BINTOS
 - fixed a stupid bug on path.
* added XGM ROM builder tool sources.
* removed RESCOMP (C version), WAVTORAW, TFMCOM and Z80DASM tools.
* added Visual Studio template.

LIBRARY
* SYS
 - added SYS_setVIntAligned(..) method to force V-Int callback to align process on VBlank.
   IMPORTANT: by default now SGDK *does* align the V-Int processing to VBlank so you need to disable it if you don't want it !
 - added SYS_getCPULoad() to return CPU load estimation.
 - added SYS_resetMissedFrames() / SYS_getMissedFrames() methods.
* DMA
 - simplified DMA over capacity strategy
 - minor change in debug log message
* SPRITE
 - renamed SPR_init(..) to SPR_initEx(..) so now SPR_init() doesn't require any parameters by default.
 - removed 'maxSprite' parameter from Sprite Engine initialization (alays use max available).
 - added delayed frame update support.
 - added SPR_FLAG_DISABLE_DELAYED_FRAME_UPDATE flag to disable the delayed frame update (when we are running out of DMA capacity).
 - added SPR_setDelayedFrameUpdate() to change the delayed frame update state for a sprite.
 - added SPR_FLAG_INSERT_HEAD flag to allow adding new sprite in first position (instead of last position by default)
 - added SPR_defragVRAM() method to force VRAM defragmentation
 - added SPR_addSpriteSafe(..) and SPR_addSpriteExSafe(..) methods (automatically do VRAM defrag if needed)
 - fixed a bug where the last VDP sprite attribute weren't always correctly updated with visibility set to AUTO_SLOW.
 - fixed a bug a sprite couldn't be allocated.
 - fixed sprite visibility state when the number of used sprite changed.
 - many changes to sprite structures (better handling of flip info, better ROM usage...)
* VDP 
 - added VDP_showCPULoad() method to display CPU load
 - added VDP_waitVInt() method to wait until next VInt to happen.
 - removed 'waitvsync' parameter for VDP_initFading(..) and VDP_doStepFading(..) methods (we always want VSync here)
 - simplified / tweaked macros for VDP control writes
* VRAM
 - added VRAM_getAllocated(..) and VRAM_getLargestFreeBlock(..) methods
* TYPE
 - added bool type
 - replaced u16 by bool where it needs to be
* MATHS
 - updated fix32Mul() and fix32Div() definition (again, trying to find the best compromize)
 - added new missing structures as Vect2D_f32, Mat2D_f32, Vect3D_xx...
 - added f16 and f32 as shorcut of fix16 and fix32 types.
 - added short typedefs (V2u16 = Vect2D_u16, V2f32 = Vect2D_f32, M2f16 = Mat2D_f16, M3f32 = Mat3D_f32)
* PALETTE
 - removed index field from Palette structure
* JOY
 - added checking for mouse / multipad read operation to avoid timeout operation when mouse or multipad is not present.
* Z80
 - added volatile access for safety
* TIMER
 - improved waitMs(..) method to be more accurate on small wait.
 - tweaked getSubTick() method (need testing, possible regression)
* STRING
 - fixed and optimized uintToStr() method
* TOOL
 - memory allocation methods for unpacking now always use deep allocation regardless of the compression used (simpler and less bug prone)
 - fixed LZ4W decompression using previous data block
* fixed variable initialization (last byte was not always properly initialized)
* added HALT_Z80_ON_IO define (config.h) to force Z80 halt on IO port access.
* new awesome SGDK logo (Thanks a tons to Lizardrive for making it !)
* removed useless sound drivers (MVS, TFM and VGM)
* removed old TILE_CACHE unit (replaced by VRAM unit)
* removed useless zlib 
* many refactoring (sorry for that, you will need to update your old code)
* many tweaks / cleanup

SAMPLE
* updated all samples to take care of last changes made in SGDK
* BENCHMARK
 - tweaked big sprite test to disable the delayed sprite update (new sprite engine feature)
 - fixed sheet size (new rescomp don't allow it)

danibus
Very interested
Posts: 72
Joined: Sat Feb 03, 2018 12:41 pm

Re: Sega Genesis Dev Kit (SGDK)

Post by danibus » Tue May 14, 2019 2:38 pm

Nice, thanks for your efforts

bioloid
Very interested
Posts: 140
Joined: Fri May 18, 2012 8:22 pm

Re: Sega Genesis Dev Kit (SGDK)

Post by bioloid » Tue May 14, 2019 5:05 pm

awesome thanks

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

Re: Sega Genesis Dev Kit (SGDK)

Post by cero » Wed May 15, 2019 6:42 am

I disagree with much of the new direction. I will not pollute my computer with Java. Waiting for another frame in case of a slightly delayed frame will cause jitter for little gain. Zlib is an industry standard, and keeping it would cost nothing.

Thus I will keep using an older version, and probably merge any useful parts manually.

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

Re: Sega Genesis Dev Kit (SGDK)

Post by Stef » Wed May 15, 2019 9:44 am

Sorry to heard that cero... free feel to stay on old SGDK but you will miss some nice additions from the last SGDK.
I can understand that you don't want to "pollute" your computer with Java but honestly there is no way to develop rescomp in C as fast (and make it as powerful) as i can do it with Java.
Also Java offers easy multi platform, you don't need to recompile for OSX or Linux, another thing is that Java is almost always embed in system now (OpenJDK is often installed on linux as well OSX often contains a default JVM, only Windows platform doesn't have it by default).

Code: Select all

Waiting for another frame in case of a slightly delayed frame will cause jitter for little gain
This is the opposite. Delayed update (happen when you're running out of DMA capacity) is a way to avoid glitches. Now that sprite cutting operation is optimized, you can have 2 consecutive frames of animation using different hard sprites (that wasn't the case before), because of that you can have glitches appearing if hard sprites and tiles data aren't properly synchronized (something that can happen when you run over DMA capacity).
Also the "delayed update" is something you can disable but you likely want to let it enabled (default behavior) in general.
Zlib is just useless considering Megadrive development, do you were using it ? I didn't see any single Megadrive game relaying on it. APLIB compress better and LZ4W decompress much faster so i don't see the point of keeping it. We are on a Sega Megadrive, not on a PC :-/

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

Re: Sega Genesis Dev Kit (SGDK)

Post by Chilly Willy » Wed May 15, 2019 2:39 pm

Take it from me - zlib is worthless on the MD. I tried to use it with the NeoMyth menu as many rom images are compressed, but it's ultra slow and uses way too much ram to decompress.

As to java... could be worse. He could be using C#. :x :lol:

Post Reply