Subversion Repositories Kolibri OS

Rev

Rev 31 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 31 Rev 79
Line 3... Line 3...
3
;
3
;
Line 4... Line 4...
4
 
4
 
Line 5... Line 5...
5
use32
5
use32
6
 
6
 
7
           org     0x0
7
           org     0x0
8
           db      'MENUET00'           ; 8 byte id
8
           db      'MENUET01'           ; 8 byte id
9
           dd      38                   ; required os
9
           dd      1                    ; header version
10
           dd      START                ; program start
10
           dd      START                ; program start
11
           dd      I_END                ; image size
11
           dd      I_END                ; image size
12
           dd      0x80000               ; reguired amount of memory
12
           dd      mem_end              ; reguired amount of memory
Line 13... Line 13...
13
           dd      0x80000
13
           dd      mem_end
14
           dd      0x00000000           ; reserved=no extended header
14
           dd      0,0                  ; no parameters, no path
Line 15... Line 15...
15
 
15
 
Line 16... Line 16...
16
include 'lang.inc'
16
;include 'lang.inc'
Line -... Line 17...
-
 
17
include 'macros.inc'
-
 
18
 
-
 
19
START:
-
 
20
 
-
 
21
red:
-
 
22
 
-
 
23
; ************************************************
-
 
24
; ********* WINDOW DEFINITIONS AND DRAW **********
-
 
25
; ************************************************
-
 
26
 
-
 
27
draw_window:
-
 
28
 
-
 
29
    mov  eax,12                    ; tell os about redraw
-
 
30
    mov  ebx,1
-
 
31
    int  0x40
17
include 'macros.inc'
32
 
-
 
33
    xor  eax,eax                   ; define and draw window
-
 
34
    mov  ebx,100*65536+321
-
 
35
    mov  ecx,70*65536+222
18
 
36
    mov  edx,0x00000000
-
 
37
    mov  esi,0x00000000
-
 
38
    mov  edi,0x00000000
-
 
39
    int  0x40
-
 
40
 
-
 
41
    mov  al,4      ; 'FIRE FOR MENUET'
19
START:
42
    mov  ebx,110*65536+8
-
 
43
    mov  ecx,dword 0x00FFFFFF
-
 
44
    mov  edx,text
-
 
45
    mov  esi,textlen-text
-
 
46
    int  0x40
-
 
47
 
-
 
48
    mov  al,8
-
 
49
    mov  ebx,(321-19)*65536+12     ; button start x & size
-
 
50
    mov  ecx,5*65536+12            ; button start y & size
-
 
51
    mov  edx,1                     ; button number
-
 
52
    mov  esi,0x009a0000
-
 
53
    int  0x40
-
 
54
 
-
 
55
    mov  ebx,ecx ;5*65536+12
-
 
56
    inc  edx
-
 
57
    int  0x40
20
 
58
 
-
 
59
    mov  ebx,18*65536+12
-
 
60
    inc  edx
-
 
61
    int  0x40
21
    call draw_window
62
 
-
 
63
    mov  ebx,31*65536+12
Line 22... Line 64...
22
 
64
    inc  edx
Line 23... Line 65...
23
    mov  edi,0x40000
65
    int  0x40
24
    mov  ecx,320*600+100
-
 
25
    mov  eax,0
-
 
26
    cld
66
 
27
    rep  stosb
67
    mov  al,12                    ; tell os about redraw end
Line 28... Line 68...
28
 
68
    mov  ebx,2
Line 29... Line -...
29
sta:                                         ; calculate fire image
-
 
30
 
-
 
31
    mov  esi, FireScreen
69
    int  0x40
32
    add  esi, 0x2300
70
 
33
    sub  esi, 80
-
 
34
    mov  ecx, 80
-
 
35
    xor  edx, edx
71
sta:                                         ; calculate fire image
36
 
72
 
37
  NEWLINE:
-
 
38
 
73
    mov  esi, FireScreen+0x2300-80
39
    mov  eax,dword [FireSeed]                ; New number
-
 
40
    mov  edx, 0x8405
-
 
41
    mul  edx
-
 
42
    inc  eax
-
 
43
    mov  dword [FireSeed], eax               ; Store seed
-
 
