-2
\$\begingroup\$

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?

\$\endgroup\$

closed as off-topic by Trevor_G, Eugene Sh., TonyM, brhans, Bimpelrekkie Feb 1 '18 at 15:10

  • This question does not appear to be about electronics design within the scope defined in the help center.
If this question can be reworded to fit the rules in the help center, please edit the question.

  • \$\begingroup\$ 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. \$\endgroup\$ – Trevor_G Feb 1 '18 at 14:34
  • 5
    \$\begingroup\$ I'm voting to close this question as off-topic because it has nothing to do with electrical/electronic design. \$\endgroup\$ – Trevor_G Feb 1 '18 at 14:34
  • 1
    \$\begingroup\$ @Trevor_G: Thanks man, though I agree it's off topic. \$\endgroup\$ – Ashutosh Tiwari Feb 1 '18 at 14:38
  • 1
    \$\begingroup\$ 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. \$\endgroup\$ – TonyM Feb 1 '18 at 14:43
  • \$\begingroup\$ 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. \$\endgroup\$ – Solomon Slow Feb 1 '18 at 18:03
1
\$\begingroup\$

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.

\$\endgroup\$

Not the answer you're looking for? Browse other questions tagged or ask your own question.