Just a quick question which I couldn't find the answer to in the normal ways-
If I have a .data section in a masm .asm file with the following:
helloWorld db "Hello World", 0
What is the purpose of the 0? Is it a null terminator? What else can I put there?
Thanks.
To know where the end of the string is you have a couple of choices, store its length in another variable or place a terminating ZERO at the end.
Yes, it's jsut a null-terminator (null generally always means zero.)
Zero is the convention for c-style strings, to indicate the end of the string - which is what windows generally uses; prefixing a character array with its length is the pascal standard.
You could put any number (between 0 and 255, inclusive) there - and even many numbers separated by commas - each would be used to represent an ascii character (when "helloworld" is used as an ascii string.)
Other commonly useful values to make note of are: 9 = tab, 13 = carriage-return, 10 = line-feed (standard windows 'newline' is actually "13,10")