Line 44... Line 74...
44
 
74
    mov  ecx, 80
Line -... Line 75...
-
 
75
    mov  eax, [FireSeed]
-
 
76
 
-
 
77
  NEWLINE:
45
    mov  [esi], dl
78
 
Line -... Line 79...
-
 
79
    mul  [RandSeedConst]
-
 
80
    inc  eax
-
 
81
    mov  [esi], dl
46
    inc  esi
82
    inc  esi
47
    dec  ecx
83
    loop NEWLINE
48
    jnz  NEWLINE
-
 
49
 
84
 
50
    mov  ecx, 0x2300
85
    mov  [FireSeed], eax
51
    sub  ecx, 80
86
 
52
    mov  esi, FireScreen
87
    mov  ecx, 0x2300-80
53
    add  esi, 80
88
    sub  esi, ecx
54
 
89
    xor  edx, edx
55
  FIRELOOP:
90
    xor  eax, eax
Line 56... Line 91...
56
 
91
 
57
    xor  eax,eax
92
  FIRELOOP:
58
 
-
 
59
    cmp  [type],0
93
    lodsb
60
    jnz  notype1
94
 
61
    mov  al, [esi]
95
    cmp  [type], ah
62
    add  al, [esi + 2]
96
    jnz  notype1
63
    adc  ah, 0
97
    mov  dl, [esi + 1]
64
    add  al, [esi + 1]
98
    add  eax, edx
65
    adc  ah, 0
99
    mov  dl, [esi]
66
    add  al, [esi + 81]
100
    add  eax, edx
-
 
101
    mov  dl, [esi + 80]
67
    adc  ah, 0
102
    jmp  typedone
68
  notype1:
103
  notype1:
69
 
-
 
70
    cmp  [type],1
104
 
71
    jnz  notype2
105
;    cmp  [type],1
72
    mov  al, [esi]
106
;    jnz  notype2
73
    add  al, [esi - 1]
107
    mov  dl, [esi - 2]
74
    adc  ah, 0
108
;    add  eax, edx
75
    add  al, [esi - 1]
-
 
76
    adc  ah, 0
109
;    mov  dl, [esi - 2]
Line -... Line 110...
-
 
110
;    add  eax, edx
-
 
111
    lea  eax, [eax + edx*2]
77
    add  al, [esi + 79]
112
    mov  dl, [esi + 78]
78
    adc  ah,0
113
;  notype2:
79
  notype2:
114
 
Line 80... Line 115...
80
 
115
; type 2 is never used
Line 81... Line 116...
81
    cmp  [type],2
116
;    cmp  [type],2
82
    jnz  notype3
-
 
83
    mov  al, [esi]
-
 
84
    add  al, [esi - 1]
117
;    jnz  notype3
85
    adc  ah,0
-
 
86
    add  al, [esi + 1]
-
 
Line 87... Line 118...
87
    adc  ah, 0
118
;    mov  dl, [esi - 2]
88
    add  al, [esi + 81]
119
;    add  eax, edx
89
    adc  ah,0
120
;    mov  dl, [esi]
Line 90... Line -...
90
  notype3:
-
 
91
 
121
;    add  eax, edx
92
    shr  eax, 2
-
 
93
    jz   ZERO
122
;    mov  dl, [esi + 80]
94
    dec  eax
-
 
95
 
-
 
96
  ZERO:
123
;  notype3:
Line 97... Line 124...
97
 
124
 
Line 98... Line 125...
98
    mov  [esi - 80], al
125
typedone:
Line 99... Line 126...
99
    inc  esi
126
    add  eax, edx
-
 
127
    shr  eax, 2
100
    dec  ecx
128
    jz   ZERO
101
    jnz  FIRELOOP
129
    dec  eax
102
 
130
 
Line 103... Line 131...
103
    pusha
131
  ZERO:
-
 
132
 
-
 
133
    mov  [esi - 81], al
Line 104... Line -...
104
 
-
 
105
    mov  eax,5
-
 
106
    mov  ebx,[delay]
134
    loop FIRELOOP
107
    int  0x40
-
 
108
 
135
 
109
    mov  al,byte [calc]
-
 
110
    inc  al
