I'm trying to figure out how to compile a game which swaps prg banks in 32KiB (no fixed bank) and have all the imported functions properly writen to the current segment.
An example:
Given the C code
It's compiled to
But the functions pusha and incsp1 are stored into the "CODE" segment
It's possible to have those imported functions stored on the segment of the caller or there're other way to code a game in C with no fixed bank?
Thanks in advance
An example:
Given the C code
Code:
#pragma code-name(push, "MY32KBANK");
char func(unsigned char x){
return x;
}
#pragma code-name(pop);
char func(unsigned char x){
return x;
}
#pragma code-name(pop);
It's compiled to
Code:
.segment "MY32KBANK"
.proc _func: near
.segment "MY32KBANK"
;
; char func(unsigned char x){
;
jsr pusha
;
; return x;
;
ldx #$00
lda (sp,x)
;
; }
;
jmp incsp1
.endproc
.proc _func: near
.segment "MY32KBANK"
;
; char func(unsigned char x){
;
jsr pusha
;
; return x;
;
ldx #$00
lda (sp,x)
;
; }
;
jmp incsp1
.endproc
But the functions pusha and incsp1 are stored into the "CODE" segment
Code:
runtime.lib(incsp1.o):
CODE Offs=000C90 Size=000007 Align=00001 Fill=0000
runtime.lib(pusha.o):
CODE Offs=000C97 Size=000016 Align=00001 Fill=0000
CODE Offs=000C90 Size=000007 Align=00001 Fill=0000
runtime.lib(pusha.o):
CODE Offs=000C97 Size=000016 Align=00001 Fill=0000
It's possible to have those imported functions stored on the segment of the caller or there're other way to code a game in C with no fixed bank?
Thanks in advance