It is currently Tue Nov 21, 2017 3:12 am

All times are UTC - 7 hours





Post new topic Reply to topic  [ 32 posts ]  Go to page Previous  1, 2, 3
Author Message
 Post subject: Re: ca65 goodies
PostPosted: Wed Oct 18, 2017 8:15 am 
Offline
User avatar

Joined: Sun Jan 22, 2012 12:03 pm
Posts: 5824
Location: Canada
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


Top
 Profile  
 
 Post subject: Re: ca65 goodies
PostPosted: Wed Oct 18, 2017 9:00 am 
Offline
User avatar

Joined: Sat Feb 12, 2005 9:43 pm
Posts: 10116
Location: Rio de Janeiro - Brazil
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.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 32 posts ]  Go to page Previous  1, 2, 3

All times are UTC - 7 hours


Who is online

Users browsing this forum: Bing [Bot] and 9 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