Rev 1996 | Rev 1998 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 1996 | Rev 1997 | ||
---|---|---|---|
Line 3... | Line 3... | ||
3 | ; |
3 | ; |
4 | ; See f63 |
4 | ; See f63 |
5 | ; |
5 | ; |
6 | ; Compile with FASM for Menuet |
6 | ; Compile with FASM for Menuet |
7 | ; |
7 | ; |
8 | LMARGIN equ (15+5) |
- | |
9 | TMARGIN equ (35+5) |
- | |
10 | HSPACE equ 16 |
- | |
11 | VSPACE equ 12 |
- | |
12 | IPC_BUF equ 160 |
- | |
13 | DR_GRID equ 0;1 |
- | |
14 | WRITE_LOG equ 1 |
8 | WRITE_LOG equ 1 |
Line 15... | Line -... | ||
15 | - | ||
16 | FL_KRNL equ 1 |
- | |
17 | 9 | ||
Line 18... | Line 10... | ||
18 | include 'lang.inc' |
10 | include 'lang.inc' |
19 | 11 | ||
20 | use32 |
12 | use32 |
21 | org 0x0 |
13 | org 0x0 |
22 | db 'MENUET01' ; 8 byte id |
14 | db 'MENUET01' ; 8 byte id |
23 | dd 0x01 ; header version |
15 | dd 0x01 ; header version |
24 | dd START ; start of code |
16 | dd START ; start of code |
25 | dd I_END ; size of image |
17 | dd I_END ; size of image |
26 | dd i_end+0x2000 ; memory for app (4 Kb) |
18 | dd mem ; memory for app |
27 | dd i_end+0x2000 ; esp |
19 | dd mem ; esp |
28 | dd filename , 0x0 ; I_Param , I_Icon |
20 | dd filename , 0x0 ; I_Param , I_Icon |
29 | include '../../../macros.inc' |
21 | include '../../../macros.inc' |
30 | include 'debug.inc' |
22 | include 'debug.inc' |
Line 42... | Line 34... | ||
42 | stosb |
34 | stosb |
43 | test al, al |
35 | test al, al |
44 | jnz @b |
36 | jnz @b |
45 | param: |
37 | param: |
Line 46... | Line -... | ||
46 | - | ||
47 | mcall 60,1,ipcbuff,IPC_BUF+20 |
- | |
48 | mcall 40,1000111b |
- | |
49 | mov [ipcbuff+4],8 |
38 | |
50 | ; allow user to see messages written before start |
39 | ; allow user to see messages written before start |
51 | ; mov ecx,4096 |
40 | ; mov ecx,4096 |
52 | ; flush: |
41 | ; flush: |
53 | ; mov eax,63 |
42 | ; mov eax,63 |
Line 93... | Line 82... | ||
93 | je red |
82 | je red |
94 | cmp eax,2 ; key in buffer ? |
83 | cmp eax,2 ; key in buffer ? |
95 | je key |
84 | je key |
96 | cmp eax,3 ; button in buffer ? |
85 | cmp eax,3 ; button in buffer ? |
97 | je button |
86 | je button |
98 | cmp eax,7 |
- | |
99 | je ipc |
- | |
Line 100... | Line 87... | ||
100 | 87 | ||
101 | mov eax,63 |
88 | mov eax,63 |
102 | mov ebx,2 |
89 | mov ebx,2 |
Line 188... | Line 175... | ||
188 | mcall |
175 | mcall |
Line 189... | Line 176... | ||
189 | 176 | ||
190 | cmp ebx,1 |
177 | cmp ebx,1 |
Line 191... | Line -... | ||
191 | je new_data |
- | |
192 | - | ||
193 | cmp [vmode],2 |
178 | je new_data |
Line 194... | Line 179... | ||
194 | je still |
179 | |
Line 195... | Line -... | ||
195 | call draw_window |
- | |
196 | - | ||
197 | jmp still |
- | |
198 | - | ||
199 | ipc: |
- | |
200 | mov [vmode],2 |
- | |
201 | mov eax,ipcbuff |
- | |
202 | mov esi,[eax+8] |
- | |
203 | mov byte[eax],1 |
- | |
204 | push dword[eax+12] |
- | |
205 | pop [dump_len] |
- | |
206 | mcall 9,work,-1 |
- | |
207 | mov ecx,eax |
- | |
208 | .lp: |
- | |
209 | mcall 9 |
- | |
210 | cmp [ebx+30],esi |
- | |
211 | je .ok |
- | |
212 | loop .lp |
- | |
213 | and [dump_len],0 |
- | |
214 | jmp red |
- | |
215 | .ok: |
- | |
216 | mov [pid],esi |
- | |
217 | lea esi,[ebx+10] |
- | |
218 | mov edi,dump_title+10 |
180 | call draw_window |
219 | mov ecx,12 |
181 | |
220 | rep movsb |
182 | jmp still |
221 | jmp red |
183 | |
222 | key: ; key |
184 | key: ; key |
223 | mov al,2 ; just read it and ignore |
- | |
224 | mcall |
- | |
225 | cmp ah,' ' |
- | |
226 | je button.no_krnl_flt |
- | |
227 | cmp [vmode],2 |
- | |
228 | jne still |
- | |
229 | cmp ah,176 ;left |
- | |
230 | jb still |
- | |
231 | cmp ah,179 ;right |
- | |
232 | ja still |
- | |
233 | mov ecx,[offs] |
- | |
234 | shr eax,8 |
- | |
235 | sub eax,176 |
- | |
236 | add ecx,[arrows+eax*4] |
- | |
237 | shl ecx,12 |
185 | mov al,2 ; just read it and ignore |
Line 238... | Line -... | ||
238 | shr cx,12 |
- | |
239 | jmp button.check_sel |
- | |
240 | .nol: |
186 | mcall |
241 | jmp still |
187 | cmp ah,' ' |
242 | 188 | je button.noclose |
|
Line 243... | Line 189... | ||
243 | arrows dd -1,16,-16,1 |
189 | jmp still |
244 | 190 | ||
Line 245... | Line 191... | ||
245 | button: ; button |
191 | button: ; button |
246 | mov al,17 ; get id |
192 | mov al,17 ; get id |
247 | mcall |
193 | mcall |
248 | - | ||
249 | cmp ah,1 ; button id=1 ? |
- | |
250 | jne .noclose |
- | |
251 | - | ||
252 | or eax,-1 ; close this program |
- | |
253 | mcall |
- | |
254 | .noclose: |
- | |
255 | shr eax,8 |
- | |
256 | cmp eax,10 |
- | |
257 | jb .nodump |
- | |
258 | lea edi,[eax-10] |
- | |
259 | mcall 37,1 |
- | |
260 | sub eax,[edi*4+dump_cell_marg] |
- | |
261 | sub eax,TMARGIN+VSPACE |
- | |
262 | push eax |
- | |
263 | and eax,0xffff |
- | |
264 | xor edx,edx |
- | |
265 | div word[edi*4+dump_cell_size+2] |
- | |
266 | mov ecx,eax |
- | |
267 | shl ecx,16 |
- | |
268 | xor edx,edx |
- | |
269 | pop eax |
- | |
270 | shr eax,16 |
- | |
271 | div word[edi*4+dump_cell_size] |
- | |
272 | mov cx,ax |
- | |
273 | .check_sel: |
- | |
274 | mov eax,ecx |
- | |
275 | shl ax,12 |
- | |
276 | shr eax,12 |
- | |
277 | inc eax |
- | |
278 | cmp eax,[dump_len] |
- | |
279 | ja still;.nosel |
- | |
280 | mov dword[sel_byte],ecx |
- | |
281 | dec eax |
- | |
282 | mov [offs],eax |
- | |
283 | jmp red |
- | |
284 | - | ||
285 | .nodump: |
- | |
286 | cmp eax,2 |
- | |
287 | jne .no_krnl_flt |
- | |
288 | xor [flag],FL_KRNL |
- | |
289 | jmp still |
194 | |
290 | .no_krnl_flt: |
- | |
291 | mov [ipcbuff+4],8 |
195 | cmp ah,1 ; button id=1 ? |
Line 292... | Line 196... | ||
292 | and byte[ipcbuff],0 |
196 | jne .noclose |
293 | inc [vmode] |
197 | |
294 | cmp [vmode],3 |
198 | or eax,-1 ; close this program |
Line 339... | Line 243... | ||
339 | mcall 8,,<5,12> |
243 | mcall 8,,<5,12> |
340 | mov edx,[vmode] |
244 | mov edx,[vmode] |
341 | lea edx,[edx*4+duk] |
245 | lea edx,[edx*4+duk] |
342 | mcall 4,<300,8>,,,4 |
246 | mcall 4,<300,8>,,,4 |
Line 343... | Line -... | ||
343 | - | ||
344 | cmp [vmode],2 |
- | |
345 | je no_mdbg |
247 | |
346 | mov ebx,15*65536+33 ; draw info text with function 4 |
248 | mov ebx,15*65536+33 ; draw info text with function 4 |
347 | mov ecx,[sc.work_text] |
249 | mov ecx,[sc.work_text] |
348 | mov edx,text1 |
250 | mov edx,text1 |
349 | cmp [vmode],0 |
251 | cmp [vmode],0 |
Line 356... | Line 258... | ||
356 | mcall |
258 | mcall |
357 | add ebx,10 |
259 | add ebx,10 |
358 | add edx,80 |
260 | add edx,80 |
359 | cmp [edx],byte 'x' |
261 | cmp [edx],byte 'x' |
360 | jne newline |
262 | jne newline |
361 | jmp enddraw |
- | |
362 | no_mdbg: |
- | |
363 | if DUMP_TEST eq 1 |
- | |
364 | mov esi,0 |
- | |
365 | mov [dump_len],100;IPC_BUF |
- | |
366 | else |
- | |
367 | mov esi,ipcbuff+16 |
- | |
368 | end if |
- | |
369 | mov ecx,[dump_len] |
- | |
370 | call dump_btn |
- | |
371 | call draw_dump |
- | |
372 | enddraw: |
- | |
373 | mov eax,12 ; function 12:tell os about windowdraw |
263 | mov eax,12 ; function 12:tell os about windowdraw |
374 | mov ebx,2 ; 2, end of draw |
264 | mov ebx,2 ; 2, end of draw |
375 | mcall |
265 | mcall |
Line 376... | Line 266... | ||
376 | 266 | ||
Line 377... | Line -... | ||
377 | ret |
- | |
378 | - | ||
379 | if DR_GRID eq 1 |
- | |
380 | draw_grid: |
- | |
381 | mov ecx,11 |
- | |
382 | mov edi,(TMARGIN+VSPACE)shl 16+TMARGIN+VSPACE |
- | |
383 | .l1: |
- | |
384 | push ecx |
- | |
385 | mov ebx,LMARGIN shl 16+LMARGIN+16*HSPACE |
- | |
386 | mcall 38,,edi,0 |
- | |
387 | add edi,VSPACE shl 16+VSPACE |
- | |
388 | pop ecx |
- | |
389 | loop .l1 |
- | |
390 | mov ecx,17 |
- | |
391 | mov edi,(TMARGIN+VSPACE)shl 16+TMARGIN+VSPACE*10 |
- | |
392 | mov ebx,LMARGIN shl 16+LMARGIN |
- | |
393 | .l2: |
- | |
394 | push ecx |
- | |
395 | mcall 38,,edi,0 |
- | |
396 | add ebx,HSPACE shl 16+HSPACE |
- | |
397 | pop ecx |
- | |
398 | loop .l2 |
- | |
399 | ret |
- | |
400 | end if |
- | |
401 | - | ||
402 | draw_numbers: |
- | |
403 | mcall 4,(LMARGIN+2) shl 16+180,0,numb,numb_len-numb |
- | |
404 | mov eax,dword[sel_byte] |
- | |
405 | shl ax,12 |
- | |
406 | shr eax,12 |
- | |
407 | mov edi,eax |
- | |
408 | if ~ DUMP_TEST eq 1 |
- | |
409 | add edi,ipcbuff+16 |
- | |
410 | end if |
- | |
411 | mov edx,(LMARGIN+2+6*6)shl 16+180 |
- | |
412 | mov ebx,0x30000 |
- | |
413 | movzx ecx,byte[edi] |
- | |
414 | mcall 47,,,,0x4e00e7 |
- | |
415 | add ebx,0x20000 |
- | |
416 | add edx,(6*10)shl 16 |
- | |
417 | movzx ecx,word[edi] |
- | |
418 | mcall |
- | |
419 | add ebx,0x50000 |
- | |
420 | add edx,(6*13)shl 16 |
- | |
421 | mov ecx,[edi] |
- | |
422 | mcall |
- | |
423 | mov ebx,0x80100 |
- | |
424 | add edx,(6*19)shl 16 |
- | |
425 | mcall |
- | |
426 | .ex: |
- | |
427 | ret |
- | |
428 | - | ||
429 | draw_dump: |
- | |
430 | ; esi - data ptr, ecx - length |
- | |
431 | jecxz draw_numbers.ex |
- | |
432 | pusha |
- | |
433 | call draw_numbers |
- | |
434 | mcall 4,(LMARGIN+2) shl 16+27,0,dump_title,dump_t_len-dump_title |
- | |
435 | mcall 47,0x30101,ipcbuff+8,(LMARGIN+2+6*29)shl 16+27 |
- | |
436 | add edx,(6*27) shl 16 |
- | |
437 | mov ecx,offs |
- | |
438 | mcall |
- | |
439 | sub edx,(5*6)shl 16 |
- | |
440 | mcall ,0x30001 |
- | |
441 | mov ecx,16 |
- | |
442 | mov edi,HSPACE shl 16 |
- | |
443 | mov ebx,(LMARGIN+5)shl 16+42 |
- | |
444 | call draw_marks |
- | |
445 | mov ecx,[esp+24] |
- | |
446 | dec ecx |
- | |
447 | shr ecx,4 |
- | |
448 | inc ecx |
- | |
449 | mov ebx,(LMARGIN-10)shl 16+TMARGIN+2+VSPACE |
- | |
450 | mov edi,VSPACE |
- | |
451 | call draw_marks |
- | |
452 | popa |
- | |
453 | mov edx,TMARGIN+2 |
- | |
454 | mov edi,ecx |
- | |
455 | .lp: |
- | |
456 | add edx,(LMARGIN+2) shl 16+VSPACE |
- | |
457 | mov ecx,16 |
- | |
458 | cmp edi,ecx |
- | |
459 | jae .less |
- | |
460 | mov ecx,edi |
- | |
461 | .less: |
- | |
462 | sub edi,ecx |
- | |
463 | push esi ecx |
- | |
464 | mov ebx,0x20100 |
- | |
465 | .lp1: |
- | |
466 | push ecx esi |
- | |
467 | movzx ecx,byte[esi] |
- | |
468 | mcall 47,,,,0 |
- | |
469 | add edx,HSPACE shl 16 |
- | |
470 | pop esi ecx |
- | |
471 | inc esi |
- | |
472 | loop .lp1 |
- | |
473 | pusha |
- | |
474 | mov ebx,edx |
- | |
475 | and ebx,0xffff |
- | |
476 | add ebx,(LMARGIN+16*HSPACE+15)shl 16 |
- | |
477 | mov edx,[esp+36] |
- | |
478 | mov esi,[esp+32] |
- | |
479 | mcall 4,,0 |
- | |
480 | popa |
- | |
481 | add esp,8 |
- | |
482 | and edx,0xffff |
- | |
483 | test edi,edi |
- | |
484 | jnz .lp |
- | |
485 | .ex: |
- | |
486 | ret |
- | |
487 | - | ||
488 | draw_marks: |
- | |
489 | ; ebx -xy, edi-addition, ecx -cycles |
- | |
490 | pusha |
- | |
491 | mov edx,__hexdigits |
- | |
492 | mov eax,4 |
- | |
493 | mov esi,1 |
- | |
494 | .tt: |
- | |
495 | push ecx |
- | |
496 | mcall ,,0xffffff |
- | |
497 | add ebx,edi |
- | |
498 | inc edx |
- | |
499 | pop ecx |
- | |
500 | loop .tt |
- | |
501 | popa |
- | |
502 | ret |
- | |
503 | - | ||
504 | dump_btn: ; ecx-length |
- | |
505 | jecxz draw_dump.ex |
- | |
506 | pusha |
- | |
507 | test ecx,0xffff |
- | |
508 | je .even |
- | |
509 | add ecx,16 |
- | |
510 | .even: |
- | |
511 | shr ecx,4 |
- | |
512 | imul ecx,VSPACE |
- | |
513 | add ecx,(TMARGIN+VSPACE)shl 16-5 |
- | |
514 | mcall 8,LMARGIN shl 16+16*HSPACE-5,,10+3 shl 29,[sc.work] |
- | |
515 | inc edx |
- | |
516 | mcall ,(LMARGIN+16*HSPACE+15)shl 16+6*16 |
- | |
517 | mov edx,0xff0000 |
- | |
518 | mov esi,dump_cell_size |
- | |
519 | xor eax,eax |
- | |
520 | movzx ebx,[sel_byte] |
- | |
521 | lodsw |
- | |
522 | imul bx,ax |
- | |
523 | shl ebx,16 |
- | |
524 | lea ebx,[ebx+eax+LMARGIN shl 16] |
- | |
525 | movzx ecx,[sel_byte+2] |
- | |
526 | lodsw |
- | |
527 | imul cx,ax |
- | |
528 | shl ecx,16 |
- | |
529 | lea ecx,[ecx+eax+(TMARGIN+VSPACE) shl 16] |
- | |
530 | mcall 13 |
- | |
531 | movzx ebx,[sel_byte] |
- | |
532 | lodsw |
- | |
533 | imul bx,ax |
- | |
534 | shl ebx,16 |
- | |
535 | lea ebx,[ebx+eax+(LMARGIN+16*HSPACE+15)shl 16] |
- | |
536 | mcall 13 |
- | |
537 | popa |
- | |
538 | .ex: |
- | |
Line 539... | Line 267... | ||
539 | ret |
267 | ret |
540 | 268 | ||
541 | 269 | ||
542 | if WRITE_LOG |
270 | if WRITE_LOG |
Line 604... | Line 332... | ||
604 | 332 | ||
605 | 333 | ||
606 | - | ||
607 | - | ||
608 | krnl_msg db 'K : ' |
- | |
609 | duk db 'KernUserDump' |
- | |
Line 610... | Line 334... | ||
610 | numb db 'Byte: Word: Dword: Hex:' |
334 | |
Line 611... | Line -... | ||
611 | numb_len: |
- | |
612 | dump_title db 'Dump from (pid= h) Offset: ( h)' |
- | |
613 | dump_t_len: |
335 | |
614 | 336 | krnl_msg db 'K : ' |
|
615 | ; DATA AREA |
337 | duk db 'KernUser' |
616 | 338 | ||
617 | dump_cell_marg dd LMARGIN shl 16,(LMARGIN+16*HSPACE+15)shl 16 |
339 | ; DATA AREA |
Line 629... | Line 351... | ||
629 | vmode dd 1 |
351 | vmode dd 1 |
630 | targ dd text2 |
352 | targ dd text2 |
631 | I_END: |
353 | I_END: |
632 | offs dd ? |
354 | offs dd ? |
633 | flag rb 1 |
355 | flag rb 1 |
634 | ipcbuff rb IPC_BUF+20 |
- | |
635 | rd 2 |
356 | rd 2 |
636 | ; x1pos dd ? |
357 | ; x1pos dd ? |
637 | ; y1pos dd ? |
358 | ; y1pos dd ? |
638 | text1 rb 80*(MAXSTRINGS+1) |
359 | text1 rb 80*(MAXSTRINGS+1) |
639 | tmp1 db ? |
360 | tmp1 db ? |
640 | rd 2 |
361 | rd 2 |
641 | ; x2pos dd ? |
362 | ; x2pos dd ? |
642 | ; y2pos dd ? |
363 | ; y2pos dd ? |
643 | text2 rb 80*(MAXSTRINGS+1) |
364 | text2 rb 80*(MAXSTRINGS+1) |
644 | tmp2 db ? |
365 | tmp2 db ? |
645 | work rb 4096 |
- | |
646 | sel_byte dw ?,? |
- | |
647 | pid dd ? |
- | |
648 | xstart dd ? |
366 | xstart dd ? |
649 | dump_len dd ? |
- | |
650 | sc system_colors |
367 | sc system_colors |
651 | i_end: |
368 | i_end: |
Line 652... | Line 369... | ||
652 | 369 | ||
- | 370 | filename rb 256 |
|
- | 371 | align 4 |
|
- | 372 | stackbuf rb 2000h |