Subversion Repositories Kolibri OS

Rev

Rev 551 | Go to most recent revision | 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
11
    mov al,40
12
    mov bl,101b
485 heavyiron 13
    mcall
31 halyavin 14
    call init_palette
15
    call init_texture
16
    jmp .paint_window
17
.event_loop:
18
    mov al,23
19
    mov ebx,1
485 heavyiron 20
    mcall
31 halyavin 21
    test eax,eax
22
    je .draw_screen
23
    dec eax
24
    je .paint_window
25
 
26
    or  eax,-1
485 heavyiron 27
    mcall
31 halyavin 28
 
29
.draw_screen:
30
    call blit_8_to_32
31
    mov al,7
32
    mov ebx,virtual_screen_32
33
    mov ecx,(WND_SIZE_X shl 16)+WND_SIZE_Y
316 heavyiron 34
    xor edx,edx
485 heavyiron 35
    mcall
31 halyavin 36
    call rotate_pal
37
    jmp .event_loop
38
 
39
.paint_window:
40
    mov al,12
41
    push eax
42
    xor ebx,ebx
43
    inc ebx
485 heavyiron 44
    mcall
31 halyavin 45
 
46
    xor eax,eax
2028 leency 47
    mov ebx,(110 shl 16)+(WND_SIZE_X+9)
48
    mov ecx,(110 shl 16)+(WND_SIZE_Y+26)
49
    mov edx,0x74000000
485 heavyiron 50
    mov edi,title
51
    mcall
31 halyavin 52
 
53
    mov al,7
54
    mov ebx,virtual_screen_32
55
    mov ecx,(WND_SIZE_X shl 16)+WND_SIZE_Y
316 heavyiron 56
    xor edx,edx
485 heavyiron 57
    mcall
31 halyavin 58
 
59
    pop eax
60
    and ebx,2 ; bit 1 is set
485 heavyiron 61
    mcall
31 halyavin 62
 
63
    jmp .event_loop
64
 
65
init_palette:
66
    mov edi,_palette
67
    mov ecx,64
68
    xor eax,eax
69
.color1:
70
    inc ah
71
    mov al,ah
72
    stosb
73
    xor al,al
74
    stosb
75
    stosb
76
    inc edi
77
    loop .color1
78
    mov ecx,64
79
    push ecx
80
    xor eax,eax
81
.color2:
82
    mov al,63
83
    stosb
84
    mov al,ah
85
    stosb
86
    xor al,al
87
    stosb
88
    inc ah
89
    inc edi
90
    loop .color2
91
    pop ecx
92
    push ecx
93
    xor eax,eax
94
.color3:
95
    mov al,63
96
    stosb
97
    stosb
98
    mov al,ah
99
    stosb
100
    inc ah
101
    inc edi
102
    loop .color3
103
    pop ecx
104
    mov eax,0x003f3f3f
105
    rep stosd
106
    ret
107
 
108
init_texture:
109
    fldpi
110
    mov [_fpom16],180
111
    fidiv [_fpom16]
112
    fstp [_st_rad]
113
    mov edi,virtual_screen_8
114
    cdq
115
.itex_vertical:
116
    xor ecx,ecx
117
    fld [_st_rad]
118
    mov [_fpom16],5
119
    fimul [_fpom16]
120
    mov [_fpom16],dx
121
    fimul [_fpom16]
122
    fsin
123
    fmul [_multiplier]
124
    fstp [_fpom32]
125
.itex_horizontal:
126
    fld [_st_rad]
127
    mov [_fpom16],3
128
    fimul [_fpom16]
129
    mov [_fpom16],cx
130
    fimul [_fpom16]
131
    fsin
132
    fmul [_multiplier]
133
    fadd [_fpom32]
134
    mov [_fpom16],127
135
    fiadd [_fpom16]
136
    fistp [_fpom16]
137
    mov ax,[_fpom16]
138
    inc eax
139
    stosb
140
    inc ecx
141
    cmp ecx,WND_SIZE_X
142
    jne .itex_horizontal
143
    inc edx
144
    cmp edx,WND_SIZE_Y
145
    jne .itex_vertical
146
    ret
147
 
148
rotate_pal:
149
    mov ebx,[_palette+4]
150
    mov edi,_palette+4
151
    mov esi,_palette+8
152
    xor ecx,ecx
153
    mov cl,255
154
;    cld
155
    rep movsd
156
    mov [_palette+1020],ebx
157
    ret
158
 
159
include "graph8.inc"
160
 
161
DATA
162
  _multiplier	dd 63.5
163
 
485 heavyiron 164
  title          db 'Plasma',0
31 halyavin 165
 
166
UDATA
167
  _fpom32		rd 1
168
  _fpom16		rw 1
169
  _st_rad		rd 1
170
  _palette:	rd 256
171
 
172
  virtual_screen_8:
173
   	rb WND_SIZE_X*WND_SIZE_Y
174
 
175
  virtual_screen_32:
176
   	rb WND_SIZE_X*WND_SIZE_Y*3
177
 
178
MEOS_APP_END