A newbie's code evaluation

Are you new to 6502, NES, or even programming in general? Post any of your questions here. Remember - the only dumb question is the question that remains unasked.

Moderator: Moderators

User avatar
tokumaru
Posts: 12041
Joined: Sat Feb 12, 2005 9:43 pm
Location: Rio de Janeiro - Brazil

Re: A newbie's code evaluation

Post by tokumaru » Wed Mar 10, 2021 8:27 pm

zanto wrote:
Wed Mar 10, 2021 7:33 pm
But if I allow entities to have more than one block, wouldn't that also create the fragmentation issue you mentioned before? Only instead of being in terms of bytes, it's blocks?
It won't cause fragmentation if the blocks don't need to be adjacent in memory... That's why you have to keep references to the extra blocks, the extended memory could be in any block, not necessarily in the next one. Admittedly, that would be a little annoying to manage, as you'd have to switch indices to access properties stored in different slots.
But rather than just following some sort of rule, I like to know why it works better, so I can it more effectively or even adapt it if the need arises.
That's cool, it's okay to question the way things are done. If you feel like implementing two pools of objects separated by complexity, that's a valid approach, and the most sensible option among the ones discussed here.

User avatar
DRW
Posts: 2070
Joined: Sat Sep 07, 2013 2:59 pm

Re: A newbie's code evaluation

Post by DRW » Thu Mar 11, 2021 1:01 am

zanto wrote:
Wed Mar 10, 2021 7:33 pm
But if I allow entities to have more than one block, wouldn't that also create the fragmentation issue you mentioned before? Only instead of being in terms of bytes, it's blocks?
That's why I said: Use a chunk of global, always existing variables. There, you cannot have any fragmentation.
Or do you mean something different?
What do you think about the attempt that I showed you in my previous post, where several entity types that their own arrays?
My game "City Trouble": www.denny-r-walter.de/city.htm

unregistered
Posts: 1143
Joined: Thu Apr 23, 2009 11:21 pm
Location: cypress, texas

Re: A newbie's code evaluation

Post by unregistered » Thu Mar 11, 2021 10:37 am

Quietust wrote:
Wed Mar 10, 2021 10:14 am
turboxray wrote:
Wed Mar 10, 2021 10:01 am
Quietust wrote:
Wed Mar 10, 2021 9:52 am
To be clear, there are scenarios in which you would want to use TXS like that, but those scenarios are extremely specific and so rare as to be effectively non-applicable to NES development.
I thought that was kinda evident though. But practically non-applicable and never applicable are not the same thing. It's also a good mental exercise to think of solutions outside the box, if you care about performance or pushing the system. But calling it insane is just ignorant.
Keep in mind that this is the "Newbie Help Center" forum, and any advanced coding techniques that involve the usage of the stack pointer as a general-purpose register are all but guaranteed to be wholly inappropriate for newbies, so there's little point in discussing them here, much less actively recommending their use.
Hmmm... Quietust, I purposely refrained from recommending use of txs. However, my post was a shedding of light into DRW’s claim that there are only 3 registers and pha and pla.
DRW wrote:
Mon Mar 08, 2021 6:22 pm
Sure, it's a bit less efficient, but what do you want to do if you have only two registers, but three or more loop dimensions?
(^That quote is not currently being responded to.)


I did say, “feel free to use” txs, but, in my opinion at least, that is completely shy of a recommendation. :) A lot Some of this community seems to forcefully dump newbies in a dumb box, chain that box, feed them untruthful info, and only allow that restrictive box to be opened after the “newbie” has wholeheartedly proven themselves. :(


Sorry, for this late response. Was away from nesdev forum for a few days.

User avatar
zanto
Posts: 57
Joined: Sun Mar 07, 2021 11:15 pm
Location: Rio de Janeiro, Brazil

Re: A newbie's code evaluation

Post by zanto » Thu Mar 11, 2021 1:48 pm

DRW wrote:
Thu Mar 11, 2021 1:01 am
That's why I said: Use a chunk of global, always existing variables. There, you cannot have any fragmentation.
Or do you mean something different?
What do you think about the attempt that I showed you in my previous post, where several entity types that their own arrays?
After understanding why that approach is better than my own, I'm rewriting my code do implement it. To be honest, I'm almost replacing the entire thing with the new approach. :P

Post Reply