-2

I am not able to understand how arrays work in assembly language. In Irvine's book on Assembly Language it's written:

*** A string can be divided between multiple lines without having to supply a label for each line:

greeting1 BYTE "Welcome to the Encryption Demo program "

BYTE "created by Kip Irvine.",0dh,0ah

BYTE "If you wish to modify this program, please "

BYTE "send me a copy.",0dh,0ah,0

The hexadecimal codes 0Dh and 0Ah are alternately called CR/LF (carriage-return line-feed) or end-of-line characters. When written to standard output, they move the cursor to the left column of the line following the current line.***

Does it create two arrays(I assume the first one is greeting1 and ends at "created by Kip Irvine") and if yes what's the name of the variable that references the second array? Or is there something that I don't understand here?

  • This is really off topic. However all he is saying is embedding control characters into the byte array string will cause said string to be formatted as two lines on whatever terminal you are sending it to. That is, you do not need to define two array, one for each line, and send each one after the other. – Trevor_G Feb 01 '18 at 14:34
  • 5
    I'm voting to close this question as off-topic because it has nothing to do with electrical/electronic design. – Trevor_G Feb 01 '18 at 14:34
  • 1
    @Trevor_G: Thanks man, though I agree it's off topic. – Ashutosh Tiwari Feb 01 '18 at 14:38
  • 1
    Echo @Trevor_G with off-topic vtc. For the record, what is strictly an array of characters is to you a C-style string there, being zero-terminated. And you're simply defining that single string over several lines for clarity. It could be defined in one harder-to-read line. – TonyM Feb 01 '18 at 14:43
  • There is no single language called "assembly." Each different family of processors potentially has its own assembly language. For some especially popular processor families there may be more than one assembly language. – Solomon Slow Feb 01 '18 at 18:03
  • Having learned a few assembly languages myself, I would guess that output from two adjacent BYTE statements in the assembly language would be contiguous in memory (i.e., with no padding in between them.) If I was linking that with a C program, I would expect to find a single, NUL terminated string at the symbolic address, greeting1. – Solomon Slow Feb 01 '18 at 18:07

1 Answers1

1

Your asm code fills a series of bytes with the written texts and other characters. The result has no other structure. It's up to your program is this memory area seen as an array. The beginning of the memory area has a symbolic address name greeting1. It's handy when you write some actual code which reads or writes that memory area. - this is why assembly language is used.

If you have some decent program development environment, you in theory can use address greeting1 also in a higher level programming language without a need to know its numeric value.