Site Tools


Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
mg_notes:cc65_tips:ca65_a2_strings [2017/12/29 18:44]
M.G. created
mg_notes:cc65_tips:ca65_a2_strings [2017/12/29 18:49] (current)
M.G. [ca65 - macros for MPW IIgs-style String Handling]
Line 1: Line 1:
 ====== ca65 - macros for MPW IIgs-style String Handling ====== ====== ca65 - macros for MPW IIgs-style String Handling ======
  
-The below macros implement string handling in the style of MPW IIgs among other things.  All of the macros except ''​ds''​ support up to 10 arguments.+The below macros implement string handling ​mainly ​in the style of MPW IIgs, plus some inspirations from Merlin.  All of the macros except ''​ds''​ support up to 10 arguments.
  
 ===== Examples ===== ===== Examples =====
Line 10: Line 10:
 Turn on or off the msb for ''​asc'',​ ''​str'',​ ''​pstr'',​ ''​cstr'',​ and ''​dc.b''​. ​ Defaults to ''​on''​. Turn on or off the msb for ''​asc'',​ ''​str'',​ ''​pstr'',​ ''​cstr'',​ and ''​dc.b''​. ​ Defaults to ''​on''​.
  
-  asc "​foo"​ +  asc "​foo" ​     ; store strings using msb setting 
-  hasc "​bar"​ +  hasc "​bar" ​    ; store strings with msb on 
-  lasc "​baz"​ +  lasc "​baz" ​    ; store strings with msb off 
-  inv "​inverse"​ +  inv "​inverse" ​ ; store inverse chars 
-  dci "​mytoken"​+  dci "​mytoken" ​ ; dextral character inverted
  
 ''​asc''​ stores text using the msb setting. ​ ''​hasc''​ and ''​lasc''​ force high or low msb, ''​inv''​ stores inverse characters (40-col screen), dci stores all but the last character with the msb set.  All support mixing hex bytes that are stored as-is. ''​asc''​ stores text using the msb setting. ​ ''​hasc''​ and ''​lasc''​ force high or low msb, ''​inv''​ stores inverse characters (40-col screen), dci stores all but the last character with the msb set.  All support mixing hex bytes that are stored as-is.
  
-  string asis +  string asis    ; str and dc.b store plain strings 
-  string pascal +  string pascal ​ ; str and dc.b store Pascal strings 
-  string c+  string c       ; str and dc.b store C strings
  
 Cause ''​str''​ and ''​dc.b''​ to use the given string type.  ''​asis''​ is equivalent to using ''​asc''​ instead of ''​str''​. ​ Defaults to ''​asis''​. Cause ''​str''​ and ''​dc.b''​ to use the given string type.  ''​asis''​ is equivalent to using ''​asc''​ instead of ''​str''​. ​ Defaults to ''​asis''​.
  
-  str "​foo"​+  str "​foo" ​ ; format according to string setting
   pstr "​bar"​ ; length-prefixed   pstr "​bar"​ ; length-prefixed
   cstr "​baz"​ ; zero-terminated   cstr "​baz"​ ; zero-terminated