Code segmentation guide: Difference between revisions

Link cleanup and minor formatting edits
m (Bigbass moved page So, your code segment is over 1MB to Code segmentation guide without leaving a redirect: Better fitting title)
(Link cleanup and minor formatting edits)
Line 1:
[[File:So_your_code_segment_is_over_1MB.png]]
 
So youYou've been working hard on your Homebrew title, slowly adding in more content, when suddenly you realize that the game's having weird hanging issues related to assets you've just added to your ROM. What gives?
 
== Why does the Code segment size matter? ==
 
When the console boots, the [[Initial Program Load]] which is contained in every ROM '''copies the first megabyte (1,048,576 Bytesbytes) of code to RAM and executes it'''. This means that if you've been linking your assets directly into your code segment, you can very quickly go past this 1MB limit.
 
Code by itself usually has very small memory footprint (But not negligible footprint, as we'll see later!), therefore, depending on how your engine is set up, you might only be required to split your assets from the main code and not have to worry about anything else.
Line 13:
These pages are aimed at providing users who are new to embedded systems programming to work around this limitation. It is expected that you have '''a strong understanding of C'''. These pages should hopefully provide with useful techniques and sample code to aid your homebrew, and it is recommended that they be read in the provided order:
 
* [[First things first, split yourSplitting assets from the code]]
* [[Data compression and filesystems]]
 
[[Data compression and filesystems]]
 
Once you have read through those two pages, it is also recommended you look into techniques to split your code. It is preferable that you write your game to support at least one of these methods '''before''' you start adding too much to it, as it might become more challenging to modify such an intricate part of your engine after the fact.
 
* [[Code splitting techniques: Overlays]]
* [[Relocatable Modules]]
 
* [[Code splitting techniques: Relocatable ModulesOverlays]]
* [[TLB Mapping]]
 
[[Code splitting techniques: Relocatable Overlays]]
 
[[Code splitting techniques: TLB Mapping]]
 
[[categoryCategory:Guides]]