2006-01-03 10:43:31 +01:00
|
|
|
;
|
|
|
|
; FIRE for MENUET - Compile with FASM
|
|
|
|
;
|
|
|
|
|
|
|
|
use32
|
|
|
|
|
|
|
|
org 0x0
|
2006-05-15 14:49:40 +02:00
|
|
|
db 'MENUET01' ; 8 byte id
|
|
|
|
dd 1 ; header version
|
2006-01-03 10:43:31 +01:00
|
|
|
dd START ; program start
|
|
|
|
dd I_END ; image size
|
2006-05-15 14:49:40 +02:00
|
|
|
dd mem_end ; reguired amount of memory
|
|
|
|
dd mem_end
|
|
|
|
dd 0,0 ; no parameters, no path
|
2006-01-03 10:43:31 +01:00
|
|
|
|
2007-05-10 15:48:35 +02:00
|
|
|
include '..\..\..\macros.inc'
|
2006-01-03 10:43:31 +01:00
|
|
|
|
|
|
|
START:
|
|
|
|
|
2006-05-15 14:49:40 +02:00
|
|
|
red:
|
2006-01-03 10:43:31 +01:00
|
|
|
|
2006-05-15 14:49:40 +02:00
|
|
|
; ************************************************
|
|
|
|
; ********* WINDOW DEFINITIONS AND DRAW **********
|
|
|
|
; ************************************************
|
|
|
|
|
|
|
|
draw_window:
|
|
|
|
|
|
|
|
mov eax,12 ; tell os about redraw
|
|
|
|
mov ebx,1
|
2007-05-10 15:48:35 +02:00
|
|
|
mcall
|
2006-05-15 14:49:40 +02:00
|
|
|
|
|
|
|
xor eax,eax ; define and draw window
|
|
|
|
mov ebx,100*65536+321
|
|
|
|
mov ecx,70*65536+222
|
|
|
|
mov edx,0x00000000
|
|
|
|
mov esi,0x00000000
|
|
|
|
mov edi,0x00000000
|
2007-05-10 15:48:35 +02:00
|
|
|
mcall
|
2006-05-15 14:49:40 +02:00
|
|
|
|
|
|
|
mov al,4 ; 'FIRE FOR MENUET'
|
|
|
|
mov ebx,110*65536+8
|
|
|
|
mov ecx,dword 0x00FFFFFF
|
|
|
|
mov edx,text
|
|
|
|
mov esi,textlen-text
|
2007-05-10 15:48:35 +02:00
|
|
|
mcall
|
2006-05-15 14:49:40 +02:00
|
|
|
|
|
|
|
mov al,8
|
|
|
|
mov ebx,(321-19)*65536+12 ; button start x & size
|
|
|
|
mov ecx,5*65536+12 ; button start y & size
|
|
|
|
mov edx,1 ; button number
|
|
|
|
mov esi,0x009a0000
|
2007-05-10 15:48:35 +02:00
|
|
|
mcall
|
2006-05-15 14:49:40 +02:00
|
|
|
|
|
|
|
mov ebx,ecx ;5*65536+12
|
|
|
|
inc edx
|
2007-05-10 15:48:35 +02:00
|
|
|
mcall
|
2006-05-15 14:49:40 +02:00
|
|
|
|
|
|
|
mov ebx,18*65536+12
|
|
|
|
inc edx
|
2007-05-10 15:48:35 +02:00
|
|
|
mcall
|
2006-05-15 14:49:40 +02:00
|
|
|
|
|
|
|
mov ebx,31*65536+12
|
|
|
|
inc edx
|
2007-05-10 15:48:35 +02:00
|
|
|
mcall
|
2006-05-15 14:49:40 +02:00
|
|
|
|
|
|
|
mov al,12 ; tell os about redraw end
|
|
|
|
mov ebx,2
|
2007-05-10 15:48:35 +02:00
|
|
|
mcall
|
2006-01-03 10:43:31 +01:00
|
|
|
|
|
|
|
sta: ; calculate fire image
|
|
|
|
|
2006-05-15 14:49:40 +02:00
|
|
|
mov esi, FireScreen+0x2300-80
|
2006-01-03 10:43:31 +01:00
|
|
|
mov ecx, 80
|
2006-05-15 14:49:40 +02:00
|
|
|
mov eax, [FireSeed]
|
2006-01-03 10:43:31 +01:00
|
|
|
|
|
|
|
NEWLINE:
|
|
|
|
|
2006-05-15 14:49:40 +02:00
|
|
|
mul [RandSeedConst]
|
2006-01-03 10:43:31 +01:00
|
|
|
inc eax
|
|
|
|
mov [esi], dl
|
|
|
|
inc esi
|
2006-05-15 14:49:40 +02:00
|
|
|
loop NEWLINE
|
2006-01-03 10:43:31 +01:00
|
|
|
|
2006-05-15 14:49:40 +02:00
|
|
|
mov [FireSeed], eax
|
2006-01-03 10:43:31 +01:00
|
|
|
|
2006-05-15 14:49:40 +02:00
|
|
|
mov ecx, 0x2300-80
|
|
|
|
sub esi, ecx
|
|
|
|
xor edx, edx
|
|
|
|
xor eax, eax
|
2006-01-03 10:43:31 +01:00
|
|
|
|
2006-05-15 14:49:40 +02:00
|
|
|
FIRELOOP:
|
|
|
|
lodsb
|
2006-01-03 10:43:31 +01:00
|
|
|
|
2006-05-15 14:49:40 +02:00
|
|
|
cmp [type], ah
|
2006-01-03 10:43:31 +01:00
|
|
|
jnz notype1
|
2006-05-15 14:49:40 +02:00
|
|
|
mov dl, [esi + 1]
|
|
|
|
add eax, edx
|
|
|
|
mov dl, [esi]
|
|
|
|
add eax, edx
|
|
|
|
mov dl, [esi + 80]
|
|
|
|
jmp typedone
|
2006-01-03 10:43:31 +01:00
|
|
|
notype1:
|
|
|
|
|
2006-05-15 14:49:40 +02:00
|
|
|
; cmp [type],1
|
|
|
|
; jnz notype2
|
|
|
|
mov dl, [esi - 2]
|
|
|
|
; add eax, edx
|
|
|
|
; mov dl, [esi - 2]
|
|
|
|
; add eax, edx
|
|
|
|
lea eax, [eax + edx*2]
|
|
|
|
mov dl, [esi + 78]
|
|
|
|
; notype2:
|
|
|
|
|
|
|
|
; type 2 is never used
|
|
|
|
; cmp [type],2
|
|
|
|
; jnz notype3
|
|
|
|
; mov dl, [esi - 2]
|
|
|
|
; add eax, edx
|
|
|
|
; mov dl, [esi]
|
|
|
|
; add eax, edx
|
|
|
|
; mov dl, [esi + 80]
|
|
|
|
; notype3:
|
|
|
|
|
|
|
|
typedone:
|
|
|
|
add eax, edx
|
2006-01-03 10:43:31 +01:00
|
|
|
shr eax, 2
|
|
|
|
jz ZERO
|
|
|
|
dec eax
|
|
|
|
|
|
|
|
ZERO:
|
|
|
|
|
2006-05-15 14:49:40 +02:00
|
|
|
mov [esi - 81], al
|
|
|
|
loop FIRELOOP
|
2006-01-03 10:43:31 +01:00
|
|
|
|
2006-05-15 14:49:40 +02:00
|
|
|
mov al, 5 ; in this moment always high 24 bits of eax are zero!
|
2006-01-03 10:43:31 +01:00
|
|
|
mov ebx,[delay]
|
2007-05-10 15:48:35 +02:00
|
|
|
mcall
|
2006-01-03 10:43:31 +01:00
|
|
|
|
2006-05-15 14:49:40 +02:00
|
|
|
inc [calc]
|
|
|
|
cmp [calc], byte 2
|
|
|
|
jnz nodrw
|
2006-01-03 10:43:31 +01:00
|
|
|
|
|
|
|
pdraw:
|
|
|
|
|
2006-05-15 14:49:40 +02:00
|
|
|
mov byte [calc],ah ;byte 0
|
2006-01-03 10:43:31 +01:00
|
|
|
|
2006-05-15 14:49:40 +02:00
|
|
|
mov edi,ImageData
|
|
|
|
push edi ; pointer for sysfunction 7, draw image
|
2006-01-03 10:43:31 +01:00
|
|
|
add edi,[fcolor]
|
|
|
|
mov esi,FireScreen
|
|
|
|
xor edx,edx
|
|
|
|
|
|
|
|
newc:
|
2006-05-15 14:49:40 +02:00
|
|
|
xor eax, eax
|
|
|
|
lodsb
|
2006-01-03 10:43:31 +01:00
|
|
|
|
|
|
|
mov ecx,eax
|
2006-05-15 14:49:40 +02:00
|
|
|
shr eax,1
|
|
|
|
add cl,al
|
|
|
|
mov ch,al
|
|
|
|
|
|
|
|
mov [edi+0],ecx
|
|
|
|
mov [edi+3],ecx
|
|
|
|
mov [edi+6],ecx
|
2006-01-03 10:43:31 +01:00
|
|
|
mov [edi+9],cx
|
2006-05-15 14:49:40 +02:00
|
|
|
lea ebx, [edi+320*3]
|
|
|
|
mov [ebx+0],ecx
|
|
|
|
mov [ebx+3],ecx
|
|
|
|
mov [ebx+6],ecx
|
|
|
|
mov [ebx+9],ecx
|
2006-01-03 10:43:31 +01:00
|
|
|
|
|
|
|
add edi,12
|
|
|
|
inc edx
|
|
|
|
cmp edx,80
|
|
|
|
jnz nnl
|
|
|
|
xor edx,edx
|
|
|
|
add edi,320*3
|
|
|
|
nnl:
|
2006-05-15 14:49:40 +02:00
|
|
|
cmp esi,FireScreen+8000; 0x2000
|
2006-01-03 10:43:31 +01:00
|
|
|
jnz newc
|
|
|
|
|
2006-05-15 14:49:40 +02:00
|
|
|
mov al,7 ; display image
|
|
|
|
; high 24 bits of eax are zero!
|
|
|
|
pop ebx
|
2006-01-03 10:43:31 +01:00
|
|
|
mov ecx,4*80*65536+200
|
|
|
|
mov edx,1*65536+22
|
2007-05-10 15:48:35 +02:00
|
|
|
mcall
|
2006-01-03 10:43:31 +01:00
|
|
|
|
|
|
|
nodrw:
|
|
|
|
|
|
|
|
mov eax,11 ; check if os wants to talk to us
|
2007-05-10 15:48:35 +02:00
|
|
|
mcall
|
2006-05-15 14:49:40 +02:00
|
|
|
dec eax
|
2006-01-03 10:43:31 +01:00
|
|
|
jz red
|
2006-05-15 14:49:40 +02:00
|
|
|
cmp al, 3-1
|
|
|
|
jnz nob4
|
2006-01-03 10:43:31 +01:00
|
|
|
|
|
|
|
button: ; get button id
|
2006-05-15 14:49:40 +02:00
|
|
|
mov al,17
|
2007-05-10 15:48:35 +02:00
|
|
|
mcall
|
2006-05-15 14:49:40 +02:00
|
|
|
shr eax, 8
|
2006-01-03 10:43:31 +01:00
|
|
|
|
2006-05-15 14:49:40 +02:00
|
|
|
dec eax
|
2006-01-03 10:43:31 +01:00
|
|
|
jnz noclose
|
2006-05-15 14:49:40 +02:00
|
|
|
or eax,-1 ; close this program
|
2007-05-10 15:48:35 +02:00
|
|
|
mcall
|
2006-01-03 10:43:31 +01:00
|
|
|
noclose:
|
|
|
|
|
2006-05-15 14:49:40 +02:00
|
|
|
dec eax ; change fire type
|
2006-01-03 10:43:31 +01:00
|
|
|
jnz nob2
|
2006-05-15 14:49:40 +02:00
|
|
|
xor [type], 1
|
2006-01-03 10:43:31 +01:00
|
|
|
nob2:
|
|
|
|
|
2006-05-15 14:49:40 +02:00
|
|
|
dec eax ; change delay
|
2006-01-03 10:43:31 +01:00
|
|
|
jnz nob3
|
2006-05-15 14:49:40 +02:00
|
|
|
xor [delay], 1
|
2006-01-03 10:43:31 +01:00
|
|
|
nob3:
|
|
|
|
|
2006-05-15 14:49:40 +02:00
|
|
|
dec eax ; change color
|
2006-01-03 10:43:31 +01:00
|
|
|
jnz nob4
|
|
|
|
mov eax,[fcolor]
|
2006-05-15 14:49:40 +02:00
|
|
|
inc eax
|
|
|
|
; cmp al,2
|
|
|
|
; jbe fcok
|
|
|
|
jnp fcok
|
|
|
|
xor eax,eax
|
2006-01-03 10:43:31 +01:00
|
|
|
fcok:
|
|
|
|
mov [fcolor],eax
|
2006-05-15 14:49:40 +02:00
|
|
|
mov edi,ImageData
|
|
|
|
mov ecx,(320*600)/4
|
|
|
|
xor eax,eax
|
2006-01-03 10:43:31 +01:00
|
|
|
rep stosd
|
|
|
|
|
|
|
|
nob4:
|
|
|
|
jmp sta
|
|
|
|
|
|
|
|
; DATA SECTION
|
2006-05-15 14:49:40 +02:00
|
|
|
RandSeedConst dd 0x8405
|
2006-01-03 10:43:31 +01:00
|
|
|
fcolor dd 2
|
|
|
|
xx db 'x'
|
2006-05-15 14:49:40 +02:00
|
|
|
type db 0
|
|
|
|
calc db 0
|
2006-01-03 10:43:31 +01:00
|
|
|
delay dd 0
|
|
|
|
FireSeed dd 0x1234
|
|
|
|
text: db 'FIRE FOR MENUET'
|
|
|
|
textlen:
|
|
|
|
|
|
|
|
I_END:
|
|
|
|
|
2006-05-15 14:49:40 +02:00
|
|
|
FireScreen:
|
|
|
|
rb 0x2300
|
|
|
|
ImageData:
|
|
|
|
rb 320*200*3
|
|
|
|
|
|
|
|
; stack
|
|
|
|
align 512
|
|
|
|
rb 512
|
|
|
|
mem_end:
|