Jump to content
  • 0
JohnGill

CBM PRG Studio text handling

Question

Hi all,

I'm using cbm prg studio to compile binary data files with a mixture of individual bytes and text to load into memory banks (see screenshot)

When I'm using the following type:

     text     'This is a string of text.'

by enclosing the string in apostrophes ' ' this compiles beautifully into screen codes in upper and lower case, - this is a very handy feature of prg studio, particularly for a heavily text orientated game like mine.

My problem is I want to put an actual apostrophe into the text string, for example :

     text     'You don't know where you are.' 

But this then causes problems for the compiler - the first apostrophe after the n in "don't" confuses it - What it does is it deletes the first apostrophe entirely, reducing the string in length by one byte (which caused me some headaches before I spotted it!)

Does anyone know how I can tell prg studio to include an actual apostrophe (screen code $2c) within the text?

I could do this, but it is incredibly clumsy:

     text     'You don'
     byte     $2c
     text     't know where you are.'

any ideas?

thanks

John

Bitmap in Untitled-1.png

Share this post


Link to post
Share on other sites

6 answers to this question

Recommended Posts

  • 0
2 hours ago, desertfish said:

Just a guess, try escaping the apostrophe with backslash?  like so:   text 'hello \'desertfish\'! '

 

thanks, I'll give it a go

Share this post


Link to post
Share on other sites
  • 0
2 hours ago, Hiraghm said:

Huh... I wonder why you can' t just use ` instead?

Back-ticks (`) are not supported by PETSCII. It has ← instead.

I tried looking up what the character escape format is for that assembler, but I don't see any documentation for it out there.

For ca65, there doesn't seem to be any support for escaping in string constants, but you can have comma-separated strings and character codes, so you could do this:

.byte "I said, ", $22, "Hello.", $22

Which gets you I said, "Hello."

Not much less awkward than what you had, but at least it can be put on a single line. Ca65 may be a little more liberal than PRG Studio in letting you use strings in byte directives.

Share this post


Link to post
Share on other sites
  • 0

I tried some tricks, but no luck.  It seems that "multiple strings" is the only way that works:

     text     'You don',$27,'t know where you are.'
     text     'You don',"""','t know where you are.'

That second line looks odd, but it works!

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...

Important Information

Please review our Terms of Use