< -->
;vdp.asm
;Решение уравнения Ван-дер-Поля
.model tiny
.286
.287
.code
org 100h
start proc near
cld
push 0A000h
pop es
mov ax, 0012h
int 10h
finit
xor si, si
fld1
fild word ptr hinv
fdiv
again:
fild word ptr m
fld st(1)
fldz
call _display
g_key:
mov ah, 10h
int 16h
cmp al, 1Bh
jz g_out
cmp al, '0'
jb g_key
cmp al, '8'
ja g_key
sub al, '0'
mov byte ptr m, al
fstp st(0)
fstp st(0)
fstp st(0)
jmp short again
g_out:
mov ax, 0003h
int 10h
ret
start endp
_display proc near
dismore:
mov bx, 0
mov cx, si
shr cx, 1
mov dx, 240
sub dx, word ptr ix[si]
call putpixel1b
call next_x
mov bx, 1
mov dx, 240
sub dx, word ptr ix[si]
call putpixel1b
inc si
inc si
cmp si, 640*2
jl not_endscreen
sub si, 640*2
not_endscreen:
mov dx, 5000
xor cx, cx
mov ah, 86h
int 15h
mov ah, 11h
int 16h
jz dismore
ret
_display endp
next_x proc near
fld1
fld st(2)
fmul st, st(3)
fsub
fld st(3)
fmul
fld st(1)
fmul
fld st(2)
fsub
fld st(4)
fmul
fld st(1)
fadd
fxch
fld st(4)
fmul
faddp st(2),st
fld st(1)
fild word ptr c_100
fmul
fistp word ptr ix[si]
ret
next_x endp
putpixel1b proc near
pusha
push bx
xor bx, bx
mov ax, dx
imul ax, ax, 80
push cx
shr cx, 3
add ax, cx
mov di, ax
mov si, di
pop cx
mov bx, 0080h
and cx, 07h
shr bx, cl
lods es:byte ptr ix
pop dx
dec dx
js black
or ax, bx
jmp short white
black:not bx
and ax, bx
white:stosb
popa
ret
putpixel1b endp
m dw 1
c_100 dw 100
hinv dw 32
ix:
end start
Назад