title: printing a memory value on the screen in assembly
body: <p>I wrote an assembly code to sum five numbers. The final value is then stored in the memory. </p>
  
  <pre><code>dtseg    segment
  data     dw       27345,28521,29533,30105,32375
  sum      dw       ?  
  MSG1     DB "The sum is : $"  
  dtseg    ends
  ;---------------------
  cdseg    segment
  main     proc     far
       assume   cs:cdseg,ds:dtseg,ss:stseg
       mov      ax,dtseg
       mov      ds,ax
       clc                       ; clear the carry
       mov      si,offset data   ; first location of data
       mov      cx,04            ; setting the counter
       mov      ax,0             ; clear ax
       mov      bx,ax            ; clear bx
  back:add      ax,[si]          ; the first round: 0+27345
       adc      bx,0             ; if there is a carry, add that to bx
       inc      si               ; two inc because traversing words
       inc      si
       dec      cx               ; count down
       jnz      back             ; do that for other numbers
       mov      sum,ax           ; the final value
       mov      sum+2,bx         ; the carries are stored in bx
  
       lea      dx,MSG1          ; trying to display the result
       mov      ah,09h
       int      21h  
       mov      ah, 4cH          ; return to DOS
       int      21h
  main     endp
  cdseg    ends  
           end      main
  </code></pre>
  
  <p>I followed the example based on this <a href="https://stackoverflow.com/questions/23679521/add-2-numbers-in-assembly-language-and-print-the-result/23682807#23682807">topic</a>, however it doesn't work in emu8086</p>