You are on page 1of 3

Program: graph.

asm;
.MODEL small
.STACK 256

.DATA

.CODE

jmp start

mode db 18 ;640 x 480


x_center dw 300
y_center dw 200
y_value dw 0
x_value dw 100
decision dw 1
colour db 1

begin:
mov ah,00
mov al,mode
int 10h

mov bx, x_value


sub decision, bx
mov al,colour
mov ah,0ch

drawcircle:
mov al,colour
mov ah,0ch

mov cx, x_value


add cx, x_center
mov dx, y_value
add dx, y_center
int 10h

mov cx, x_value


neg cx
add cx, x_center
int 10h

mov cx, y_value


add cx, x_center
mov dx, x_value
add dx, y_center
int 10h

mov cx, y_value


neg cx
add cx, x_center
int 10h

mov cx, x_value


add cx, x_center
mov dx, y_value
neg dx
add dx, y_center
int 10h

mov cx, x_value


neg cx
add cx, x_center
int 10h

mov cx, y_value


add cx, x_center
mov dx, x_value
neg dx
add dx, y_center
int 10h

mov cx, y_value


neg cx
add cx, x_center
int 10h

inc y_value

condition1:
cmp decision,0
ja condition2
mov cx, y_value
mov ax, 2
imul cx
add cx, 1
inc cx
add decision, cx
mov bx, y_value
mov dx, x_value
cmp bx, dx
ja readkey
jmp drawcircle

condition2:
dec x_value
mov cx, y_value
sub cx, x_value
mov ax, 2
imul cx
inc cx
add decision, cx
mov bx, y_value
mov dx, x_value
cmp bx, dx
ja readkey
jmp drawcircle

readkey:
mov ah,00
int 16h ;wait for keypress

endd:
mov ah,00 ;again subfunc 0
mov al,03 ;text mode 3
int 10h ;call int
mov ah,04ch
mov al,00 ;end program normally
int 21h

END begin

You might also like