136
    mov  al, 5              ; in this moment always high 24 bits of eax are zero!
111
    mov  byte [calc],al
-
 
112
    cmp  al,byte 2
137
    mov  ebx,[delay]
113
    jz   pdraw
138
    int  0x40
114
 
139
 
115
    jmp  nodrw
140
    inc  [calc]
116
 
141
    cmp  [calc], byte 2
117
  pdraw:
142
    jnz  nodrw
-
 
143
 
118
 
144
  pdraw:
119
    mov  byte [calc],byte 0
145
 
120
 
146
    mov  byte [calc],ah ;byte 0
121
    mov  edi,0x40000
147
 
Line 122... Line 148...
122
    add  edi,[fcolor]
148
    mov  edi,ImageData
123
    mov  esi,FireScreen
149
    push edi     ; pointer for sysfunction 7, draw image
124
    xor  edx,edx
150
    add  edi,[fcolor]
125
 
151
    mov  esi,FireScreen
126
  newc:
152
    xor  edx,edx
127
 
153
 
128
    movzx eax,byte [esi]
154
  newc:
129
    mov   ebx,eax
-
 
130
    mov   ecx,eax
155
    xor   eax, eax
131
    shl   ax,8
156
    lodsb
Line 132... Line 157...
132
    shr   bx,1
157
 
-
 
158
    mov   ecx,eax
133
    mov   al,bl
159
    shr   eax,1
134
    add   ecx,eax
160
    add   cl,al
135
    shl   ax,8
161
    mov   ch,al
136
    mov   ch,ah
162
 
Line 137... Line 163...
137
 
163
    mov  [edi+0],ecx
Line 138... Line -...
138
    mov  [edi+0],cx
-
 
139
    mov  [edi+3],cx
-
 
140
    mov  [edi+6],cx
164
    mov  [edi+3],ecx
141
    mov  [edi+9],cx
165
    mov  [edi+6],ecx
142
    mov  [edi+0+320*3],cx
166
    mov  [edi+9],cx
143
    mov  [edi+3+320*3],cx
167
    lea  ebx, [edi+320*3]
144
    mov  [edi+6+320*3],cx
168
    mov  [ebx+0],ecx
145
    mov  [edi+9+320*3],cx
-
 
146
 
-
 
147
    add  edi,12
-
 
148
    inc  edx
-
 
149
    cmp  edx,80
-
 
150
    jnz  nnl
-
 
151
    xor  edx,edx
169
    mov  [ebx+3],ecx
Line 152... Line 170...
152
    add  edi,320*3
170
    mov  [ebx+6],ecx
153
  nnl:
171
    mov  [ebx+9],ecx
154
    inc  esi
172
 
-
 
173
    add  edi,12
Line 155... Line 174...
155
    cmp  esi,FireScreen+0x2000
174
    inc  edx
156
    jnz  newc
175
    cmp  edx,80
157
 
176
    jnz  nnl
158
    mov  eax,dword 0x00000007           ; display image
177
    xor  edx,edx
159
    mov  ebx,0x40000
178
    add  edi,320*3
Line 160... Line 179...
160
    mov  ecx,4*80*65536+200
179
  nnl:
161
    mov  edx,1*65536+22
180
    cmp  esi,FireScreen+8000; 0x2000
162
    int  0x40
-
 
163
 
-
 
164
  nodrw:
-
 
165
 
181
    jnz  newc
166
    popa
182
 
Line 167... Line 183...
167
 
183
    mov  al,7           ; display image
168
    mov  eax,11                  ; check if os wants to talk to us
184
                        ; high 24 bits of eax are zero!
169
    int  0x40
-
 
170
    cmp  eax,1
-
 
171
    jz   red
-
 
172
    cmp  eax,3
185
    pop  ebx
173
    jz   button
186
    mov  ecx,4*80*65536+200
Line 174... Line 187...
174
 
187
    mov  edx,1*65536+22
175
    jmp  sta
188
    int  0x40
176
 
189
 
177
  red:                           ; draw window
190
  nodrw:
178
    call draw_window
191
 
179
    jmp  sta
192
    mov  eax,11                  ; check if os wants to talk to us
-
 
193
    int  0x40
180
 
194
    dec  eax
