pret / pokeyellow

Disassembly of Pokemon Yellow
697 stars 260 forks source link

Stuck on an Error 5 #34

Closed Prof-JermZ closed 5 years ago

Prof-JermZ commented 6 years ago

I know extremely little about code, and I'm just wanting to make a simple rom hack for a nuzlocke randomizer thing I'm doing.

But when I'm trying to compile on my mac I get this rgbasm -h -o text.o text.asm ERROR: text.asm(2130) -> text/maps/route_9_1.asm(94): Section 'Text 3' is too big (max size = 0x4000 bytes). make: *** [text.o] Error 5

Any ideas on what I need to change to fix this?

I already found one issue where it freaked out from bank 13, but I just removed the colosseum and trade center code, since they won't be used, and that fixed that. But I wasn't having this issue the last time I tried compiling.

Thanks for any help guys!

Pokechu22 commented 6 years ago

The "Error 5" part of that message is just the exit status of running the previous command (rgbasm -h -o text.o text.asm).

The specific message there is what you need; "Section 'Text 3' is too big (max size = 0x4000 bytes)." and presumably the area where it's seeing it's too big is line 94 of route_9_1.asm (included on line 2130 of text.asm). Assuming you've added your text elsewhere in section Text 3, that'd mean that your text is causing the other text not to fit (route_9_1 is the last one in Text 3).

Prof-JermZ commented 6 years ago

Oh, wow. So, I have too much text in other files? Or too much text in the text.asm?

Like I said, I am a bit slow at this.

Pokechu22 commented 6 years ago

Too much text in the "Text 3" section (which represents a specific bank, and is on lines 1532 to 2143 of text.asm, which also includes some of the other files in the text folder).

Prof-JermZ commented 6 years ago

I appreciate it! I'll try to cut it back some!

Thank you!!!

Prof-JermZ commented 6 years ago

Ok, I really hate to bother you one more time!

But I basically just reinstalled it. And put my edits back in and now I have this.

ERROR: main.asm(1244) -> data/mapHeaders/colosseum.asm(4): Section 'bank13' is too big (max size = 0x4000 bytes). make: *** [main.o] Error 5

This just means that bank 13 is too big, but does the error actually occur in the colosseum.asm?

I know the unused chief is also in bank 13, would just getting rid of that be enough?

There isn't a whole lot in the colosseum.asm either.

Just this: Colosseum_h: db CLUB ; tileset db COLOSSEUM_HEIGHT, COLOSSEUM_WIDTH ; dimensions (y, x) dw ColosseumBlocks, ColosseumTextPointers, ColosseumScript ; blocks, texts, scripts db $00 ; connections dw ColosseumObject ; objects

Pokechu22 commented 6 years ago

That just means that the thing that pushed it beyond the maximum was in colosseum.asm, but getting rid of anything else in bank 13 would work just as well (though of course it depends on how much you free up), so getting rid of the chief stuff would also work.

Prof-JermZ commented 6 years ago

This is such a pain, haha!

Removing the ChiefPic: line didn't fix it. Seems like it's just being pushed too much.

I'll get it all figured out. You've been a great help!

yenatch commented 6 years ago

You probably don't need to get rid of anything. You can just make a new section and put it in there. There's plenty of free space in the rom, it's just that a single ROMX section can only be 0x4000 bytes. This is because of the way memory is mapped on the game boy. http://gbdev.gg8.se/wiki/articles/Memory_Map

Start End Description Notes
0000 3FFF 16KB ROM bank 00 From cartridge, fixed bank
4000 7FFF 16KB ROM Bank 01~NN From cartridge, switchable bank via MBC (if any)

ROMX is the 4000-7FFF part. The majority of the game is mapped to this space and hotswapped by the game program as needed.

To make a new section just put this at the end of text.asm:

SECTION "New Stuff", ROMX

; include files or text here

Then move file INCLUDEs from the "bank13" section into the new section until the error goes away.

Prof-JermZ commented 6 years ago

Bruh! That's pretty awesome! I mean, I already deleted so much and saved, and the game works fine still. I just got rid of the multiplayer stuff so it's no big deal.

But if I were to move stuff to a "new stuff" section, wouldn't I have to change more code to tell it that whatever I moved is now in the new section?

p.s. - can I do this for any of the files? Because bank13 isn't actually in the text.asm.

PikalaxALT commented 6 years ago

The answer is complicated. Basically, anything that accesses the code/data in this new section using both its bank and address is fine the way it is. Anything outside the new section that references the code/data directly (by using a call, jp, or ld instruction) must be modified to use a far reference function (either FarCall or GetFarByte).

Prof-JermZ commented 6 years ago

Alright, I am a Layman. So I don't quite get it. But if a bank or section is too big and just needs things moved then in the same file I should just be able to create a new section and move it over to it without issue. Because it's not jumping files?

This is what I'm getting out of it haha

This is turning out to be a lot more complicated than I thought it would be haha

And I was successfully able to clear up bank13, thank you for that @yenatch!