SGDK and MD details, limitations...

SGDK only sub forum

Moderator: Stef

Post Reply
User avatar
cloudstrifer
Interested
Posts: 46
Joined: Mon Feb 19, 2018 7:31 pm

SGDK and MD details, limitations...

Post by cloudstrifer » Fri Mar 15, 2019 2:33 pm

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!

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

Re: SGDK and MD details, limitations...

Post by Stef » Fri Mar 15, 2019 5:47 pm

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;

User avatar
cloudstrifer
Interested
Posts: 46
Joined: Mon Feb 19, 2018 7:31 pm

Re: SGDK and MD details, limitations...

Post by cloudstrifer » Fri Mar 15, 2019 5:56 pm

Thank you.

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

Re: SGDK and MD details, limitations...

Post by Mixail » Sat Mar 16, 2019 8:24 am

Stef, When will the new version be available SGDK?

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

Re: SGDK and MD details, limitations...

Post by Stef » Sat Mar 16, 2019 8:32 am

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)

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

Re: SGDK and MD details, limitations...

Post by Mixail » Sat Mar 16, 2019 8:40 am

Stef,Thank you for your reply.

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

Re: SGDK and MD details, limitations...

Post by Chilly Willy » Sat Mar 16, 2019 2:22 pm

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.

User avatar
Sik
Very interested
Posts: 830
Joined: Thu Apr 10, 2008 3:03 pm
Contact:

Re: SGDK and MD details, limitations...

Post by Sik » Sun Mar 17, 2019 8:26 pm

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

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

Re: SGDK and MD details, limitations...

Post by Chilly Willy » Sun Mar 17, 2019 10:36 pm

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.

User avatar
Miquel
Very interested
Posts: 432
Joined: Sat Jul 30, 2016 12:33 am

Re: SGDK and MD details, limitations...

Post by Miquel » Mon Mar 18, 2019 2:32 am

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.

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

Re: SGDK and MD details, limitations...

Post by Stef » Mon Mar 18, 2019 9:02 am

@Miquel > You can probably setup VS to use external compiler (and debugger, or just it could support GDB debugging).

User avatar
Miquel
Very interested
Posts: 432
Joined: Sat Jul 30, 2016 12:33 am

Re: SGDK and MD details, limitations...

Post by Miquel » Tue Mar 19, 2019 3:47 am

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.

Post Reply

Who is online

Users browsing this forum: No registered users and 3 guests