4

I have seen the following directives but I don't know exactly the usage:

  1. .space
  2. .byte
  3. .word
  4. .asciiz
  5. .ascii
  6. .align
Peter Cordes
  • 328,167
  • 45
  • 605
  • 847
nawdeh naw
  • 51
  • 6

1 Answers1

5
  1. .space reserves n bytes of memory, without aligning. e.g. arr: .space 100
  2. .byte store the n values in successive bytes of memory. e.g. num: .byte 0x01, 0x03
  3. .word store n 32-bit words contiguously in aligned memory. e.g. val: .word 10, -14, 30
  4. .asciiz stores string in memory with a null terminator. e.g. str: .asciiz "Hello, world"
    Exactly like .ascii with a .byte 0 after it.
  5. .ascii stores string in memory without a null terminator. e.g. str: .ascii "Hello, world"
  6. .align aligns the next data on a 2^n byte boundary. e.g. .align 2 aligns the next value on a word boundary. On the other hand if n is 0 then alignment is turned off until next data segment.

For a detailed information see this assembly reference.

For more details about .align, see

Peter Cordes
  • 328,167
  • 45
  • 605
  • 847
nomem
  • 1,568
  • 4
  • 17
  • 33