Rev 109 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 109 | Rev 485 | ||
---|---|---|---|
Line 15... | Line 15... | ||
15 | DEBUGGING_DISABLED equ 0 |
15 | DEBUGGING_DISABLED equ 0 |
16 | DEBUGGING_STATE equ DEBUGGING_DISABLED |
16 | DEBUGGING_STATE equ DEBUGGING_DISABLED |
Line 17... | Line 17... | ||
17 | 17 | ||
18 | - | ||
19 | use32 |
18 | |
20 | - | ||
21 | org 0x0 |
19 | use32 |
22 | 20 | org 0x0 |
|
23 | db 'MENUET00' ; 8 byte id |
21 | db 'MENUET01' ; header |
24 | dd 38 ; required os |
22 | dd 0x01 ; header version |
25 | dd START ; program start |
23 | dd START ; entry point |
- | 24 | dd I_END ; image size |
|
26 | dd I_END ; program image size |
25 | dd I_END+0x10000 ; required memory |
Line 27... | Line 26... | ||
27 | dd 0x100000 ; required amount of memory |
26 | dd I_END+0x10000 ; esp |
28 | dd 0x00000000 ; reserved=no extended header |
27 | dd 0x0 , 0x0 ; I_Param , I_Path |
Line 29... | Line 28... | ||
29 | 28 | ||
30 | include 'lang.inc' |
29 | include 'lang.inc' |
31 | include 'macros.inc' |
30 | include '..\..\..\macros.inc' |
32 | 31 | ||
Line 33... | Line 32... | ||
33 | START: ; start of execution |
32 | START: ; start of execution |
34 | mov eax,40 ; Report events |
33 | mov eax,40 ; Report events |
Line -... | Line 34... | ||
- | 34 | mov ebx,10000111b ; Stack 8 + defaults |
|
35 | mov ebx,10000111b ; Stack 8 + defaults |
35 | int 0x40 |
Line 36... | Line 36... | ||
36 | int 0x40 |
36 | |
37 | 37 | mov dword [prompt], p1 |
|
38 | mov dword [prompt], p1 |
38 | mov dword [promptlen], p1len - p1 ; 'waiting for command' |
Line 39... | Line 39... | ||
39 | mov dword [promptlen], p1len - p1 ; 'waiting for command' |
39 | |
40 | 40 | red: |
|
41 | call draw_window ; at first, draw the window |
41 | call draw_window ; at first, draw the window |
42 | 42 | ||
43 | still: |
43 | still: |
44 | mov eax,10 ; wait here for event |
44 | mov eax,10 ; wait here for event |
Line 45... | Line 45... | ||
45 | int 0x40 |
45 | mcall |
46 | - | ||
47 | cmp eax,1 ; redraw request ? |
- | |
48 | jz red |
- | |
49 | cmp eax,2 ; key in buffer ? |
- | |
50 | jz key |
- | |
51 | cmp eax,3 ; button in buffer ? |
46 | |
52 | jz button |
47 | cmp eax,1 ; redraw request ? |
53 | 48 | jz red |
|
54 | jmp still |
49 | cmp eax,2 ; key in buffer ? |
Line 55... | Line 50... | ||
55 | 50 | jz key |
|
56 | red: ; redraw |
51 | cmp eax,3 ; button in buffer ? |
57 | call draw_window |
52 | jz button |
Line 58... | Line 53... | ||
58 | jmp still |
53 | |
59 | 54 | jmp still |
|
Line 60... | Line 55... | ||
60 | key: ; Keys are not valid at this part of the |
55 | key: ; Keys are not valid at this part of the |
61 | mov eax,2 ; loop. Just read it and ignore |
56 | mov eax,2 ; loop. Just read it and ignore |
62 | int 0x40 |
57 | mcall |
63 | jmp still |
58 | jmp still |
64 | 59 | ||
Line 65... | Line 60... | ||
65 | button: ; button |
60 | button: ; button |
66 | mov eax,17 ; get id |
61 | mov eax,17 ; get id |
Line 67... | Line 62... | ||
67 | int 0x40 |
62 | mcall |
68 | 63 | ||
69 | cmp ah,1 ; button id=1 ? |
64 | cmp ah,1 ; button id=1 ? |
Line 120... | Line 115... | ||
120 | 115 | ||
Line 121... | Line 116... | ||
121 | mov edi,[addr] |
116 | mov edi,[addr] |
122 | 117 | ||
123 | f11: |
118 | f11: |
124 | mov eax,10 |
119 | mov eax,10 |
125 | int 0x40 |
120 | mcall |
126 | cmp eax,2 |
121 | cmp eax,2 |
Line 127... | Line 122... | ||
127 | jz fbu |
122 | jz fbu |
128 | jmp still |
123 | jmp still |
129 | 124 | ||
130 | fbu: |
125 | fbu: |
131 | mov eax,2 |
126 | mov eax,2 |
132 | int 0x40 ; get key |
127 | mcall ; get key |
133 | shr eax,8 |
128 | shr eax,8 |
134 | cmp eax,8 |
129 | cmp eax,8 |
Line 167... | Line 162... | ||
167 | mov ebx,103*65536+26*6 |
162 | mov ebx,103*65536+26*6 |
168 | mov ecx,[ya] |
163 | mov ecx,[ya] |
169 | shl ecx,16 |
164 | shl ecx,16 |
170 | mov cx,8 |
165 | mov cx,8 |
171 | mov edx,0x224466 |
166 | mov edx,0x224466 |
172 | int 0x40 |
167 | mcall |
Line 173... | Line 168... | ||
173 | 168 | ||
174 | mov eax,4 |
169 | mov eax,4 |
175 | mov ebx,103*65536 |
170 | mov ebx,103*65536 |
176 | add ebx,[ya] |
171 | add ebx,[ya] |
177 | mov ecx,0xffffff |
172 | mov ecx,0xffffff |
178 | mov edx,[addr] |
173 | mov edx,[addr] |
179 | mov esi,26 |
174 | mov esi,26 |
Line 180... | Line 175... | ||
180 | int 0x40 |
175 | mcall |
Line 318... | Line 313... | ||
318 | getlp: |
313 | getlp: |
319 | inc ecx |
314 | inc ecx |
320 | push ecx |
315 | push ecx |
321 | mov eax, 53 |
316 | mov eax, 53 |
322 | mov ebx, 9 |
317 | mov ebx, 9 |
323 | int 0x40 |
318 | mcall |
324 | pop ecx |
319 | pop ecx |
325 | cmp eax, 0 ; is this local port in use? |
320 | cmp eax, 0 ; is this local port in use? |
326 | jz getlp ; yes - so try next |
321 | jz getlp ; yes - so try next |
Line 327... | Line 322... | ||
327 | 322 | ||
328 | ; First, open socket |
323 | ; First, open socket |
329 | mov eax, 53 |
324 | mov eax, 53 |
330 | mov ebx, 0 |
325 | mov ebx, 0 |
331 | mov edx, 53 ; remote port - dns |
326 | mov edx, 53 ; remote port - dns |
332 | mov esi, [dnsIP] |
327 | mov esi, [dnsIP] |
Line 333... | Line 328... | ||
333 | int 0x40 |
328 | mcall |
Line 334... | Line 329... | ||
334 | 329 | ||
335 | mov [socketNum], eax |
330 | mov [socketNum], eax |
336 | 331 | ||
337 | ; write to socket ( request DNS lookup ) |
332 | ; write to socket ( request DNS lookup ) |
338 | mov eax, 53 |
333 | mov eax, 53 |
339 | mov ebx, 4 |
334 | mov ebx, 4 |
340 | mov ecx, [socketNum] |
335 | mov ecx, [socketNum] |
Line 341... | Line 336... | ||
341 | mov edx, [dnsMsgLen] |
336 | mov edx, [dnsMsgLen] |
Line 342... | Line 337... | ||
342 | mov esi, dnsMsg |
337 | mov esi, dnsMsg |
343 | int 0x40 |
338 | mcall |
Line 352... | Line 347... | ||
352 | ; UI close |
347 | ; UI close |
353 | ; or data from remote |
348 | ; or data from remote |
Line 354... | Line 349... | ||
354 | 349 | ||
355 | ctr001: |
350 | ctr001: |
356 | mov eax,10 ; wait here for event |
351 | mov eax,10 ; wait here for event |
Line 357... | Line 352... | ||
357 | int 0x40 |
352 | mcall |
358 | 353 | ||
359 | cmp eax,1 ; redraw request ? |
354 | cmp eax,1 ; redraw request ? |
360 | je ctr003 |
355 | je ctr003 |
Line 366... | Line 361... | ||
366 | 361 | ||
367 | ; Any data in the UDP receive buffer? |
362 | ; Any data in the UDP receive buffer? |
368 | mov eax, 53 |
363 | mov eax, 53 |
369 | mov ebx, 2 |
364 | mov ebx, 2 |
370 | mov ecx, [socketNum] |
365 | mov ecx, [socketNum] |
Line 371... | Line 366... | ||
371 | int 0x40 |
366 | mcall |
372 | 367 | ||
Line 373... | Line 368... | ||
373 | cmp eax, 0 |
368 | cmp eax, 0 |
374 | je ctr001 |
369 | je ctr001 |
375 | 370 | ||
376 | ; we have data - this will be the response |
371 | ; we have data - this will be the response |
377 | ctr002: |
372 | ctr002: |
378 | mov eax, 53 |
373 | mov eax, 53 |
Line 379... | Line 374... | ||
379 | mov ebx, 3 |
374 | mov ebx, 3 |
380 | mov ecx, [socketNum] |
375 | mov ecx, [socketNum] |
381 | int 0x40 ; read byte - block (high byte) |
376 | mcall ; read byte - block (high byte) |
382 | 377 | ||
Line 391... | Line 386... | ||
391 | end if |
386 | end if |
Line 392... | Line 387... | ||
392 | 387 | ||
393 | mov eax, 53 |
388 | mov eax, 53 |
394 | mov ebx, 2 |
389 | mov ebx, 2 |
395 | mov ecx, [socketNum] |
390 | mov ecx, [socketNum] |
Line 396... | Line 391... | ||
396 | int 0x40 ; any more data? |
391 | mcall ; any more data? |
397 | 392 | ||
Line 398... | Line 393... | ||
398 | cmp eax, 0 |
393 | cmp eax, 0 |
399 | jne ctr002 ; yes, so get it |
394 | jne ctr002 ; yes, so get it |
400 | 395 | ||
401 | ; close socket |
396 | ; close socket |
402 | mov eax, 53 |
397 | mov eax, 53 |
Line 403... | Line 398... | ||
403 | mov ebx, 1 |
398 | mov ebx, 1 |
Line 404... | Line 399... | ||
404 | mov ecx, [socketNum] |
399 | mov ecx, [socketNum] |
405 | int 0x40 |
400 | mcall |
Line 487... | Line 482... | ||
487 | call draw_window |
482 | call draw_window |
488 | jmp ctr001 |
483 | jmp ctr001 |
Line 489... | Line 484... | ||
489 | 484 | ||
490 | ctr004: ; key |
485 | ctr004: ; key |
491 | mov eax,2 ; just read it and ignore |
486 | mov eax,2 ; just read it and ignore |
492 | int 0x40 |
487 | mcall |
Line 493... | Line 488... | ||
493 | jmp ctr001 |
488 | jmp ctr001 |
494 | 489 | ||
495 | ctr005: ; button |
490 | ctr005: ; button |
Line 496... | Line 491... | ||
496 | mov eax,17 ; get id |
491 | mov eax,17 ; get id |
497 | int 0x40 |
492 | mcall |
498 | 493 | ||
499 | ; close socket |
494 | ; close socket |
500 | mov eax, 53 |
495 | mov eax, 53 |
Line 501... | Line 496... | ||
501 | mov ebx, 1 |
496 | mov ebx, 1 |
502 | mov ecx, [socketNum] |
497 | mov ecx, [socketNum] |
Line 503... | Line 498... | ||
503 | int 0x40 |
498 | mcall |
Line 552... | Line 547... | ||
552 | 547 | ||
553 | 548 | ||
554 | draw_window: |
549 | draw_window: |
555 | mov eax,12 ; function 12:tell os about windowdraw |
550 | mov eax,12 ; function 12:tell os about windowdraw |
556 | mov ebx,1 ; 1, start of draw |
551 | mov ebx,1 ; 1, start of draw |
557 | int 0x40 |
552 | mcall |
558 | ; DRAW WINDOW |
553 | ; DRAW WINDOW |
559 | mov eax,0 ; function 0 : define and draw window |
554 | mov eax,0 ; function 0 : define and draw window |
560 | mov ebx,100*65536+300 ; [x start] *65536 + [x size] |
555 | mov ebx,100*65536+300 ; [x start] *65536 + [x size] |
561 | mov ecx,100*65536+140 ; [y start] *65536 + [y size] |
- | |
562 | mov edx,0x03224466 ; color of work area RRGGBB |
- | |
563 | mov esi,0x00334455 ; color of grab bar RRGGBB,8->color gl |
- | |
564 | mov edi,0x00ddeeff ; color of frames RRGGBB |
556 | mov ecx,100*65536+140 ; [y start] *65536 + [y size] |
565 | int 0x40 |
- | |
566 | ; WINDOW LABEL |
- | |
567 | mov eax,4 ; function 4 : write text to window |
- | |
568 | mov ebx,8*65536+8 ; [x start] *65536 + [y start] |
- | |
569 | mov ecx,0x00ffffff ; color of text RRGGBB |
- | |
570 | mov edx,labelt ; pointer to text beginning |
557 | mov edx,0x13224466 ; color of work area RRGGBB |
Line 571... | Line 558... | ||
571 | mov esi,labellen-labelt ; text length |
558 | mov edi,title ; WINDOW LABEL; |
572 | int 0x40 |
559 | mcall |
573 | 560 | ||
574 | mov eax,8 ; Resolve |
561 | mov eax,8 ; Resolve |
575 | mov ebx,20*65536+190 |
562 | mov ebx,20*65536+190 |
576 | mov ecx,79*65536+15 |
563 | mov ecx,79*65536+15 |
Line 577... | Line 564... | ||
577 | mov edx,3 |
564 | mov edx,3 |
578 | mov esi,0x557799 |
565 | mov esi,0x557799 |
579 | int 0x40 |
566 | mcall |
580 | 567 | ||
581 | mov eax,8 |
- | |
582 | mov ebx,270*65536+10 |
568 | ;mov eax,8 |
Line 583... | Line 569... | ||
583 | mov ecx,34*65536+10 |
569 | mov ebx,270*65536+10 |
584 | mov edx,4 |
570 | mov ecx,34*65536+10 |
585 | mov esi,0x557799 |
571 | inc edx |
586 | int 0x40 |
572 | mcall |
587 | - | ||
588 | mov eax,8 |
573 | |
Line 589... | Line 574... | ||
589 | mov ebx,270*65536+10 |
574 | ;mov eax,8 |
590 | mov ecx,50*65536+10 |
575 | mov ebx,270*65536+10 |
591 | mov edx,5 |
576 | mov ecx,50*65536+10 |
592 | mov esi,0x557799 |
577 | inc edx |
Line 614... | Line 599... | ||
614 | mov ecx,[promptlen] |
599 | mov ecx,[promptlen] |
615 | rep movsb |
600 | rep movsb |
Line 616... | Line 601... | ||
616 | 601 | ||
617 | ; Re-draw the screen text |
602 | ; Re-draw the screen text |
- | 603 | cld |
|
618 | cld |
604 | mov eax,4 |
619 | mov ebx,25*65536+35 ; draw info text with function 4 |
605 | mov ebx,25*65536+35 ; draw info text with function 4 |
620 | mov ecx,0xffffff |
606 | mov ecx,0xffffff |
621 | mov edx,text |
607 | mov edx,text |
622 | mov esi,40 |
- | |
623 | 608 | mov esi,40 |
|
624 | newline: |
609 | newline: |
625 | mov eax,4 |
- | |
626 | int 0x40 |
610 | mcall |
627 | add ebx,16 |
611 | add ebx,16 |
628 | add edx,40 |
612 | add edx,40 |
629 | cmp [edx],byte 'x' |
613 | cmp [edx],byte 'x' |
Line 642... | Line 626... | ||
642 | mov ebx,3*65536 |
626 | mov ebx,3*65536 |
Line 643... | Line 627... | ||
643 | 627 | ||
644 | ipdisplay: |
628 | ipdisplay: |
645 | mov eax,47 |
629 | mov eax,47 |
646 | movzx ecx,byte [edi] |
630 | movzx ecx,byte [edi] |
647 | int 0x40 |
631 | mcall |
648 | add edx,6*4*65536 |
632 | add edx,6*4*65536 |
649 | inc edi |
633 | inc edi |
650 | cmp edi,hostIP+4 |
634 | cmp edi,hostIP+4 |
Line 651... | Line 635... | ||
651 | jb ipdisplay |
635 | jb ipdisplay |
652 | 636 | ||
653 | dw001: |
637 | dw001: |
654 | mov eax,12 ; function 12:tell os about windowdraw |
638 | mov eax,12 ; function 12:tell os about windowdraw |
Line 655... | Line 639... | ||
655 | mov ebx,2 ; 2, end of draw |
639 | mov ebx,2 ; 2, end of draw |
Line 656... | Line 640... | ||
656 | int 0x40 |
640 | mcall |
Line 679... | Line 663... | ||
679 | 663 | ||
680 | dps_001: |
664 | dps_001: |
681 | mov eax,63 |
665 | mov eax,63 |
682 | mov ebx, 1 |
666 | mov ebx, 1 |
683 | push esi |
667 | push esi |
Line 684... | Line 668... | ||
684 | int 0x40 |
668 | mcall |
685 | 669 | ||
686 | inc word [ind] |
670 | inc word [ind] |
687 | mov ax, [ind] |
671 | mov ax, [ind] |
688 | and ax, 0x1f |
672 | and ax, 0x1f |
Line 689... | Line 673... | ||
689 | cmp ax, 0 |
673 | cmp ax, 0 |
690 | jne ds1 |
674 | jne ds1 |
691 | 675 | ||
692 | mov cl, 13 |
676 | mov cl, 13 |
693 | mov eax,63 |
677 | mov eax,63 |
694 | mov ebx, 1 |
678 | mov ebx, 1 |
695 | int 0x40 |
679 | mcall |
696 | mov cl, 10 |
680 | mov cl, 10 |
Line 697... | Line 681... | ||
697 | mov eax,63 |
681 | mov eax,63 |
698 | mov ebx, 1 |
682 | mov ebx, 1 |
699 | int 0x40 |
683 | mcall |
Line 748... | Line 732... | ||
748 | db ' ' |
732 | db ' ' |
749 | db ' ' |
733 | db ' ' |
750 | db 'x <- END MARKER, DONT DELETE ' |
734 | db 'x <- END MARKER, DONT DELETE ' |
Line 751... | Line -... | ||
751 | - | ||
752 | 735 | ||
753 | labelt: |
- | |
Line 754... | Line 736... | ||
754 | db 'DNS Client' |
736 | |
755 | labellen: |
737 | title db 'DNS Client',0 |
Line 768... | Line 750... | ||
768 | p5: db 'Resolving... ' |
750 | p5: db 'Resolving... ' |
769 | p5len: |
751 | p5len: |
Line 770... | Line 752... | ||
770 | 752 | ||
771 | 753 | ||
Line 772... | Line 754... | ||
772 | dnsServer db '194.145.128.1 ' ; iolfree.ie DNS |
754 | dnsServer db '194.145.128.1 ' ; iolfree.ie DNS |
773 | query db 'WWW.MENUETOS.ORG ' |
755 | query db 'WWW.MENUETOS.NET ' |
774 | 756 | ||
775 | hostIP: dd 0 |
757 | hostIP: dd 0 |