181
  button:                        ; get button id
195
    jz   red
182
    mov  eax,17
196
    cmp  al, 3-1
183
    int  0x40
197
    jnz  nob4
184
 
198
 
185
    cmp  ah,1
199
  button:                        ; get button id
186
    jnz  noclose
-
 
187
    mov  eax,-1                  ; close this program
200
    mov  al,17
Line 188... Line 201...
188
    int  0x40
201
    int  0x40
189
  noclose:
-
 
190
 
202
    shr  eax, 8
Line 191... Line -...
191
    cmp  ah,2                    ; change fire type
-
 
192
    jnz  nob2
-
 
193
    mov  eax,[type]
-
 
194
    add  eax,1
-
 
195
    and  eax,1
-
 
196
    mov  [type],eax
-
 
197
   nob2:
-
 
198
 
-
 
199
    cmp  ah,3                    ; change delay
-
 
200
    jnz  nob3
-
 
201
    mov  eax,[delay]
-
 
202
    sub  eax,1
-
 
203
    and  eax,1
-
 
204
    mov  [delay],eax
-
 
205
  nob3:
-
 
206
 
-
 
207
    cmp  ah,4                    ; change color
-
 
208
    jnz  nob4
-
 
209
    mov  eax,[fcolor]
-
 
210
    add  eax,1
-
 
211
    cmp  eax,2
-
 
212
    jbe  fcok
-
 
213
    mov  eax,0
-
 
214
  fcok:
-
 
215
    mov  [fcolor],eax
-
 
216
    mov  eax,0
-
 
217
    mov  ecx,0x10000
-
 
218
    mov  edi,0x40000
-
 
219
    cld
-
 
220
    rep  stosd
-
 
221
 
-
 
222
  nob4:
-
 
223
 
-
 
224
    jmp  sta
-
 
225
 
-
 
226
 
-
 
227
 
-
 
228
; ************************************************
-
 
229
; ********* WINDOW DEFINITIONS AND DRAW **********
-
 
230
; ************************************************
-
 
231
 
-
 
232
 
-
 
233
draw_window:
-
 
234
 
-
 
235
    pusha
-
 
236
 
-
 
237
    mov  eax,12                    ; tell os about redraw
-
 
238
    mov  ebx,1
-
 
239
    int  0x40
-
 
240
 
-
 
241
    mov  eax,0                     ; define and draw window
-
 
242
    mov  ebx,100*65536+321
-
 
243
    mov  ecx,70*65536+222
-
 
244
    mov  edx,0x00000000
-
 
245
    mov  esi,0x00000000
-
 
246
    mov  edi,0x00000000
-
 
247
    int  0x40
-
 
248
 
-
 
249
    mov  eax,dword 0x00000004      ; 'FIRE FOR MENUET'
-
 
250
    mov  ebx,110*65536+8
-
 
251
    mov  ecx,dword 0x00FFFFFF
-
 
252
    mov  edx,text
-
 
253
    mov  esi,textlen-text
-
 
254
    int  0x40
-
 
255
 
203
 
256
    mov  eax,8
-
 
257
    mov  ebx,(321-19)*65536+12     ; button start x & size
204
    dec  eax
258
    mov  ecx,5*65536+12            ; button start y & size
205
    jnz  noclose
259
    mov  edx,1                     ; button number
206
    or   eax,-1                  ; close this program
260
    mov  esi,0x009a0000
207
    int  0x40
-
 
208
  noclose:
261
    int  0x40
209
 
262
 
210
    dec  eax                     ; change fire type
263
    mov  eax,8
211
    jnz  nob2
264
    mov  ebx,5*65536+12
212
    xor  [type], 1
Line 265... Line -...
265
    mov  ecx,5*65536+12
-
 
266
    mov  edx,2
-
 
267
    int  0x40
213
   nob2:
Line -... Line 214...
-
 
214
 
-
 
215
    dec  eax                     ; change delay
-
 
216
    jnz  nob3
-
 
217
    xor  [delay], 1
268
 
218
  nob3:
269
    mov  eax,8
219
 
-
 
220
    dec  eax                     ; change color
-
 
221
    jnz  nob4
-
 
222
    mov  eax,[fcolor]