nesdev.com
http://forums.nesdev.com/

extern ZP variables in cc65 and warnings.
http://forums.nesdev.com/viewtopic.php?f=2&t=16944
Page 1 of 1

Author:  na_th_an [ Mon Jan 15, 2018 1:07 am ]
Post subject:  extern ZP variables in cc65 and warnings.

I've been having this problem for months. It just seems to be an ugly warning as everything seems to work, but I don't like warnings.

It seems that tschak909 had the same problem here: viewtopic.php?p=211844#p211844 and got it sorted out, but the same solution doesn't work for me.

This is my issue:

I created a couple of pointers in ZP in the crt0 file. They are read by a modification I made to neslib, and have to be written from by C code in my main module. Such pointers are defined as:

Code:
.export _SCROLL_WRITE, _ATTRIB_WRITE

[...]

.segment "ZEROPAGE"

; [...] <- neslib stuff being defined here as in lots of "var .res N"

_SCROLL_WRITE:    .res 2
_ATTRIB_WRITE:    .res 2


Those symbols I import from my main module:
Code:
extern unsigned char *SCROLL_WRITE;
#pragma zpsym ("SCROLL_WRITE")
extern unsigned char *ATTRIB_WRITE;
#pragma zpsym ("ATTRIB_WRITE")


But keep getting the warnings:

Code:
ld65: Warning: Address size mismatch for `_ATTRIB_WRITE': Exported from crt0.o, crt0-pantanow.s(81) as `zeropage', import in game.o, game.s(20597) 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(20597) as `absolute'


I even updated to the latest win32 snapshot of cc65, to no avail. Any pointers on what I'm doing wrong / what's missing?

Thanks.

Author:  DRW [ Mon Jan 15, 2018 3:17 am ]
Post subject:  Re: extern ZP variables in cc65 and warnings.

The error message doesn't seem to imply this, but shouldn't it be .exportzp in the Assembly file instead of .export?

Author:  calima [ Mon Jan 15, 2018 3:44 am ]
Post subject:  Re: extern ZP variables in cc65 and warnings.

Either the warning is wrong, or your crt0.s has another .section directive in between, causing them to be normal symbols. I use ZP symbols all the time, and don't have any warnings.

edit: Look at the generated game.s asm. It should have those as importzp, not import.

Author:  na_th_an [ Mon Jan 15, 2018 2:57 pm ]
Post subject:  Re: extern ZP variables in cc65 and warnings.

Thanks both. I'll double-check.

Page 1 of 1 All times are UTC - 7 hours
Powered by phpBB® Forum Software © phpBB Group
http://www.phpbb.com/