Note that there are some explanatory texts on larger screens.

plurals
  1. POLine feed (0AH) messing up with video interrupt INT 10H
    primarykey
    data
    text
    <p>I am trying to write a simply code that uses nested loop, prints the character in the following pattern,</p> <pre><code>XXXXXXXXXX XXXXXXXXX XXXXXXXX XXXXXXX XXXXXX XXXXX XXXX XXX XX X </code></pre> <p>and here is the code, and The code works absolutely fine</p> <pre><code> MOV AX, @DATA ; INITIALIZE DS MOV DS, AX ; PRINT X MOV CX,10 MOV BX,10 L2: PUSH CX MOV CX,BX L1: MOV DX, OFFSET HW ; LOAD THE STRING MOV AH,09H INT 21H Loop L1 SUB BX,01 POP CX MOV DX,0AH MOV AH,02H INT 21H Loop L2 MOV AH, 4CH ; RETURN CONTROL TO DOS INT 21H </code></pre> <p>but as soon as i use clear screen using video interrupt the output completely mess up,</p> <p>Here is the output,</p> <pre><code>XXXXXXXXXX XXXXXXXXX XXXXXXXX XXXXXXX XXXXXX XXXXX XXXX XXX XX X </code></pre> <p>and here is the code for it,</p> <pre><code>.MODEL SMALL .STACK 100H .DATA HW DB "X$" .CODE MAIN PROC MOV AX, @DATA ; INITIALIZE DS MOV DS, AX ; CLEAR SCREEN MOV AH, 06H MOV AL, 00H MOV CX, 00H MOV DH, 25 MOV DL, 80 MOV BH, 0FH INT 10H ; PRINT X MOV CX,10 MOV BX,10 L2: PUSH CX MOV CX,BX L1: MOV DX, OFFSET HW ; LOAD THE STRING MOV AH,09H INT 21H Loop L1 SUB BX,01 POP CX MOV DX,0AH MOV AH,02H INT 21H Loop L2 MOV AH, 4CH ; RETURN CONTROL TO DOS INT 21H MAIN ENDP END MAIN </code></pre> <p>but when i remove the line feed that leave a line after each iteration, i.e</p> <pre><code>MOV DX,0AH MOV AH,02H INT 21H </code></pre> <p>the output is following as expected,</p> <pre><code>XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX </code></pre> <p>I donot understand what the clear screen code has to do with the line feed code ? why they are messing up with each other. ?</p> <p>Same issue occur when i am using Cursor Position set code instead of clear screen,</p> <pre><code>MOV AH, 02H MOV BH, 00H MOV CX, 0000H MOV DX, 0C22H INT 10H </code></pre> <p>The output suppose to be the following in the middle of my screen,</p> <pre><code>XXXXXXXXXX XXXXXXXXX XXXXXXXX XXXXXXX XXXXXX XXXXX XXXX XXX XX X </code></pre> <p>but it is displaying as below,</p> <pre><code> XXXXXXXXXX XXXXXXXXX XXXXXXXX XXXXXXX XXXXXX XXXXX X XX XXX XX X </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload