Splitting Assets from Code: Difference between revisions

Jump to navigation Jump to search
Content added Content deleted
(Almost finished writing this section)
m (Fixed spelling mistake)
Line 103: Line 103:
All we have to do is create a new C file, and in it we place a global buffer just like we did in the previous section. Except this time, we're not going to link this data to our codesegment, rather we'll tell the N64 to reserve this part of RAM for our buffer. We'll need to modify the makefile somewhat, as we'll need to compile our C file into an object file. Lets assume our buffer is in a C file called <code>texbuf.c</code>.
All we have to do is create a new C file, and in it we place a global buffer just like we did in the previous section. Except this time, we're not going to link this data to our codesegment, rather we'll tell the N64 to reserve this part of RAM for our buffer. We'll need to modify the makefile somewhat, as we'll need to compile our C file into an object file. Lets assume our buffer is in a C file called <code>texbuf.c</code>.


Your makefile should already have a dedicated <code>CODEFILES</code> taarget where you put all your C files, and then it gets compiled into one big <code>codesegment.o</code> object file via <code>CODEOBJECTS = $(CODEFILES:.c=.o)</code> and then <code>gcc -o $(CODESEGMENT) -r $(CODEOBJECTS)</code>. The idea now is that you create a new taarget, such as <code>DATAFILES</code>, and you place your buffer files here.
Your makefile should already have a dedicated <code>CODEFILES</code> target where you put all your C files, and then it gets compiled into one big <code>codesegment.o</code> object file via <code>CODEOBJECTS = $(CODEFILES:.c=.o)</code> and then <code>gcc -o $(CODESEGMENT) -r $(CODEOBJECTS)</code>. The idea now is that you create a new target, such as <code>DATAFILES</code>, and you place your buffer files here.


<syntaxhighlight lang="makefile">
<syntaxhighlight lang="makefile">