Oh, I didn't mean to post! I actually worked it out just now. I was checking what I was writing and figured out the problem. Well, I got it working. Not sure I fully understand.
The variables I have are from $200 up. Originally they were from $200 to $208. Then when I added in the receive buffer stuff I changed that from $200 to $30B (i.e. 258 bytes more than before). There is a .org in the code to specify the $200 start. The actual code started at $8000.
I think the linker was saying 'hang on a sec bud, you've gone over the 256 byte limit in the ZP'. I guess the linker doesn't know about .orgs so assumed that page was in the ZP segment?
So I added in a new segment.
Code:
MEMORY {
ZP: start = $0000, size = $0100, type=rw, define=yes;
RAM: start = $0200, size = $010B, type=rw, define=yes;
ROM: start = $8000, size = $7FFA, type=ro, define=yes, fill=yes, file=%O;
VECTS: start = $FFFA, size = $6;
}
SEGMENTS {
ZEROPAGE: load = ZP, type = zp;
ORWELL: load = RAM, type = rw, define=yes;
CODE: load = ROM, type = ro;
VECTS: load = VECTS, type = ro;
}
That linked fine. But the binary generated had all my code offset by the size of the RAM memory, the $10B bytes.
That was confusing me and was what I was originally going to post about but I worked out in the end the type I am using was wrong. It needs to be type = bss. Doing that works. The documentation for ld65 isn't the easiest to follow!
I think I need to remove all the .orgs from inside the original code and just use segments. Currently .orgs are used inside the ZP to break it up into the sections used by Microsoft Basic. I think having .orgs and using the linker config can be a little confusing!
Sorry for the mis-post!
Simon