Subversion Repositories Kolibri OS

Rev

Rev 2659 | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 2659 Rev 9525
Line 1... Line 1...
1
; App written by randall ported to Kolibri and MenuetOS64 by macgub (www.macgub.hekko.pl). 
1
; App written by randall ported to Kolibri and MenuetOS64 by macgub (www.macgub.hekko.pl). 
2
; Now it use static memory, it is mixed 32bit code and SSE instructions.
2
; Now it use static memory, it is mixed 32bit code and SSE instructions.
Line 3... Line 3...
3
 
3
 
-
 
4
include '../../../macros.inc'
Line 4... Line 5...
4
include '../../../macros.inc'
5
include '../../../KOSfuncs.inc'
5
 
-
 
6
use32
6
 
Line 7... Line 7...
7
 
7
use32
8
               org    0x0
8
                org         0x0
9
 
9
 
10
               db     'MENUET01'              ; 8 byte id
10
                db          'MENUET01'           ; 8 byte id
11
               dd     0x01                    ; header version
11
                dd          0x01                 ; header version
12
               dd     START                   ; start of code
12
                dd          START                ; start of code
13
               dd     IMG_END                   ; size of image
13
                dd          IMG_END              ; size of image
Line 14... Line 14...
14
               dd     I_END ;0x100000                ; memory for app
14
                dd          I_END ;0x100000      ; memory for app
-
 
15
                dd          I_END ;0xbffff       ; esp
Line 15... Line 16...
15
               dd     I_END ;0xbffff                 ; esp
16
                dd          0x0 , 0x0            ; I_Param , I_Icon
-
 
17
 
16
               dd     0x0 , 0x0               ; I_Param , I_Icon
18
; start of execution
17
 
19
START:
Line 18... Line -...
18
START:                          ; start of execution
-
 
19
 
-
 
20
     call draw_window
-
 
21
     call Main
20
 
Line -... Line 21...
-
 
21
                call        draw_window
Line 22... Line -...
22
     call draw_from_buffer
-
 
23
 
-
 
24
still:
-
 
25
 
-
 
26
 
-
 
27
;     call Main
-
 
28
 
-
 
29
 
-
 
30
;            mov eax,7
-
 
31
;            mov ebx,screen
-
 
32
;            mov ecx,IMG_SIZE*65536+IMG_SIZE
-
 
33
;            mov edx,0*65536+0
-
 
34
;            int 0x40
-
 
35
 
-
 
36
;    mov  eax,23                 ; wait here for event
-
 
37
;    mov  ebx,timeout
22
		    call        draw_from_buffer
38
;    int  0x40
-
 
39
 ;   mov eax,11                   ; check for event no wait
-
 
40
    mov eax,10                  ; wait for event
-
 
Line -... Line 23...
-
 
23
                call        Main
-
 
24
                call        draw_from_buffer
-
 
25
                
-
 
26
                mcall       SF_SET_CAPTION,1,wintitle2
-
 
27
 
-
 
28
still:
41
    int 0x40
29
 
Line 42... Line 30...
42
 
30
                mcall       SF_WAIT_EVENT
43
    cmp  eax,1                  ; redraw request ?
31
 
44
    je   red
32
                cmp         eax,EV_REDRAW
45
    cmp  eax,2                  ; key in buffer ?
33
                je          .redraw
Line -... Line 34...
-
 
34
                cmp         eax,EV_KEY
46
    je   key
35
                je          .key
47
    cmp  eax,3                  ; button in buffer ?
36
                cmp         eax,EV_BUTTON
48
    je   button
-
 
49
 
-
 
50
    jmp  noclose
37
                je          .button
51
 
38
                jmp         still
52
  red:                          ; redraw
39
                
53
    call draw_window
-
 
54
    call draw_from_buffer
-
 
55
    jmp  still
-
 
56
 
40
      .redraw:
57
  key:                          ; key
41
                call        draw_window
58
    mov  eax,2                  ; just read it and ignore
-
 
Line -... Line 42...
-
 
42
                call        draw_from_buffer
-
 
43
                jmp         still
59
    int  0x40
44
 
60
    shr  eax,8
45
      .key:
Line 61... Line -...
61
    cmp  eax, 27
-
 
62
    jne  still
46
                mcall       SF_GET_KEY
63
    mov  eax, -1
