Solved programming problem

Draw a Triangle in Assembly.

Source code

org 100h

.model small

.data

x dw 40

y dw 100

.code

main proc

    mov dx, @data

    mov ds, dx

   

    mov ah, 0

    mov al, 12h

    int 10h

   

mov x,0

mov y,0

 

     A:       ;A(10,5);

      mov ah, 0ch

      mov al, 10

      mov cx, x

      mov dx, y

      int 10h

      inc x

      inc x

      inc y

      cmp x, 10

      jle A

     

    mov x,0

    mov y,0

   

     C:          ;C(0,5)

      mov ah, 0ch

      mov al, 10

      mov cx, x

      mov dx, y

      int 10h

      inc y

      cmp y, 5

      jle C    

   

     B:          ;B(0,0)

      mov ah, 0ch

      mov al, 10

      mov cx, 0

      mov dx, 0

      int 10h

     

    mov x,0

    mov y,5

         

   lowerLine:          ;lower(0,10) .......

      mov ah, 0ch

      mov al, 10

      mov cx, x

      mov dx, y

      int 10h

      inc x

      cmp x, 10

      jle lowerLine  

           

    mov ah, 4ch

    int 21h

   

endp

end main

Output

Output:

Join the discussion

Add your comment