Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

strings with quotation marks in assembly

I am using emu8086. I am trying to define a string like "I don't "listen" to radio".
When I use either of the following:

mystr db "I don't ""listen"" to radio"

mystr db 'I don"t "listen" to radio'

and try to print mystr, it prints either of the following, respectively:

I don't ""listen"" to radio

I don"t "listen" to radio

which is not what I want (I don't "listen" to radio). So, how can I define such a string?

like image 644
Cror2014 Avatar asked Mar 10 '23 01:03

Cror2014


1 Answers

Assemblers differ in how they treat embedded special characters like quotation marks, but the ASCII code comes to the rescue.

When a string you need to define has some difficult characters in it, you can always replace these by their ASCII codes. The double quotation mark has 34 for its ASCII code.

mystr db "I don't ", 34, "listen", 34, " to radio"

This will output:

I don't "listen" to radio

like image 170
Sep Roland Avatar answered Mar 12 '23 01:03

Sep Roland