0
STR1 DB "ENTER YOUR STRING : $"
STR2 DB "YOUR STRING IS : $"
INSTR1 DB 30 DUP("$")  

Can someone tell me what does '$' sign mean in the above example? I know that DUP operator causes value to be repeated number of times. For example,

DELTA DB 212 DUP (?)

created an array of 212 uninitialized bytes. Similarly,

GAMMA DW 100 DUP (0)

sets up an array of 100 words, with each entry Initialized to O. But i am confused that would does the INSTR1 DB 30 DUP("$") mean?

Ross Ridge
  • 38,414
  • 7
  • 81
  • 112
zubaida12
  • 53
  • 5
  • 2
    The dollar signs mean the ASCII value for a dollar sign. They're part of the strings or duplication just like any character or value. – Ross Ridge Apr 24 '17 at 05:51
  • In DOS, the $ is the end of the string, IIRC, like ASCII 0 in C and newer Microsoft OSes. – Rudy Velthuis Apr 24 '17 at 10:54
  • 1
    `INSTR1 DB 30 DUP("$")` means the same thing as previous examples, ie. 30 times value of expression in parentheses. With x86 masm the `"$"` will be decoded as an ASCII character, which is byte value `36`. So it is equivalent to `INSTR1 DB 30 DUP(36)`, but the character `$` in source gives hint to the reader of source code, that purpose of that line is to pre-fill buffer with DOS-string terminator value. – Ped7g Apr 24 '17 at 13:26

1 Answers1

4

'$' marks end of ASCII stream in MS-DOS int 21h call AH = 09, print string; it's substitute in C would be ASCII zero.

Without more context, I would expect user input to be written over INSTR1, in which case the input (with length between 0 and 29 inclusive) would be automatically terminated by the dollar sign (and thus ready for printing with int 21h).

Aki Suihkonen
  • 19,144
  • 1
  • 36
  • 57