ca65 goodies

Discuss technical or other issues relating to programming the Nintendo Entertainment System, Famicom, or compatible systems.

Moderator: Moderators

User avatar
Posts: 7814
Joined: Sun Jan 22, 2012 12:03 pm
Location: Canada

Re: ca65 goodies

Post by rainwarrior » Wed Oct 18, 2017 8:15 am

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: Select all

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

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

User avatar
Posts: 11700
Joined: Sat Feb 12, 2005 9:43 pm
Location: Rio de Janeiro - Brazil

Re: ca65 goodies

Post by tokumaru » Wed Oct 18, 2017 9:00 am

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.
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.

Post Reply