That line is simply declaring a label named msg
in the data segment. msg
is pointing to a byte buffer initialized with the characters Hello, world!
, immediately followed by a newline character (0x0A). The line after that is calculating the length of the string by taking the difference between the current address and the msg
label. The len
symbol will hold that length. The use of the comma is not an operator, it's simply just a separator between the values you are using to initialize the buffer.
Strings are treated specially in most (if not all) assembly languages to make it more convenient to write. That way you don't have to write out every individual character in that string.
The following declarations are equivalent:
str1 db 'abcde'
str2 db 0x61, 'bc', 'd', 101
; 'a' is 0x61 hex
; 'e' is 101 decimal
Just be warned that they usually don't automatically include a null terminator. This is why you would typically see a string declared like this:
message db 'Hello world', 0