Gameboy Development Forum

Discussion about software development for the old-school Gameboys, ranging from the "Gray brick" to Gameboy Color
(Launched in 2008)

You are not logged in.

Ads

#1 2025-08-13 23:58:38

esuard
New member
Registered: 2025-08-05
Posts: 1

[Beginner - asm] How to organize data

Hello everyone, I hope my questions will not seems stupid to you.
I’m having a hard time figuring out how to organize my game datas, projectwise and codewise.

Projectwise :
What is the good way of regrouping code ? Is there an equivalent to .h/.c ?

Codewise :
Say I want a player with a backpack, if I define something like

rsreset
def B_WEIGHT     rb 1
def B_ITEMS_N    rb 1
.
.
def sizeof_BACKPACK rb 0


def P_LIFE            rb 1
def P_X                rb 1
def P_Y                rb 1
def P_BACKPACK  rb sizeof_BACKPACK
def sizeof_PLAYER rb 0


I think I can access values by doing something like [wPLAYER + P_BACKPACK + B_WEIGHT], but is this the good way of doing things ? What if there is more and more data layers accumulating ?


I’m sorry, you can say I just have to read code but, not knowing assembly that much, I’m not sure where to look at.
If you know some open sources with admitted good practices i’m more than willing to learn from it.


Thanks for your reading and sorry for the silly questions

Offline

 

#2 2025-09-01 20:44:29

damnian2508
New member
Registered: 2025-06-19
Posts: 1

Re: [Beginner - asm] How to organize data

I guess I'm necroposting here, but here's my take.

.inc and .asm are the equivalents to .h and .c, respectively.

As for ASM style guide, I think this is a pretty good one:

https://gbdev.io/guides/asmstyle.html

Offline

 

Board footer

Powered by PunBB
© Copyright 2002–2005 Rickard Andersson