Page 1 of 1

SGDK and MD details, limitations...

Posted: Fri Mar 15, 2019 2:33 pm
by cloudstrifer
Hi, I want to do some tutorials.

My first tutorial in Portuguese (PT-BR).
https://www.youtube.com/watch?v=6z97ZcW ... 7267296029

I need to ask some questions to improve my knowledge.

1) How many addresses do we have for variables? So can we create how many S8 variables?

2) Can I use the signed character instead of S8, is it S8 only to reduce the text?

3) Do we have a Boolean variable? Or is it useless, because it will consume the same size in Genesis memory?

Sorry for my noob questions :D

Thank you!

Re: SGDK and MD details, limitations...

Posted: Fri Mar 15, 2019 5:47 pm
by Stef
Hey :)

Did the guy in the video managed to have VStudio debugging working with SGDK ?? that would be really handy !

1) MD has 64KB of memory, so about 65000 s8 variables, but SGDK consumes a bit of it (probably about 3000 bytes)
2) signed character ? well we use s8 to store a single character as it's simpler / usual on old system like that.
3) Next SGDK version will include a 'bool' typedef but internally it's stored the same way as u8/s8;

Re: SGDK and MD details, limitations...

Posted: Fri Mar 15, 2019 5:56 pm
by cloudstrifer
Thank you.

Re: SGDK and MD details, limitations...

Posted: Sat Mar 16, 2019 8:24 am
by Mixail
Stef, When will the new version be available SGDK?

Re: SGDK and MD details, limitations...

Posted: Sat Mar 16, 2019 8:32 am
by Stef
Still working on the rescomp rewrite, i can't give any date sorry :-/ Some days i can make nice progresses then i'm interrupted for 2 weeks..
I hope to be able to deliver it before summer.
Still if you need some fixes included in the new version, you can fetch changes rom github repository, it includes library changes / fixes (but not the new rescomp tools in java)

Re: SGDK and MD details, limitations...

Posted: Sat Mar 16, 2019 8:40 am
by Mixail
Stef,Thank you for your reply.

Re: SGDK and MD details, limitations...

Posted: Sat Mar 16, 2019 2:22 pm
by Chilly Willy
Here's a tip about ram. First fact, the 68000 stack needs part of the ram. Second fact, the top 32KB of ram can be accessed using short absolute addressing for smaller/faster code. Tip: put the 68000 stack at $FF8000. Most people automatically place stacks at the top of ram segments, but if you did that on the MD, you'd lose valuable short absolute addressed ram to stack.

Re: SGDK and MD details, limitations...

Posted: Sun Mar 17, 2019 8:26 pm
by Sik
The problem with slamming the stack right in the middle of RAM is that now you have to organize more carefully where you store anything as you basically made the space non-contiguous now. The ideal thing would be to assign variables from top to bottom and then stack right below all allocated variables, but I'm not sure if existing toolchains make this easy?

Re: SGDK and MD details, limitations...

Posted: Sun Mar 17, 2019 10:36 pm
by Chilly Willy
Yeah, a variable stack start would be something you'd program into the code hardware init rather than rely on the compiler/linker. Just putting it in the middle is easy enough for a linker script. I don't think gcc has specific support for the absolute short addressing mode - you'd need to do inline assembly, or linked assembly files to take advantage of it.

Re: SGDK and MD details, limitations...

Posted: Mon Mar 18, 2019 2:32 am
by Miquel
I don't think you are going to fill 32K of global variables on a reasonable MD game. Not even close.

Commercial games use the first 32KB for the map, and then the next 32KB, taking advantage of short addressing, for the rest: buffering, global variables, character array and stack.

2) "s8" and "signed char" on practice/hardware is exactly the same.

3) booleans, usually, are not about how much they consume, but how fast they are. On all machines the fastest is the size of the word, on non-risc machines other smaller sizes can be as fast as. In any case, the space lost is always heavy since there is no "bit" compiler type.
You can always define you variable type with "typedef".
Stef wrote:
Fri Mar 15, 2019 5:47 pm
Did the guy in the video managed to have VStudio debugging working with SGDK ??
For that to be true VS should by able to output 68K code. I don't think that's coming.

Re: SGDK and MD details, limitations...

Posted: Mon Mar 18, 2019 9:02 am
by Stef
@Miquel > You can probably setup VS to use external compiler (and debugger, or just it could support GDB debugging).

Re: SGDK and MD details, limitations...

Posted: Tue Mar 19, 2019 3:47 am
by Miquel
May be... as far as I understand it is the VS process itself who talks to the Windows kernel, but perhaps there are other ways to debug, I don't know.