7Fermer9
ozzyyzzoLe 18/05/2021 à 06:32
Mega Shocked (./6):
I will apologize in advance as I will probably butcher this...


Any tips or suggestions to on if it is possible to build this into the existing rig would be amazing. Thanks again for this great enhancement!!!!!


I'm not using DATlib myself, and i'm not aware of its limitations if any, but i guess it should be possible to do so.
*Unfortnately your makefile listing is not complete*

But anyhow, what you will need is to add more makefiles to your build process.

atm, your main makefile is generating dev_p1.rom and should contains all your OBJS (.o)
as suggested by the output name, everything will be located into P1 ROM (1MB)

just create another makefile which will output dev_p2.rom and move some OBJS from the original makefile in this one (by this you are intentionally associating data from P1 to P2)
then use romwak accordingly on dev_p2.rom (just like it is done with dev_p1.rom)

Finally, if you need more than 1MB in P2 you will need to concatenate multiple files (ex : xxx-p2..rom+xxx-p3.rom+xxx-p4.rom = xxx-p2.bin)

For TeoT for instance i'm building 9 makeifles generating : dev_p1.rom to dev_p9.rom
then using romwak, building roms process is as follow :

romwak /f dev_p1.rom 202-p1.bin
romwak /p 202-p1.bin 202-p1.bin 1024 255

romwak /f dev_p2.rom 202-p2.bin
romwak /p 202-p2.bin 202-p2.bin 1024 255

romwak /f dev_p3.rom 202-p3.rom
romwak /p 202-p3.rom 202-p3.rom 1024 255
romwak /c 202-p2.bin 202-p3.rom 202-p2.bin

romwak /f dev_p4.rom 202-p4.rom
romwak /p 202-p4.rom 202-p4.rom 1024 255
romwak /c 202-p2.bin 202-p4.rom 202-p2.bin

romwak /f dev_p5.rom 202-p5.rom
romwak /p 202-p5.rom 202-p5.rom 1024 255
romwak /c 202-p2.bin 202-p5.rom 202-p2.bin

romwak /f dev_p6.rom 202-p6.rom
romwak /p 202-p6.rom 202-p6.rom 1024 255
romwak /c 202-p2.bin 202-p6.rom 202-p2.bin

romwak /f dev_p7.rom 202-p7.rom
romwak /p 202-p7.rom 202-p7.rom 1024 255
romwak /c 202-p2.bin 202-p7.rom 202-p2.bin

romwak /f dev_p8.rom 202-p8.rom
romwak /p 202-p8.rom 202-p8.rom 1024 255
romwak /c 202-p2.bin 202-p8.rom 202-p2.bin

romwak /f dev_p9.rom 202-p9.rom
romwak /p 202-p9.rom 202-p9.rom 1024 255
romwak /c 202-p2.bin 202-p9.rom 202-p2.bin

hope that helps smile

note: you will have to build by yourself the new version of romwak (0.3f) which contains the concatenate option /c
(freem seems lazy enough not providing the latest binary release) lol ... just kidding... ^^

* update *

It's kinda obvious but using ngDataLinker with P1 (map file) is irrelevant as data from P1 must stay into the memory range [0x00100000- [0x001fffff] as generated by GCC link.
it has to be used with P2 roms and above to keep addresses between range [0x00200000- [0x002fffff] where bank switch mecanism occurs and data can be accessed.

* hint *

Just try with a simple configuration at first : 2 makefiles , let's also forget sprites and others generated data from third party applications.

- don't change anything to your original build setup and let's call your original makefile as 'P1'

- create a second makefile which will output dev_p2.rom and add whatever object you will need to access from your code.. a table for instance.

you could compile and link a C file from the second makefile containing :

const char const messageInABottle[] = "I'll send an S.O.S to the world";

you also have to access the data from somewhere in your OWN code in P1 like :

sprintf(txt,"%s, I hope that someone gets my..",messageInABottle);

but.. compiling and linking P1 will fail because there is no reference about messageInABottle table into modules compiled from P1 makefile.

- use ngDataLinker with P2 map file

generated header should contain a crazy immediate definition like this : #define messageInABottle 0x00200010

- #include the generated header into the P1 source file where messageInABottle table has to be accessed.

- recompile and link P1

- success and you are now accessing a string from P2 , also note that there is no need to specifiy any bank @0x2ffff0 because 1MB P1 and 1MB P2 is the default configuration.


'Message in a bottle, yeah
A year has passed since I wrote my note
I should have known this right from the start'
The Police