I am trying to get the square of a number between 0 and 9, and then I will use that number to create the height of the rectangle.
What I've tried is using the sum method Ex: 5*5 = 25
and 5+5+5+5+5 = 25
;Keyboard Input
mov ah, 3Fh
mov bx, 0
mov cx, 1
mov dx, num
int 21h
;Multiplication
sub [num], 48
mov al,[num]
mov bl,[num]
mult:
add al, [num]
dec bl
jnz mult
I am wondering if this correct because when I insert the number 7 (7*7) = 49 I think it exceeds the value of 50 (length of the rectangle);
And when the number 0 is inserted this strange behaviour happens:
Code to create the rectangle:
mov [height], al
mov cx, [pos_x]
mov dx, [pos_y]
loop_y:
loop_x:
mov ah, 0ch
mov al, [cor]
mov bh, 0
int 10h
inc cx
dec [length]
jnz loop_x
inc [pos_y]
mov dx, [pos_y]
mov cx, [pos_x]
mov [length], 50
dec [height]
jnz loop_y
Everything needs to be FASM compatible.