title: Swap vga text screen halves using x86 assembly
body: <p>We are supposed to swap the upper half with lower half, and my code does this but the problem is the last line is supposed to be the "C:>FILE_NAME". But the C in that line is on the second to the last. Also it is missing one line. I've been trying to play around with the numbers in CX but I'm not getting anywhere. Here is the code: </p>
  
  <pre><code>;Swap two halves of the screen crosswise
  
  JMP START   ;This will start the program
  
  START:
      MOV AX, 0B800H
      MOV ES, AX       ;Assign Video Display Area to ES
      MOV DS, AX      ;Assign Video Display Area to DS
      MOV SI, 0
      MOV DI, (80*2)*(12)  ;Lower half of screen
  
  MOV CX, 13      ;Loop for half of screen
  
  OUTERLOOP:
      PUSH CX
      MOV CX, 80  ;COLUMNS. I GET IT NOW!
  
  INNERLOOP:
      MOV AL, [DS:SI]
      MOV B[ES:DI], AL
      ADD DI, 2
  
     MOV BL, [ES:DI]
     MOV B[ES:SI], BL
     ADD SI, 2 
  
  LOOP INNERLOOP
  
     POP CX        
  
  LOOP OUTERLOOP
  
  INT 20H
  </code></pre>