Reputation: 23
I'm trying to draw a triangle in assembly using fasm but I just can't make it. I have the following code to draw a rectangle and I thought that I should just decrease the [comp] value inside the cycle "ciclopinta" but that just doesn't work (or I'm doing it wrong).
org 100h
mov ah,4fh
mov al,02h
mov bx,13h
int 10h
mov [alt],50
mov [comp], 100
mov dx, 100
mov cx,100
ciclopinta:
ciclo1:
mov ah,0ch
mov al,23h
mov bh, 0
int 10h
dec cx
dec byte[comp]
jnz ciclo1
mov cx, 100
mov [comp],100
dec dx
dec byte [alt]
jnz ciclopinta
mov ah, 07h
int 21h
mov ah,4ch
int 21h
comp rb 1
alt rb 1
Upvotes: 1
Views: 2210
Reputation: 39191
mov ah,4fh mov al,02h mov bx,13h int 10h
Why are you using a VESA function to set a legacy video mode? Normally that shouldn't work. Better use the following:
mov ax, 0013h ;320x200 256-colors
int 10h
Near the end of the program you use the BIOS function 07h to ScrollWindowUp but you don't setup all the parameters for it to work. Best remove these lines mov ah, 07h
int 21h
Your idea to decrement the comp variable is good. I suggest you write:
dec dx
mov [comp], dl ;It's a byte-sized variable
Upvotes: 3