title: Printing Out a String Stored in an Array of DWORDS
body: <p>I'm writing a program in Assembly that will Bubble Sort an Array of Strings. A zero length string terminates the array. I approached this by declaring a DWORD array, where the string var., that is a byte size, shall be stored. My main problem is not the bubble sort itself, but that strings that were stored in the array wasn't outputting completely. </p>
  
  <p>To hopefully make it clear, here is my code:</p>
  
  <pre><code>.586
  .MODEL FLAT
  
  INCLUDE io.h   ; header file for input/output
  
  space           equ     0
  cr              equ     0dh
  
  .STACK 4096
  
  .DATA           
  myStrings               byte    "Delts",0
                          byte    "Abs",0
                          byte    "Biceps",0
                          byte    0
  
  labelStrOut             byte    "Output is: ", 0
  
  stringOut               dword   11 dup (?)
  
  stringNum               dword   0
  stringArray             dword   20 dup (?)              
  
  
  .CODE
  
  _MainProc PROC  
  
              mov edi, offset myStrings
              mov esi, offset stringArray
  
  
   popltLp:       
              cmp BYTE PTR [edi], 0
              jz popltDone
              mov ebx, [edi]
              mov DWORD PTR [esi], ebx            
              add esi, 4
              inc stringNum
              xor ecx, ecx
              not ecx
              xor al, al
              repne scasb 
              jmp popltLp
  
  popltDone: 
              xor edx, edx
  
  
              lea esi, stringArray
              mov ebx, DWORD PTR [esi]
              mov stringOut, ebx
              output labelStrOut, stringOut
              add esi, 4
              mov ebx, DWORD PTR [esi]
              mov stringOut, ebx
              output labelStrOut, stringOut   
              add esi, 4
              mov ebx, DWORD PTR [esi]
              mov stringOut, ebx
              output labelStrOut, stringOut
  
  
  outptDone:
  
              mov  eax, 0                     ;     exit with return code 0
              ret
  _MainProc ENDP
  
  
  END                             ; end of source code
  </code></pre>
  
  <p>As can be seen, no Bubble Sorting is being done yet...</p>
  
  <p>The lines below 'popltDone' is just me messing around to see if the strings carried over to the array just fine. However, when printed out on the screen, only 4 characters were just showing up! The entire string line was just not being printed out, which is currently driving me crazy. Can someone please tell me what I am doing wrong? </p>
  
  <p>Thanks to anybody taking the time reading this. </p>