Subversion Repositories Kolibri OS

Rev

Rev 2028 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
31 halyavin 1
; Originally written by Jarek Pelczar
2
include "lang.inc"
485 heavyiron 3
include "..\..\..\macros.inc"
31 halyavin 4
 
5
WND_SIZE_X		= 320
6
WND_SIZE_Y		= 200
7
 
8
MEOS_APP_START
9
CODE
10
    fninit
2597 clevermous 11
    mcall 40,101b
31 halyavin 12
    call init_palette
13
    call init_texture
14
    jmp .paint_window
15
.event_loop:
2597 clevermous 16
    mcall 23,1
31 halyavin 17
    test eax,eax
18
    je .draw_screen
19
    dec eax
20
    je .paint_window
21
 
22
    or  eax,-1
485 heavyiron 23
    mcall
31 halyavin 24
 
25
.draw_screen:
2597 clevermous 26
    xor ebp,ebp
27
    mcall 65,virtual_screen_8,,0,8,_palette
31 halyavin 28
    call rotate_pal
29
    jmp .event_loop
30
 
31
.paint_window:
2597 clevermous 32
    mcall 12,1
31 halyavin 33
 
2597 clevermous 34
    mcall 48,4 ; get skin height
35
    lea ecx,[eax + (110 shl 16) + WND_SIZE_Y + 4]
485 heavyiron 36
    mov edi,title
2597 clevermous 37
    mcall 0,<110,WND_SIZE_X+9>,,0x74000000
31 halyavin 38
 
2597 clevermous 39
    xor ebp,ebp
40
    mcall 65,virtual_screen_8,,0,8,_palette
31 halyavin 41
 
2597 clevermous 42
    mcall 12,2
31 halyavin 43
 
44
    jmp .event_loop
45
 
46
init_palette:
47
    mov edi,_palette
48
    mov ecx,64
49
    xor eax,eax
50
.color1:
51
    inc ah
52
    mov al,ah
53
    stosb
54
    xor al,al
55
    stosb
56
    stosb
2597 clevermous 57
    stosb
31 halyavin 58
    loop .color1
59
    mov ecx,64
60
    push ecx
61
    xor eax,eax
62
.color2:
63
    mov al,63
64
    stosb
65
    mov al,ah
66
    stosb
67
    xor al,al
68
    stosb
2597 clevermous 69
    stosb
31 halyavin 70
    inc ah
71
    loop .color2
72
    pop ecx
73
    push ecx
74
    xor eax,eax
75
.color3:
76
    mov al,63
77
    stosb
78
    stosb
79
    mov al,ah
80
    stosb
2597 clevermous 81
    mov al,0
82
    stosb
31 halyavin 83
    inc ah
84
    loop .color3
85
    pop ecx
86
    mov eax,0x003f3f3f
87
    rep stosd
88
    ret
89
 
90
init_texture:
91
    fldpi
92
    mov [_fpom16],180
93
    fidiv [_fpom16]
94
    fstp [_st_rad]
95
    mov edi,virtual_screen_8
96
    cdq
97
.itex_vertical:
98
    xor ecx,ecx
99
    fld [_st_rad]
100
    mov [_fpom16],5
101
    fimul [_fpom16]
102
    mov [_fpom16],dx
103
    fimul [_fpom16]
104
    fsin
105
    fmul [_multiplier]
106
    fstp [_fpom32]
107
.itex_horizontal:
108
    fld [_st_rad]
109
    mov [_fpom16],3
110
    fimul [_fpom16]
111
    mov [_fpom16],cx
112
    fimul [_fpom16]
113
    fsin
114
    fmul [_multiplier]
115
    fadd [_fpom32]
116
    mov [_fpom16],127
117
    fiadd [_fpom16]
118
    fistp [_fpom16]
119
    mov ax,[_fpom16]
120
    inc eax
121
    stosb
122
    inc ecx
123
    cmp ecx,WND_SIZE_X
124
    jne .itex_horizontal
125
    inc edx
126
    cmp edx,WND_SIZE_Y
127
    jne .itex_vertical
128
    ret
129
 
130
rotate_pal:
131
    mov ebx,[_palette+4]
132
    mov edi,_palette+4
133
    mov esi,_palette+8
134
    xor ecx,ecx
135
    mov cl,255
136
;    cld
137
    rep movsd
138
    mov [_palette+1020],ebx
139
    ret
140
 
141
DATA
142
  _multiplier	dd 63.5
143
 
485 heavyiron 144
  title          db 'Plasma',0
31 halyavin 145
 
146
UDATA
147
  _fpom32		rd 1
148
  _fpom16		rw 1
149
  _st_rad		rd 1
150
  _palette:	rd 256
151
 
152
  virtual_screen_8:
153
   	rb WND_SIZE_X*WND_SIZE_Y
154
 
155
MEOS_APP_END