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

ca65 goodies
http://forums.nesdev.com/viewtopic.php?f=2&t=11112
Page 3 of 3

Author:  rainwarrior [ Wed Oct 18, 2017 8:15 am ]
Post subject:  Re: ca65 goodies

I don't have a solution for the string problem (TBH if it was something I needed I'd probably just write a substring directive into ca65 and submit a pull request to make it a standard feature), but here's a ca65 goodie I find useful for when I'm trying to write timed branches:

Code:
.macro assert_branch_page label_
   .assert >(label_) = >*, error, "Page crossing detected!"
.endmacro

test:
   beq :+
   assert_branch_page :+ ; .assert will happen if this would cross a page
      nop
   :
   rts

Author:  tokumaru [ Wed Oct 18, 2017 9:00 am ]
Post subject:  Re: ca65 goodies

thefox wrote:
Maybe new builtin functions (e.g., .strleft, .strright and .strmid) should be added to complement .left, .right and .mid.

That sure would be nice.

Quote:
The macro you gave might expand to quite inefficient code (not exactly sure when ca65 evaluates certain parts of it).

Yeah, that's why I was wondering if anyone had thought of a better way to do this.

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