Rev 2029 | Go to most recent revision | Only display areas with differences | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 2029 | Rev 2094 | ||
---|---|---|---|
1 | include "lang.inc" |
1 | include "lang.inc" |
2 | include "..\..\..\macros.inc" |
2 | include "../../../macros.inc" |
3 | 3 | ||
4 | WND_SIZE_X = 320 |
4 | WND_SIZE_X = 320 |
5 | WND_SIZE_Y = 200 |
5 | WND_SIZE_Y = 200 |
6 | 6 | ||
7 | VC_DELTA = 1 |
7 | VC_DELTA = 1 |
8 | HC_DELTA = 2 |
8 | HC_DELTA = 2 |
9 | 9 | ||
10 | MEOS_APP_START |
10 | MEOS_APP_START |
11 | CODE |
11 | CODE |
12 | fninit |
12 | fninit |
13 | call init_sinus_table |
13 | call init_sinus_table |
14 | call init_background |
14 | call init_background |
15 | call init_palette |
15 | call init_palette |
16 | mov eax,40 |
16 | mov eax,40 |
17 | mov ebx,101b |
17 | mov ebx,101b |
18 | mcall |
18 | mcall |
19 | jmp .paint_window |
19 | jmp .paint_window |
20 | 20 | ||
21 | .event_loop: |
21 | .event_loop: |
22 | mov eax,23 |
22 | mov eax,23 |
23 | mov ebx,1 |
23 | mov ebx,1 |
24 | mcall |
24 | mcall |
25 | 25 | ||
26 | test eax,eax |
26 | test eax,eax |
27 | je .draw_screen |
27 | je .draw_screen |
28 | dec eax |
28 | dec eax |
29 | je .paint_window |
29 | je .paint_window |
30 | 30 | ||
31 | or eax,-1 |
31 | or eax,-1 |
32 | mcall |
32 | mcall |
33 | 33 | ||
34 | .draw_screen: |
34 | .draw_screen: |
- | 35 | test [proc_info.wnd_state], 0x04 |
|
- | 36 | jnz .event_loop |
|
35 | add word [ver_counter],VC_DELTA |
37 | add word [ver_counter],VC_DELTA |
36 | add word [hor_counter],HC_DELTA |
38 | add word [hor_counter],HC_DELTA |
37 | call handle_animation |
39 | call handle_animation |
38 | mov eax,7 |
40 | mov eax,7 |
39 | mov ebx,virtual_screen_32 |
41 | mov ebx,virtual_screen_32 |
40 | mov ecx,(WND_SIZE_X shl 16)+WND_SIZE_Y |
42 | mov ecx,(WND_SIZE_X shl 16)+WND_SIZE_Y |
41 | xor edx,edx |
43 | xor edx,edx |
42 | mcall |
44 | mcall |
43 | jmp .event_loop |
45 | jmp .event_loop |
44 | 46 | ||
45 | .paint_window: |
47 | .paint_window: |
- | 48 | mcall 9,proc_info,-1 |
|
46 | mov eax,12 |
49 | mov eax,12 |
47 | mov ebx,1 |
50 | mov ebx,1 |
48 | mcall |
51 | mcall |
49 | 52 | ||
50 | xor eax,eax |
53 | xor eax,eax |
51 | mov ebx,(100 shl 16)+(WND_SIZE_X+9) |
54 | mov ebx,(100 shl 16)+(WND_SIZE_X+9) |
52 | mov ecx,(100 shl 16)+(WND_SIZE_Y+26) |
55 | mov ecx,(100 shl 16)+(WND_SIZE_Y+26) |
53 | mov edx,0x74000000 |
56 | mov edx,0x74000000 |
54 | mov edi,title |
57 | mov edi,title |
55 | mcall |
58 | mcall |
- | 59 | ||
- | 60 | test [proc_info.wnd_state], 0x04 |
|
- | 61 | jnz @f |
|
56 | 62 | ||
57 | mov eax,7 |
63 | mov eax,7 |
58 | mov ebx,virtual_screen_32 |
64 | mov ebx,virtual_screen_32 |
59 | mov ecx,(WND_SIZE_X shl 16)+WND_SIZE_Y |
65 | mov ecx,(WND_SIZE_X shl 16)+WND_SIZE_Y |
60 | xor edx,edx |
66 | xor edx,edx |
61 | mcall |
67 | mcall |
62 | 68 | @@: |
|
63 | mov eax,12 |
69 | mov eax,12 |
64 | mov ebx,2 |
70 | mov ebx,2 |
65 | mcall |
71 | mcall |
66 | 72 | ||
67 | jmp .event_loop |
73 | jmp .event_loop |
68 | 74 | ||
69 | init_palette: |
75 | init_palette: |
70 | mov ecx,256 |
76 | mov ecx,256 |
71 | mov edi,_palette |
77 | mov edi,_palette |
72 | xor eax,eax |
78 | xor eax,eax |
73 | .next_pal: |
79 | .next_pal: |
74 | mov al,ah |
80 | mov al,ah |
75 | shr al,2 |
81 | shr al,2 |
76 | stosb |
82 | stosb |
77 | stosb |
83 | stosb |
78 | stosb |
84 | stosb |
79 | inc edi |
85 | inc edi |
80 | inc ah |
86 | inc ah |
81 | loop .next_pal |
87 | loop .next_pal |
82 | ret |
88 | ret |
83 | 89 | ||
84 | init_sinus_table: |
90 | init_sinus_table: |
85 | sub esp,4 |
91 | sub esp,4 |
86 | mov ecx,256 |
92 | mov ecx,256 |
87 | mov edi,sinetable |
93 | mov edi,sinetable |
88 | .sin_loop: |
94 | .sin_loop: |
89 | fld dword [esp] |
95 | fld dword [esp] |
90 | fld st0 |
96 | fld st0 |
91 | fsin |
97 | fsin |
92 | fmul [scale_sin] |
98 | fmul [scale_sin] |
93 | fistp word [edi] |
99 | fistp word [edi] |
94 | fadd [delta_angle] |
100 | fadd [delta_angle] |
95 | fstp dword [esp] |
101 | fstp dword [esp] |
96 | add edi,2 |
102 | add edi,2 |
97 | loop .sin_loop |
103 | loop .sin_loop |
98 | add esp,4 |
104 | add esp,4 |
99 | ret |
105 | ret |
100 | 106 | ||
101 | init_background: |
107 | init_background: |
102 | mov edi,background |
108 | mov edi,background |
103 | xor edx,edx |
109 | xor edx,edx |
104 | .ib_vertical: |
110 | .ib_vertical: |
105 | xor ecx,ecx |
111 | xor ecx,ecx |
106 | .ib_horizontal: |
112 | .ib_horizontal: |
107 | mov eax,ecx |
113 | mov eax,ecx |
108 | xor eax,edx |
114 | xor eax,edx |
109 | stosb |
115 | stosb |
110 | inc ecx |
116 | inc ecx |
111 | cmp ecx,256 |
117 | cmp ecx,256 |
112 | jne .ib_horizontal |
118 | jne .ib_horizontal |
113 | inc edx |
119 | inc edx |
114 | cmp edx,256 |
120 | cmp edx,256 |
115 | jne .ib_vertical |
121 | jne .ib_vertical |
116 | ret |
122 | ret |
117 | 123 | ||
118 | s_OFFX = 0 |
124 | s_OFFX = 0 |
119 | s_OFFY = 2 |
125 | s_OFFY = 2 |
120 | 126 | ||
121 | handle_animation: |
127 | handle_animation: |
122 | sub esp,4 |
128 | sub esp,4 |
123 | mov ebx,[ver_counter] |
129 | mov ebx,[ver_counter] |
124 | and ebx,255 |
130 | and ebx,255 |
125 | add ebx,ebx |
131 | add ebx,ebx |
126 | mov ax,[sinetable+ebx] |
132 | mov ax,[sinetable+ebx] |
127 | mov [esp+s_OFFY],ax |
133 | mov [esp+s_OFFY],ax |
128 | mov ebx,[hor_counter] |
134 | mov ebx,[hor_counter] |
129 | and ebx,255 |
135 | and ebx,255 |
130 | add ebx,ebx |
136 | add ebx,ebx |
131 | mov ax,[sinetable+ebx] |
137 | mov ax,[sinetable+ebx] |
132 | mov [esp+s_OFFX],ax |
138 | mov [esp+s_OFFX],ax |
133 | mov edi,virtual_screen_32 |
139 | mov edi,virtual_screen_32 |
134 | mov edx,WND_SIZE_Y-1 |
140 | mov edx,WND_SIZE_Y-1 |
135 | .a_ver: |
141 | .a_ver: |
136 | mov ecx,WND_SIZE_X-1 |
142 | mov ecx,WND_SIZE_X-1 |
137 | mov bx,[esp+s_OFFY] |
143 | mov bx,[esp+s_OFFY] |
138 | add bx,dx |
144 | add bx,dx |
139 | and ebx,255 |
145 | and ebx,255 |
140 | shl ebx,8 |
146 | shl ebx,8 |
141 | .a_hor: |
147 | .a_hor: |
142 | mov ax,[esp+s_OFFX] |
148 | mov ax,[esp+s_OFFX] |
143 | add ax,cx |
149 | add ax,cx |
144 | and eax,255 |
150 | and eax,255 |
145 | lea esi,[background+ebx+eax] |
151 | lea esi,[background+ebx+eax] |
146 | mov al,[esi] |
152 | mov al,[esi] |
147 | and eax,0xff |
153 | and eax,0xff |
148 | mov eax,[_palette+eax*4] |
154 | mov eax,[_palette+eax*4] |
149 | stosw |
155 | stosw |
150 | shr eax,16 |
156 | shr eax,16 |
151 | stosb |
157 | stosb |
152 | dec ecx |
158 | dec ecx |
153 | jge .a_hor |
159 | jge .a_hor |
154 | dec edx |
160 | dec edx |
155 | jge .a_ver |
161 | jge .a_ver |
156 | add esp,4 |
162 | add esp,4 |
157 | ret |
163 | ret |
158 | 164 | ||
159 | DATA |
165 | DATA |
160 | delta_angle dd 0.0245436926066 ; pi/128 |
166 | delta_angle dd 0.0245436926066 ; pi/128 |
161 | scale_sin dd 128.0 |
167 | scale_sin dd 128.0 |
162 | 168 | ||
163 | title db 'MoveBack',0 |
169 | title db 'MoveBack',0 |
164 | 170 | ||
165 | UDATA |
171 | UDATA |
166 | ver_counter dd ? |
172 | ver_counter dd ? |
167 | hor_counter dd ? |
173 | hor_counter dd ? |
168 | 174 | ||
169 | _palette: rd 256 |
175 | _palette: rd 256 |
170 | 176 | ||
171 | virtual_screen_32: |
177 | virtual_screen_32: |
172 | rb WND_SIZE_X*WND_SIZE_Y*3 |
178 | rb WND_SIZE_X*WND_SIZE_Y*3 |
173 | 179 | ||
174 | background: |
180 | background: |
175 | rb 256*256 |
181 | rb 256*256 |
176 | 182 | ||
177 | sinetable: |
183 | sinetable: |
178 | rw 256 |
184 | rw 256 |
- | 185 | ||
- | 186 | proc_info process_information |
|
179 | 187 | ||
180 | MEOS_APP_END |
188 | MEOS_APP_END |