It is currently Tue Aug 20, 2019 8:50 am

All times are UTC - 7 hours



Forum rules





Post new topic Reply to topic  [ 16 posts ]  Go to page Previous  1, 2
Author Message
PostPosted: Wed May 01, 2019 12:41 am 
Offline
User avatar

Joined: Sun Jan 22, 2012 12:03 pm
Posts: 7562
Location: Canada
I think I have a fix for the bug where you declare a segment as .far too late in the file for the first pass to catch it:
https://github.com/cc65/cc65/pull/885

I don't have a lot of internal cc65 experience, so I'm not 100% confident it's a complete solution to that bug, but it passes my own tests and doesn't fail cc65's regression test suite. Binary build is attached if anyone wants to help give it a test.

All the above suggestions still apply, this has nothing to do with having the assembler understand DP/DB, but I think it addresses the critical error of accidentally generating 16-bit addresses where you wanted 24-bit.

Basically as long as a label is in a :far segment it should be error checked for you now, regardless of whether it's declared above or below. The default addressing is still 16-bit (as it should be), but if the symbol isn't declared as far before its used, you'll get a range error because it would have assumed the default, which you can quickly resolve by adding a f: prefix on the operand (or e.g. using JSL instead of JSR).

Also note that if you use .global : far as a forward declaration, the .segment the label is in still has to be : far. Segment overrides import/export declarations. (This is good, though, it means you can use a symbol as a near address within the file, then .export it with a far address to be used elsewhere.)


Attachments:
cc65_bin_dc1fb7c.zip [431.81 KiB]
Downloaded 131 times
Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 16 posts ]  Go to page Previous  1, 2

All times are UTC - 7 hours


Who is online

Users browsing this forum: No registered users and 4 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group