Sorry for necromancing my own thread, but I forgot, time passed, and I didn't actually check what I was supposed to check. Anyways.
1.- There's absolutely not a different .section directive going in between:
Code: Select all
.segment "ZEROPAGE"
NTSC_MODE: .res 1
FRAME_CNT1: .res 1
FRAME_CNT2: .res 1
VRAM_UPDATE: .res 1
NAME_UPD_ADR: .res 2
PAL_UPDATE: .res 1
PAL_BG_PTR: .res 2
PAL_SPR_PTR: .res 2
SCROLL_X: .res 1
SCROLL_Y: .res 1
SCROLL_X1: .res 1
SCROLL_Y1: .res 1
PAD_STATE: .res 2 ;one byte per controller
PAD_STATEP: .res 2
PAD_STATET: .res 2
PPU_CTRL_VAR: .res 1
PPU_CTRL_VAR1: .res 1
PPU_MASK_VAR: .res 1
RAND_SEED: .res 2
FT_TEMP: .res 3
_SCROLL_WRITE: .res 2 ; <----
_ATTRIB_WRITE: .res 2 ; <----
[... etc]
2.- The generated .s file doesn't have an import for _SCROLL_WRITE or _ATTRIB_WRITE. In fact, I am not using the pointers in C code, but in inline assembly within a C function:
Code: Select all
void scroll_writers_realloc (void) {
if (wtp) wtp --; else wtp = 59;
if (wtp < 30) {
wtpr = wtp;
__asm__ ("ldx _wtpr");
__asm__ ("lda _shl5_hi, x");
__asm__ ("clc");
__asm__ ("adc #$20");
__asm__ ("sta <_SCROLL_WRITE");
__asm__ ("lda _shl5_lo, x");
__asm__ ("sta <_SCROLL_WRITE+1");
__asm__ ("lda _shr2, x");
__asm__ ("tay");
__asm__ ("lda #$23");
__asm__ ("sta <_ATTRIB_WRITE");
__asm__ ("lda _attrs_adds, y");
__asm__ ("sta <_ATTRIB_WRITE+1");
} else {
wtpr = wtp - 30;
__asm__ ("ldx _wtpr");
__asm__ ("lda _shl5_hi, x");
__asm__ ("clc");
__asm__ ("adc #$28");
__asm__ ("sta <_SCROLL_WRITE");
__asm__ ("lda _shl5_lo, x");
__asm__ ("sta <_SCROLL_WRITE+1");
__asm__ ("lda _shr2, x");
__asm__ ("tay");
__asm__ ("lda #$2B");
__asm__ ("sta <_ATTRIB_WRITE");
__asm__ ("lda _attrs_adds, y");
__asm__ ("sta <_ATTRIB_WRITE+1");
}
}
I guess that's the real problem (by the way, game.c compiles without the extern definitions I mentioned in the OP). Any ideas to get rid of the warning?
Code: Select all
ld65: Warning: Address size mismatch for `_ATTRIB_WRITE': Exported from crt0.o, crt0-pantanow.s(81) as `zeropage', import in game.o, game.s(20740) as `absolute' ld65: Warning: Address size mismatch for `_SCROLL_WRITE': Exported from crt0.o, crt0-pantanow.s(80) as `zeropage', import in game.o, game.s(20740) as `absolute'
The most interesting part is that 20740 lines is exactly the size of the generated game.s file.