Rev 9237 | Rev 9512 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 9237 | Rev 9454 | ||
---|---|---|---|
Line 1... | Line 1... | ||
1 | ; application : View3ds ver. 0.074 - tiny .3ds and .asc files viewer |
1 | ; application : View3ds ver. 0.075 - tiny .3ds and .asc files viewer |
2 | ; with a few graphics effects demonstration. |
2 | ; with a few graphics effects demonstration. |
3 | ; compiler : FASM |
3 | ; compiler : FASM |
4 | ; system : KolibriOS |
4 | ; system : KolibriOS |
5 | ; author : Macgub aka Maciej Guba |
5 | ; author : Macgub aka Maciej Guba |
6 | ; email : macgub3@wp.pl |
6 | ; email : macgub3@wp.pl |
Line 16... | Line 16... | ||
16 | ; can be: |
16 | ; can be: |
17 | ; 1) Read from a file (*.3DS standard) |
17 | ; 1) Read from a file (*.3DS standard) |
18 | ; 2) Written in manually (at the end of the code) ; now not exist |
18 | ; 2) Written in manually (at the end of the code) ; now not exist |
19 | 19 | ||
Line -... | Line 20... | ||
- | 20 | format binary as "" |
|
Line 20... | Line 21... | ||
20 | 21 | ||
21 | SIZE_X equ 512 |
22 | SIZE_X equ 512 |
22 | SIZE_Y equ 512 ; ///// I want definitely |
23 | SIZE_Y equ 512 ; ///// I want definitely |
23 | TIMEOUT equ 10 ; ------ say: |
24 | TIMEOUT equ 10 ; ------ say: |
Line 161... | Line 162... | ||
161 | cmp eax,2 ; key event ? |
162 | cmp eax,2 ; key event ? |
162 | je key |
163 | je key |
163 | cmp eax,3 ; button event ? |
164 | cmp eax,3 ; button event ? |
164 | je button |
165 | je button |
165 | cmp eax,6 ; mouse event ? |
166 | |
166 | jne @f |
- | |
167 | cmp [edit_flag],1 ; handle mouse only when edit is active |
- | |
168 | jne @f |
- | |
169 | - | ||
Line -... | Line 167... | ||
- | 167 | mov esi,eax |
|
170 | mov eax,37 |
168 | mov eax,37 |
171 | mov ebx,7 ; get mouse scroll |
169 | mov ebx,7 ; get mouse scroll |
172 | int 0x40 |
170 | int 0x40 |
173 | and eax, 0xFFFF ; check only vertial |
171 | and eax, 0xFFFF ; check only vertial |
174 | cmp eax, 65535 |
172 | cmp eax, 65535 |
175 | je button.zoom_in |
173 | je button.zoom_in |
176 | cmp eax, 1 |
174 | cmp eax, 1 |
177 | je button.zoom_out |
175 | je button.zoom_out |
- | 176 | mov eax,esi |
|
Line -... | Line 177... | ||
- | 177 | ||
- | 178 | cmp eax,6 ; mouse event ? |
|
- | 179 | jne @f |
|
- | 180 | cmp [edit_flag],1 ; handle mouse only when edit is active |
|
178 | 181 | jne @f |
|
179 | mov eax,37 |
182 | mov eax,37 |
180 | mov ebx,3 ;read mouse state |
183 | mov ebx,3 ;read mouse state |
181 | int 0x40 |
184 | int 0x40 |
182 | mov [mouse_state],eax |
185 | mov [mouse_state],eax |
Line 212... | Line 215... | ||
212 | 215 | ||
Line 213... | Line 216... | ||
213 | key: ; key |
216 | key: ; key |
214 | mov eax,2 ; just read it and ignore |
217 | mov eax,2 ; just read it and ignore |
215 | int 0x40 |
218 | int 0x40 |
- | 219 | shr eax,16 ; use scancodes (al) |
|
Line 216... | Line 220... | ||
216 | 220 | ||
217 | cmp ah, '+' |
221 | cmp al, 013 ;+ |
218 | je button.zoom_in |
- | |
219 | cmp ah, '=' |
- | |
220 | je button.zoom_in |
222 | je button.zoom_in |
221 | cmp ah, '-' |
223 | cmp al, 012 ;- |
222 | je button.zoom_out |
224 | je button.zoom_out |
223 | cmp ah, 176 ;left |
225 | cmp al, 075 ;left |
224 | je add_vec_buttons.x_minus |
226 | je add_vec_buttons.x_minus |
225 | cmp ah, 179 ;right |
227 | cmp al, 077 ;right |
226 | je add_vec_buttons.x_plus |
228 | je add_vec_buttons.x_plus |
227 | cmp ah, 178 ;up |
229 | cmp al, 072 ;up |
228 | je add_vec_buttons.y_minus |
230 | je add_vec_buttons.y_minus |
229 | cmp ah, 177 ;down |
231 | cmp al, 080 ;down |
- | 232 | je add_vec_buttons.y_plus |
|
- | 233 | cmp al, 073 ;page up |
|
- | 234 | je .rot_inc_y |
|
- | 235 | cmp al, 081 ;page down |
|
- | 236 | je .rot_dec_y |
|
- | 237 | cmp al, 051 ;< |
|
- | 238 | je .rot_dec_x |
|
- | 239 | cmp al, 052 ;> |
|
- | 240 | je .rot_inc_x |
|
- | 241 | cmp al, 057 ;space |
|
Line 230... | Line 242... | ||
230 | je add_vec_buttons.y_plus |
242 | je .rot_z |
Line -... | Line 243... | ||
- | 243 | ||
- | 244 | jmp noclose |
|
- | 245 | ||
- | 246 | .rot_inc_x: |
|
- | 247 | inc [angle_x] |
|
- | 248 | and [angle_x],0xff |
|
- | 249 | jmp noclose.end_rot |
|
- | 250 | .rot_dec_x: |
|
- | 251 | dec [angle_x] |
|
- | 252 | and [angle_x],0xff |
|
- | 253 | jmp noclose.end_rot |
|
- | 254 | .rot_inc_y: |
|
- | 255 | inc [angle_y] |
|
- | 256 | and [angle_y],0xff |
|
- | 257 | jmp noclose.end_rot |
|
- | 258 | .rot_dec_y: |
|
- | 259 | dec [angle_y] |
|
- | 260 | and [angle_y],0xff |
|
- | 261 | jmp noclose.end_rot |
|
- | 262 | .rot_z: |
|
- | 263 | inc [angle_z] |
|
231 | 264 | and [angle_z],0xff |
|
232 | jmp noclose |
265 | jmp noclose.end_rot |
233 | 266 | ||
Line 234... | Line 267... | ||
234 | button: ; button |
267 | button: ; button |
Line 301... | Line 334... | ||
301 | call mirror |
334 | call mirror |
302 | .next_m4: |
335 | .next_m4: |
303 | cmp ah,14 |
336 | cmp ah,14 |
304 | jne @f |
337 | jne @f |
305 | call exchange |
338 | .xchg: |
- | 339 | call exchange |
|
306 | @@: |
340 | @@: |
307 | cmp ah,15 |
341 | cmp ah,15 |
308 | jne @f |
342 | jne @f |
309 | cmp [emboss_flag],1 |
343 | cmp [emboss_flag],1 |
310 | ; call init_envmap2 |
344 | ; call init_envmap2 |
Line 484... | Line 518... | ||
484 | cmp [r_flag],2 |
518 | cmp [r_flag],2 |
485 | jne .no_x |
519 | jne .no_x |
486 | inc [angle_x] |
520 | inc [angle_x] |
487 | and [angle_x],0xff |
521 | and [angle_x],0xff |
488 | mov [angle_z],0 |
522 | ;mov [angle_z],0 |
489 | jmp .end_rot |
523 | jmp .end_rot |
490 | 524 | ||
Line 491... | Line 525... | ||
491 | .no_x: |
525 | .no_x: |
492 | cmp [r_flag],0 |
526 | cmp [r_flag],0 |
493 | jne .no_y |
527 | jne .no_y |
494 | inc [angle_y] |
528 | inc [angle_y] |
495 | and [angle_y],0xff |
529 | and [angle_y],0xff |
496 | mov [angle_z],0 |
530 | ;mov [angle_z],0 |
497 | jmp .end_rot |
531 | jmp .end_rot |
Line 498... | Line 532... | ||
498 | 532 | ||
499 | .no_y: |
533 | .no_y: |
500 | cmp [r_flag],1 |
534 | cmp [r_flag],1 |
501 | jne .end_rot |
535 | jne .end_rot |
502 | mov cx,[angle_x] |
536 | mov cx,[angle_x] |
503 | inc cx |
537 | inc cx |
504 | and cx,0xff |
538 | and cx,0xff |
505 | mov [angle_z],0 |
539 | ;mov [angle_z],0 |
506 | mov [angle_y],cx |
540 | mov [angle_y],cx |
507 | mov [angle_x],cx |
541 | mov [angle_x],cx |
Line 508... | Line 542... | ||
508 | .end_rot: |
542 | .end_rot: |