Is there an escape character in ca65 to add such commands to a text string?
In general: No.
The whole ASCII(Z) mechanic is meant to write device independent code, so adding device specific sequences is rather outside of the scope. To get arbitary inserts, you may want to use the good old
msg .BYTE "Hello ",$05,"World",0
Then again, there is a way to do it, it just comes with a big caveat.
Starting with version 2.18 (*1,2) escape code processing can be enabled via a feature (*3)
This will enable C-style escape codes for special characters. Now it's possible to write
msg .ASCIIZ "Hello \x05World"
So far a great thing, except, this is only painless on the source/module side, as character mapping according to the target will kick in when linking (*4). When linking, stings get translated into target codes, which can be vastly different depending on each machine.
Now, since we already left the path of compatibility, there is a way to add (somewhat) machine independent support by using defined character codes and have their mapping fixed using the
.CHARMAP directive. And with a bit of Macro-Fu logical names could be used as well ... but all of that is a complete different story :)
*1 - More correct, it wasn't there in 2.15, but is available in 2.18.
*2 - It also seams to be a backport by Oliver Schmidt from 2.5 into the free version.
*3 - When using the command line option features need to be specified all lower case as
*4 -Unless no target is specified (