title: How to handle animation loops in assembly
body: <p>I'm working on a text based animation in assembly where a large number of screen refreshes are required to make it smooth as possible and simulate bouncing physics. I use <code>int 1ah</code> calls to control the screen refresh delays and to make the shape appear as if it slows down reaching its peaks and speeds up as it falls back down. There is also a separate banner that is put to the screen after each <code>CALL CLEAR</code>. </p>
  
  <p>I wrote the code that handles the moving shape's code and it worked as expected. When I added the additional code that puts a stationary banner on the screen it locks dosbox up after a certain point.</p>
  
  <p>There are eight variations of the following code contained in a larger loop. It runs fine until I add the <code>;PRINT BANNER</code> to the seventh inner loop. Actually, it breaks on the first <code>LEA</code> in the below loop which wasn't there when testing w/o the banner. </p>
  
  <pre><code>  .REPEAT
         LEA     SI,SHAPE
         MOV     DH,ROW
         MOV     DL,COL
         CALL    CLEAR
         CALL    PUTSHAPE
         ;PRINT BANNER
         LEA     SI,BANNER            
         MOV     DH,25
         MOV     DL,39
         CALL    PUTSHAPE
         ;END BANNER
         MOV     TIME, 1
         MOV     AH, 0
         INT     1AH  
         ADD     TIME, DX
         .WHILE    DX &lt; TIME
              MOV       AH, 0
              INT       1AH
         .ENDW                                       
         ADD  COL, 2
         SUB  ROW, 4
         DEC  D7
         MOV  CX, D7
         MOV  TIME, 0
    .UNTILCXZ
  </code></pre>
  
  <p>Am I expecting too much too fast here? I've tried to rearrange the code to call the second <code>LEA</code> after the delay and a host of other suggestions to problems not exactly pertaining to text based animation and definitely using instructions I can't follow. I'm a serious assembly beginner learning from a book that utilizes custom libraries. I tried the program out on my 32bit Win 7 Pro running from the command prompt and got an NTVDM.EXE error. Any ideas or insights on obvious issues with the code?     </p>