Subversion Repositories Kolibri OS

Rev

Rev 485 | Go to most recent revision | Only display areas with differences | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

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