47
                shr         eax,16                ; get scancode in 'al'
Line 64... Line -...
64
    int  0x40
-
 
Line -... Line 48...
-
 
48
                cmp         al,1
-
 
49
                je          .exit
-
 
50
                cmp         al,66
-
 
51
                je          set_as_wallpaper
-
 
52
                jmp         still
-
 
53
 
Line 65... Line 54...
65
 
54
      .button:
66
 
-
 
67
  button:                       ; button
55
                mcall       SF_GET_BUTTON
68
    mov  eax,17                 ; get id
-
 
69
    int  0x40
56
                cmp         ah,1                   ; button id=1 ?
70
 
-
 
71
    cmp  ah,1                   ; button id=1 ?
57
                jne         still
72
    jne  noclose
58
 
Line 73... Line 59...
73
 
59
      .exit:
74
    mov  eax,-1                 ; close this program
60
                mcall       SF_TERMINATE_PROCESS
75
    int  0x40
61
 
Line 321... Line 307...
321
;   *********************************************
307
;   *********************************************
322
;   *******  WINDOW DEFINITIONS AND DRAW ********
308
;   *******  WINDOW DEFINITIONS AND DRAW ********
323
;   *********************************************
309
;   *********************************************
324
draw_window:
310
draw_window:
Line 325... Line 311...
325
 
311
 
Line 326... Line 312...
326
    mcall 12, 1                                   ; function 12:tell os about windowdraw
312
                mcall       SF_REDRAW, SSF_BEGIN_DRAW
327
    
313
    
328
	mcall 48, 4                                   ;get skin width
-
 
329
	lea	ecx, [50*65536+IMG_SIZE+4+eax]            ; [y start] *65536 + [y size] + [skin_height]
-
 
330
	mcall	0,<50,IMG_SIZE+9>,,0x74000000,,labelt ;draw window
314
                mcall       SF_STYLE_SETTINGS, SSF_GET_SKIN_HEIGHT
Line -... Line 315...
-
 
315
                lea         ecx, [50*65536+IMG_SIZE+4+eax]            ; [y start] *65536 + [y size] + [skin_height]
331
 
316
                mcall       SF_CREATE_WINDOW,<50,IMG_SIZE+9>,,0x74000000,,wintitle1
Line 332... Line -...
332
    mcall 12, 2                                   ; function 12:tell os about windowdraw
-
 
333
 
317
 
334
    ret
318
                mcall       SF_REDRAW, SSF_END_DRAW
335
 
-
 
336
 
319
                ret
337
 
-
 
-
 
320
 
Line 338... Line 321...
338
;-------------------------------------------------------------------------------
321
 
339
align 1
322
;-------------------------------------------------------------------------------
340
labelt:
323
align 1
341
 db  'buddhabrot',0
324
wintitle1       db          'Buddhabrot - Calculating, please wait...',0
Line 351... Line 334...
351
g_rand_scale    dd          2.3283064e-10 ; 1.0 / 2^32
334
g_rand_scale    dd          2.3283064e-10 ; 1.0 / 2^32
Line 352... Line 335...
352
 
335
 
353
IMG_SIZE=600
336
IMG_SIZE        =           600
354
SEQ_SIZE=50
337
SEQ_SIZE        =           50
-
 
338
ITERATIONS      =           100
355
ITERATIONS=100
339
 
356
g_img_size      dd          600.0
340
g_img_size      dd          600.0
357
g_offsetx       dd          0.5
341
g_offsetx       dd          0.5
358
g_offsety       dd          0.0
342
g_offsety       dd          0.0
Line 365... Line 349...
365
g_1_0           dd          1.0
349
g_1_0           dd          1.0
366
g_255_0         dd          255.0
350
g_255_0         dd          255.0
Line 367... Line 351...
367
 
351
 
368
IMG_END:
352
IMG_END:
369
;--------------------
-
 
370
sequence:
353
;--------------------
371
   rb          SEQ_SIZE*8
-
 
372
screen:
354
sequence:       rb          SEQ_SIZE*8
373
   rb          IMG_SIZE*IMG_SIZE*4
-
 
374
memStack:
355
screen:         rb          IMG_SIZE*IMG_SIZE*4
375
   rd          1024
356
memStack:       rd          1024
376
I_END:
357
I_END: