Shapes In A Plane by Fizzer
; shapes in a plane
; by fizzer
;cpu 486
org 0x100
bits 16
mov al, 0x13
int 0x10
push word 0xa000
pop es
push word 0x0040
pop fs
mainloop:
dec cx
xor di, di
mov ax, word [fs:0x6C]
shr ax, 7
and ax, 6
add ax, 4
mov word [sides], ax
pixelloop:
push cx
push di
mov ax, 0xCCCD
mul di
xor ax, ax
mov al, dl
mov word [dirx], ax
mov al, dh
mov word [diry], ax
mov dl, 70
mov si, 65535
mov bx, word [speed2]
call shape
add word [dirx], bx
call shape
add word [diry], bx
call shape
sub word [dirx], bx
call shape
and dx, si
mov ax, dx
pop di
stosb
pop cx
dec cx
jnz pixelloop
in al, 60h
cmp al, 1
jnz mainloop
myfunc:
fxch st2
fidiv word [speed]
fld st0
frndint
fsubp
fmulp
ret
shape:
fldz
fst dword [dist]
mov cx, word [sides]
poly:
fild word [diry]
fild word [dirx]
fild word [fs:0x6C]
faddp
fld st2
fsincos
call myfunc
call myfunc
faddp
fld dword [dist]
fcomi
fcmovb st0, st1
fstp dword [dist]
fstp st0
fld dword [twopi]
fidiv word [sides]
faddp
loop poly
fld dword [dist]
fld dword [thresh]
fild word [fs:0x6C]
fidiv word [speed]
fsin
fmul dword [thresh]
fmul dword [thresh]
faddp
fcomi
jb notgreater2
add dx, 3
notgreater2:
fsubp
fabs
fld1
fidiv word [speed]
fcomip
jb notgreater3
xor si, si
notgreater3:
fstp st0
ret
section .data
speed dw 100
speed2 dw 50
thresh dd 0.3
twopi dd 6.283185307179586
section .bss
dirx resw 1
diry resw 1
dist resd 1
sides resw 1
[ back to the prod ]
