assembly - Assembler plump/water animation -
i new in assembler , looking easy solution how insert loop in code. can guys give me tip or answer? found articles on google , cannot understand them cuz dumb, though. i've projeckt: animation of water, http://kino-ap.eng.hokudai.ac.jp/all-lif.gif http://thumbs.dreamstime.com/z/circular-splash-drop-water-blue-forming-circle-waves-liquid-surface-37560386.jpg
i want use circle found code
; nasm -o999 -o kolo.com -f bin kolo.asm
org 100h mov ax, 13h int 10h mov ax, 0a000h mov es, ax mov cx, 360 finit fldpi fild word [sto80] fdivp st1, st0 ; pi/180 fld1 fild word [r] ; r, 1, pi/180 fldz ; angle=0, r, 1, pi/180 mov al, 15 draw: fld st0 ; angle, angle, r, 1, pi/180 fmul st4 ; angle in radius mov di, 100*320 + 160 ; middle of screen fsin ; sin(angle), angle, r, 1, pi/180 fmul st2 ; sin(angle)*r, angle, r, 1, pi/180 fistp word [height] ; angle, r, 1, pi/180 fld st0 ; angle, angle, r, 1, pi/180 fmul st4 ; angle in radius fcos ; cos(angle),angle, r, 1, pi/180 fmul st2 ; r*cos(angle), angle, r, 1, pi/180 fistp word [width] ; angle, r, 1, pi/180 add di, [width] ; add horizontal length mov dx, [height] mov bx, dx shl dx, 8 shl bx, 6 add dx, bx ; dx = height*320 sub di, dx ; subtract vertical distance mov [es:di], al ; show pixel fadd st0, st2 ; angle += 1 dec cx jnz draw finit xor ah, ah int 16h mov ax, 3 int 10h mov ax, 4c00h int 21h r dw 50 width dw 0 height dw 0 sto80 dw 180
for want add 1 circle increased . need add loop increment r (for r=0;r<300;r++. after r==300 change r=0) , redraw , maybe hide last circle pixels?
you should not let radius bigger 99 because dimensions of screen 320x200 , drawing center of screen no checks on outcome of address calculation in di register.
to desired loop make following changes:
org 100h mov ax, 0013h int 10h mov ax, 0a000h mov es, ax nextcircle: ; add mov cx, 360 ... fadd st0, st2 ; angle += 1 dec cx jnz draw xor ah, ah ; maybe add (to wait between circles) int 16h ; maybe add (to wait between circles) inc word [r] ; add cmp word [r], 100 ; add jb nextcircle ; add finit xor ah, ah int 16h mov ax, 0003h int 10h mov ax, 4c00h int 21h
to hide previous circle can redraw using black color (al=0).
Comments
Post a Comment