Ascii Pseudoinstruction

The word ".ascii" signifies a pseudo-instruction in assembly language. It provides a way for the user to insert specific character values in specific locations in the assembled code. The pseudoinstruction has the following parts:

label: .ascii string comment

The word ".ascii" and the string must be included, but the comment and the label are optional. The label can be used as an operand in assembly language statements to refer to the first address of the string that is being specified. The pseudoinstruction is terminated by the end-of-line character.

The operand must be a string of 0 or more characters surrounded by double quotes. The string can include the end of line, double quote, carriage return, backslash, and tab characters by using the following character combinations

    .ascii  "\n"   ; end of line
    .ascii  "\""   ; double
    .ascii  "\\"   ; backslash
    .ascii  "\r"   ; carriage return
    .ascii  "\t"   ; tab

The effect of including an ascii pseudoinstruction in your program is that the assembler inserts the ASCII numeric value of each of the characters in the string into the program at the point where the ascii pseudoinstruction appears. So the pseudoinstruction
    .ascii "abcde"
will be assembled into 5 bytes containing the 5 ASCII numeric values for the characters 'a', 'b', 'c', 'd', and 'e'.