Rev 1779 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 1779 | Rev 2022 | ||
---|---|---|---|
Line 1... | Line 1... | ||
1 | ; |
1 | ; |
2 | ; application : 3d shaking waved spiral |
2 | ; application : 3d shaking waved spiral |
3 | ; compilator : fasm |
3 | ; compilator : fasm |
4 | ; system : MenuetOS |
4 | ; system : KolibriOS |
5 | ; author : macgub |
5 | ; author : macgub |
6 | ; email : macgub3@wp |
6 | ; email : macgub3@wp |
Line 7... | Line 7... | ||
7 | 7 | ||
8 | timeout equ 3 |
8 | timeout equ 3 |
9 | maxx equ 600 ; window size |
9 | maxx equ 616 ; window size |
10 | maxy equ 420 |
10 | maxy equ 420 |
Line 11... | Line 11... | ||
11 | use32 |
11 | use32 |
Line 12... | Line 12... | ||
12 | 12 | ||
13 | org 0x0 |
13 | org 0x0 |
14 | 14 | ||
15 | db 'MENUET01' ; 8 byte id |
15 | db 'MENUET01' ; 8 byte id |
16 | dd 0x01 ; header version |
16 | dd 0x01 ; header version |
17 | dd START ; start of code |
17 | dd START ; start of code |
18 | dd I_END ; size of image |
18 | dd I_END ; size of image |
Line 19... | Line 19... | ||
19 | dd 0x100000 ; memory for app |
19 | dd 0x100000 ; memory for app |
Line 20... | Line 20... | ||
20 | dd 0xbffff ; esp |
20 | dd 0xbffff ; esp |
Line 21... | Line 21... | ||
21 | dd 0x0 , 0x0 ; I_Param , I_Icon |
21 | dd 0x0 , 0x0 ; I_Param , I_Icon |
Line 22... | Line 22... | ||
22 | 22 | ||
23 | START: ; start of execution |
23 | START: ; start of execution |
24 | 24 | ||
25 | call draw_window |
25 | call draw_window |
26 | 26 | ||
Line 27... | Line 27... | ||
27 | still: |
27 | still: |
28 | 28 | ||
29 | ; mov eax,23 ; wait here for event |
29 | ; mov eax,23 ; wait here for event |
30 | ; mov ebx,timeout |
30 | ; mov ebx,timeout |
31 | ; int 0x40 |
31 | ; int 0x40 |
32 | mov eax,11 ; check for event no wait |
32 | mov eax,11 ; check for event no wait |
Line 33... | Line 33... | ||
33 | int 0x40 |
33 | int 0x40 |
Line 34... | Line 34... | ||
34 | 34 | ||
35 | cmp eax,1 ; redraw request ? |
35 | cmp eax,1 ; redraw request ? |
36 | je red |
36 | je red |
Line 37... | Line 37... | ||
37 | cmp eax,2 ; key in buffer ? |
37 | cmp eax,2 ; key in buffer ? |
38 | je key |
38 | je key |
39 | cmp eax,3 ; button in buffer ? |
39 | cmp eax,3 ; button in buffer ? |
- | 40 | je button |
|
- | 41 | ||
40 | je button |
42 | jmp noclose |
- | 43 | ||
- | 44 | red: ; redraw |
|
- | 45 | call draw_window |
|
Line 41... | Line 46... | ||
41 | 46 | jmp still |
|
42 | jmp noclose |
47 | |
43 | 48 | key: ; key |
|
Line 44... | Line 49... | ||
44 | red: ; redraw |
49 | mov eax,2 ; just read it and ignore |
45 | call draw_window |
50 | int 0x40 |
Line 46... | Line 51... | ||
46 | jmp still |
51 | shr eax,8 |
47 | 52 | cmp eax, 27 |
|
48 | key: ; key |
53 | jne still |
Line 49... | Line 54... | ||
49 | mov eax,2 ; just read it and ignore |
54 | mov eax, -1 |
50 | int 0x40 |
55 | int 0x40 |
Line 83... | Line 88... | ||
83 | push [z] |
88 | push [z] |
84 | call calc_sin_variable |
89 | call calc_sin_variable |
85 | oop: |
90 | oop: |
86 | push [x] |
91 | push [x] |
87 | ; call getcol ;(x,z) |
92 | ; call getcol ;(x,z) |
88 | call fun ; calculates y and y1 |
93 | call fun ; calculates y and y1 |
89 | ; call rotateY |
94 | ; call rotateY |
90 | mov eax,[sin_variable] |
95 | mov eax,[sin_variable] |
91 | add eax,[vector_x] ; vector_x |
96 | add eax,[vector_x] ; vector_x |
92 | add [x],eax |
97 | add [x],eax |
93 | mov eax,[vector_y] |
98 | mov eax,[vector_y] |
94 | add [y],eax ; vector_y |
99 | add [y],eax ; vector_y |
95 | add [y1],eax |
100 | add [y1],eax |
96 | call point_perspective |
101 | call point_perspective |
97 | call draw_point_3d |
102 | call draw_point_3d |
98 | pop [x] |
103 | pop [x] |
99 | inc [x] |
104 | inc [x] |
Line 107... | Line 112... | ||
107 | jne oopz |
112 | jne oopz |
Line 108... | Line 113... | ||
108 | 113 | ||
109 | mov eax,7 |
114 | mov eax,7 |
110 | mov ebx,screen_buf |
115 | mov ebx,screen_buf |
111 | mov ecx,maxx*65536+maxy |
116 | mov ecx,maxx*65536+maxy |
112 | mov edx,20*65536+20 |
117 | mov edx,0*65536+0 |
Line 113... | Line 118... | ||
113 | int 0x40 |
118 | int 0x40 |
114 | 119 | ||
Line 280... | Line 285... | ||
280 | fchs |
285 | fchs |
281 | fiadd [yobs] |
286 | fiadd [yobs] |
282 | fistp [y1] |
287 | fistp [y1] |
283 | ret |
288 | ret |
284 | calc_sin_variable: |
289 | calc_sin_variable: |
285 | ;calculate sinus variable |
290 | ;calculate sinus variable |
286 | fldpi |
291 | fldpi |
287 | fidiv [sin_gran] |
292 | fidiv [sin_gran] |
288 | fimul [sin_counter] |
293 | fimul [sin_counter] |
289 | fadd [current_deg] |
294 | fadd [current_deg] |
290 | fsin |
295 | fsin |
Line 358... | Line 363... | ||
358 | ; ********************************************* |
363 | ; ********************************************* |
359 | ; ******* WINDOW DEFINITIONS AND DRAW ******** |
364 | ; ******* WINDOW DEFINITIONS AND DRAW ******** |
360 | ; ********************************************* |
365 | ; ********************************************* |
361 | draw_window: |
366 | draw_window: |
Line 362... | Line 367... | ||
362 | 367 | ||
363 | mov eax,12 ; function 12:tell os about windowdraw |
368 | mov eax,12 ; function 12:tell os about windowdraw |
364 | mov ebx,1 ; 1, start of draw |
369 | mov ebx,1 ; 1, start of draw |
365 | int 0x40 |
370 | int 0x40 |
366 | ; DRAW WINDOW |
371 | ; DRAW WINDOW |
367 | mov eax,0 ; function 0 : define and draw window |
372 | mov eax,0 ; function 0 : define and draw window |
368 | mov ebx,100*65536+maxx+25 ; [x start] *65536 + [x size] |
373 | mov ebx,100*65536+maxx+9 ; [x start] *65536 + [x size] |
369 | mov ecx,100*65536+maxy+25 ; [y start] *65536 + [y size] |
374 | mov ecx,100*65536+maxy+25 ; [y start] *65536 + [y size] |
370 | mov edx,0x02000000 ; color of work area RRGGBB,8->color gl |
- | |
371 | mov esi,0x805080d0 ; color of grab bar RRGGBB,8->color gl |
375 | mov edx,0x74000000 ; color of work area RRGGBB,8->color gl |
372 | mov edi,0x005080d0 ; color of frames RRGGBB |
376 | mov edi,labelt |
373 | int 0x40 |
- | |
374 | ; WINDOW LABEL |
- | |
375 | mov eax,4 ; function 4 : write text to window |
- | |
376 | mov ebx,8*65536+8 ; [x start] *65536 + [y start] |
- | |
377 | mov ecx,0x10ddeeff ; font 1 & color ( 0xF0RRGGBB ) |
- | |
378 | mov edx,labelt ; pointer to text beginning |
- | |
379 | mov esi,labellen-labelt ; text length |
377 | int 0x40 |
380 | int 0x40 |
- | |
381 | ; CLOSE BUTTON |
- | |
382 | mov eax,8 ; function 8 : define and draw button |
- | |
383 | mov ebx,(maxx+25-19)*65536+12 ; [x start] *65536 + [x size] |
- | |
384 | mov ecx,5*65536+12 ; [y start] *65536 + [y size] |
- | |
385 | mov edx,1 ; button id |
- | |
386 | mov esi,0x6688dd ; button color RRGGBB |
- | |
387 | int 0x40 |
- | |
388 | 378 | ; WINDOW LABEL |
|
389 | mov eax,12 ; function 12:tell os about windowdraw |
379 | mov eax,12 ; function 12:tell os about windowdraw |
390 | mov ebx,2 ; 2, end of draw |
380 | mov ebx,2 ; 2, end of draw |
Line 391... | Line 381... | ||
391 | int 0x40 |
381 | int 0x40 |
Line 392... | Line 382... | ||
392 | 382 | ||
Line 409... | Line 399... | ||
409 | ;yoo dd 20 |
399 | ;yoo dd 20 |
410 | ;subx dd ? |
400 | ;subx dd ? |
411 | ;suby dd ? |
401 | ;suby dd ? |
412 | ;subz dd ? |
402 | ;subz dd ? |
Line 413... | Line 403... | ||
413 | 403 | ||
414 | xobs dd maxx/2 ; 320 observer variables |
404 | xobs dd maxx/2 ; 320 observer variables |
415 | yobs dd maxy/2 ; 175 |
405 | yobs dd maxy/2 ; 175 |
416 | zobs dd -200 |
406 | zobs dd -200 |
417 | xobssub dd ? |
407 | xobssub dd ? |
418 | yobssub dd ? |
408 | yobssub dd ? |
419 | y1obssub dd ? |
409 | y1obssub dd ? |
Line 420... | Line 410... | ||
420 | zobssub dd ? |
410 | zobssub dd ? |
421 | 411 | ||
422 | sin_variable dd ? |
412 | sin_variable dd ? |
423 | sin_mul dd 60 |
413 | sin_mul dd 60 |
424 | sin_gran dd 30 |
414 | sin_gran dd 30 |
425 | sin_counter dd 0 |
415 | sin_counter dd 0 |
426 | sq dd 724 ; round( (sqrt2)/2*1024 ) |
416 | sq dd 724 ; round( (sqrt2)/2*1024 ) |
427 | z dd ? |
417 | z dd ? |
428 | x dd ? |
418 | x dd ? |
429 | y dd ? |
419 | y dd ? |
430 | y1 dd ? |
420 | y1 dd ? |
431 | xo dd 70 ; center point , (loop counter-1)/2 |
421 | xo dd 70 ; center point , (loop counter-1)/2 |
432 | yo dd 20 |
422 | yo dd 20 |
433 | a dd 70 ; vertical half-axle |
423 | a dd 70 ; vertical half-axle |
434 | b dd 20 ; horizontal half-axle |
424 | b dd 20 ; horizontal half-axle |
Line 435... | Line 425... | ||
435 | loop_counter dd 141 ; axle granularity |
425 | loop_counter dd 141 ; axle granularity |
436 | col dd 0x00ffffff |
426 | col dd 0x00ffffff |
437 | 427 | ||
438 | labelt: |
428 | labelt: |
Line 439... | Line 429... | ||
439 | db ' 3D SHAKING WAVED SPIRAL' |
429 | db ' 3D shaking waved spiral',0 |