Defining Strings


To create a string data definition, enclose a sequence of characters in quotation marks. A string is ended with a null byte, a byte containing the value 0.
   preface  BYTE  "Hello", 0
Each character uses a byte of storage. The above code is equal to:
   preface  BYTE  'H', 'e', 'l', 'l', 'o', 0
A string can be spread across multiple lines, for example:
   preface  BYTE  "Assembly language for Intel computers", 0Dh, 0Ah
            BYTE  "A book for IA-32 processor architecture.", 0
The hexadecimal bytes and (carriage-return line-feed) advance the cursor to the beginning of the next line of standard output. The continuation character (\) may be used to concatenate two lines into a single program statement. For example, the following two statements are the same:
   preface  BYTE  "Assembly language for Intel computers", 0
   preface  \
            BYTE  "Assembly language for Intel computers", 0
 Replacing a Character  Printing Part of a String  4 + 6
 INCLUDE Irvine32.inc
 .data
  s BYTE "This is ? test."
    BYTE 0 
 .code
 main PROC
  
  mov   edx, OFFSET s
  call  WriteString
  exit
 main ENDP
 END main
 
 INCLUDE Irvine32.inc
 .data
  s BYTE "This is ? test."
    BYTE 0
 .code
 main PROC
  
  call  WriteString
  exit
 main ENDP
 END main
 
 INCLUDE Irvine32.inc
 .data
  s BYTE "123456789"
    BYTE 0
 .code
 main PROC
  mov   eax, 0
  
  mov   al, [esi+3]
  sub   al, '0'
  add   al, [esi+5]
  sub   al, '0'
  call  WriteInt
  exit
 main ENDP
 END main
 

 Output  Output  Output
  This is a test.     test.     10  


      “I’m not arguing, I’m just explaining why I’m right.”    
      ― Unknown