title: Print the maximum number from the following vector in Assembly 8086
body: <p>I'm trying to do a homework assignment in 8086 assembly. But I can't seem to get it. I know my code is incorrect and I try to seek the right approach and answers (people told me it's completely wrong, like it's not the right path from the start). </p>
  
  <p>I have a problem to find the max number in a vector.</p>
  
  <pre><code>.model small
  .stack 100h
  .data
    a db '5 ', '21 ', '4 ', '13 ', '2 ', '31 ', '22 ', '$' - the vector
    max db 0 - max variable
  .code
    mov ax,@data
    mov ds,ax
    mov ah, 09h
    mov dx, offset a
    int 21h
    mov si,0 - setting the increment variable to 0
    jmp e1
  
  e1: 
    mov bh,a[si]
    mov dh,a[si+1]
    cmp bh,dh - compare the 0 element to the 1 element
    jl e2
    inc si
    jmp e1
  
  e2: 
    mov max,dh - if bh is less than dh, set max to dh value
    inc si
    cmp si, 6 - starting from 0, compare if the increment variable is at the end
    je e3
    jmp e1
  
  e3:
    mov dx,offset max
    mov ah,09h
    int 21h
    mov ah,4ch
    int 21h
  end
  </code></pre>
  
  <p>People told me I should reimagine it, but I don't know how to do that exactly. They said the reason my code doesn't work is because assembly takes the whole thing in apostrophes, including the space. And I should somehow use the ASCII table, which is a pain in the ass.</p>