title: double buffer video in assembler
body: <p>I'm trying to do the double buffer video in assembler, but in this case i have a problem, i don't know how to solve it , it can't close after a key is pressed. Apparently the problem is in <strong>inc di</strong>:</p>
  
  <p>(I'm trying to paint all the 320*200 pixel with white color with a buffer)</p>
  
  <pre><code>.model small
  .386
  .stack 400h
  .data
  
  modovideo db ?
  vram dw 0
  
  xVal dw ?
  yVal dw ?
  
  .code
  main proc
     mov ax,@data
     mov ds,ax
  
    mov ah,0fh
    int 10h
    mov modovideo,al
  
    mov ah,0
    mov al,13h
    int 10h
  
    ; Segmento de memoria =====================================
  
    mov ah,48h
    mov bx,4000 ; 64000/16
    int 21h
    mov vram,ax
  
    ; Escribir en el segmento de memoria =======================================
  
  mov es,vram
  
  ;offset = 320*y + x
      ;mov xVal,160
      ;mov yVal,100
      ;mov ax,320
      ;mul yVal
      ;add ax,xVal
  
  
  mov di,0
  mov al,7
  
  mov cx,640
  paso1:
      mov es:[di],al
      inc di ; &lt;-----------
      loop paso1
  
  ; Volcar sobre pantalla ======================================================
  
  mov ds,vram
  xor si,si
  mov dx,0A000h
  mov es,dx
  xor di,di
  mov cx,64000
  rep movsb   
  
  mov ah,1
  int 21h
  
  salir:
  mov al,modovideo
  mov ah,0
  int 10h
  
  mov ah,4ch
  int 21h
  
      main endp
  </code></pre>