; multi-segment executable file template.

data segment
    ; add your data here!
    msj db "Introduzca Partidas: $"  
    tder db "DERECK$"
    tmar db "MARQUITO$"
    temp db "EMPATES$"
    enter db 13,10,"$"
    cd db 0
    cm db 0
ends

stack segment
    dw   128  dup(0)
ends

code segment
start:
; set segment registers:
    mov ax, data
    mov ds, ax
    mov es, ax

    ; add your code here
            
    lea dx, msj
    mov ah, 9
    int 21h        ; output string at ds:dxį
    
    ;LECTURA DE LAS LETRAS:  D *68* o  M *77*  (DERECK / MARQUITO ) 
    ;ax,dx
    mov bx,0
    mov cx,10
  ciclo:
    mov ah,1
    int 21h 
    mov cx,0
    mov cl,al
    cmp cl,13
    jz finlee
    ;CL
    cmp cl,68
    jz cdereck 
    cmp cl,77
    jz cmarquito
    jmp ciclo
  cdereck:
    inc cd
    jmp ciclo   
  cmarquito:
    inc cm
    jmp ciclo
    
  finlee:        
    ;desde aqui la impresion del numero en BX
    lea dx,enter
    mov ah,9
    int 21h  
     
    mov bl,cm
    cmp bl,cd
    jc impder
    jnz impmar
    
    lea dx,temp
    mov ah,9
    int 21h  
  fin: 
    mov ah,1
    int 21h  
    mov ax, 4c00h ; exit to operating system.
    int 21h  
  impder:     
    lea dx,tder
    mov ah,9
    int 21h    
    jmp fin
  impmar:     
    lea dx,tmar
    mov ah,9
    int 21h    
    jmp fin
      
ends

end start ; set entry point and stop the assembler.
