title: Warped cursor in assembly
body: <p>Using BIOS video interrupts, I can finally move my cursor around the screen but when it reaches the end of the screen it disappears. I need for it to appear on the other side, I mean if it goes straight to the ride side it will come out to the left side of the screen. Can someone give me an idea how to do this?   </p>
  
  <pre><code>  .MODEL SMALL
    .STACK 1000h
    .DATA
  
    ROW DB 12 ; initial cursor position
    COL DB 40
  
   .CODE
   .STARTUP
  START :
    MOV AH, 0     ; set video mode
    MOV AL, 3     ; 80x25 color
    INT 10H           ; video BIOS call   
    MOV AH, 2     ; set cursor position
    MOV BH, 0     ; display page number
    MOV DH, 24        ; set bottom row number
    MOV DL, 7     ; column number
    INT 10H           ; video BIOS call
    MOV AH,2        ;set cursor position
   MOV BH,0        ;display page number
   MOV DH,ROW      ;row number
   MOV DL,COL      ;column number
   INT 10H         ;video BIOS call
   MOV BL, 15
   INT 10H         ;video BIOS call
  
  READ :
  MOV AH, 0       ;read keyboard
  INT 16h           ;BIOS call
  CMP AL,0
  JZ CSC
  CMP AL,'q'
  JMP EXIT
  
  CSC :
  CMP   AH,72        
  JZ   UP
  CMP   AH,80       
  JZ   DOWN
  CMP   AH,75       
  JZ   LEFT
  CMP   AH,77        
  JZ   RIGHT
  
   UP:
  SUB ROW, 1
  MOV   AH,2          ;set cursor position
  MOV   BH,0          ;display page number
  MOV   DH,ROW        ;row number
  MOV   DL,COL        ;column number
  INT   10H           ;video BIOS call
  JMP READ      
  
   DOWN:
  ADD   ROW, 1
  MOV   AH,2          ;set cursor position
  MOV   BH,0          ;display page number
  MOV   DH,ROW        ;row number
  MOV   DL,COL        ;column number
  INT   10H           ;video BIOS call
  JMP   READ   
  
   RIGHT:
  ADD   COL, 1
  MOV   AH,2          ;set cursor position
  MOV   BH,0          ;display page number
  MOV   DH,ROW        ;row number
  MOV   DL,COL        ;column number
  INT   10H           ;video BIOS call
  JMP   READ   
  
  LEFT:
  SUB   COL, 1
  MOV   AH,2          ;set cursor position
  MOV   BH,0          ;display page number
  MOV   DH,ROW        ;row number
  MOV   DL,COL        ;column number
  INT   10H           ;video BIOS call
  JMP   READ      
  EXIT : .EXIT 
  END
  </code></pre>