Rev 109 | Rev 317 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
31 | halyavin | 1 | ; Author: M. Lisovin |
2 | ; Compile with FASM for Menuet |
||
3 | ; |
||
4 | |||
5 | use32 |
||
6 | |||
7 | org 0x0 |
||
8 | |||
9 | db 'MENUET01' ; 8 byte id |
||
10 | dd 0x01 ; header version |
||
11 | dd START ; start of code |
||
12 | dd I_END ; size of image |
||
13 | dd 0x1000 ; memory for app |
||
14 | dd 0x1000 ; esp |
||
15 | dd 0x0 , 0x0 ; I_Param , I_Icon |
||
16 | |||
17 | include 'lang.inc' |
||
18 | include 'macros.inc' |
||
19 | |||
20 | START: ; start of execution |
||
21 | |||
22 | call draw_window |
||
23 | |||
24 | still: |
||
25 | |||
26 | mov eax,10 ; wait here for event |
||
27 | int 0x40 |
||
28 | |||
29 | cmp eax,1 ; redraw request ? |
||
30 | je red |
||
31 | cmp eax,2 ; key in buffer ? |
||
32 | je key |
||
33 | cmp eax,3 ; button in buffer ? |
||
34 | je button |
||
35 | |||
36 | jmp still |
||
37 | |||
38 | red: ; redraw |
||
39 | call draw_window |
||
40 | jmp still |
||
41 | |||
42 | key: ; key |
||
43 | mov eax,2 ; just read it and ignore |
||
44 | int 0x40 |
||
45 | mov [keyid],ah |
||
46 | call draw_window |
||
47 | jmp still |
||
48 | |||
49 | button: ; button |
||
50 | mov eax,17 ; get id |
||
51 | int 0x40 |
||
52 | |||
53 | cmp ah,1 ; button id=1 ? |
||
54 | jne noclose |
||
55 | |||
56 | mov eax,-1 ; close this program |
||
57 | int 0x40 |
||
58 | noclose: |
||
59 | |||
60 | jmp still |
||
61 | |||
62 | |||
63 | |||
64 | |||
65 | ; ********************************************* |
||
66 | ; ******* WINDOW DEFINITIONS AND DRAW ******** |
||
67 | ; ********************************************* |
||
68 | |||
69 | |||
70 | draw_window: |
||
71 | |||
72 | |||
73 | mov eax,12 ; function 12:tell os about windowdraw |
||
74 | mov ebx,1 ; 1, start of draw |
||
75 | int 0x40 |
||
76 | |||
77 | ; DRAW WINDOW |
||
78 | mov eax,0 ; function 0 : define and draw window |
||
79 | mov ebx,100*65536+270 ; [x start] *65536 + [x size] |
||
80 | mov ecx,100*65536+80 ; [y start] *65536 + [y size] |
||
81 | mov edx,0x83ffffff ; color of work area RRGGBB,8->color gl |
||
82 | mov esi,0x805080d0 ; color of grab bar RRGGBB,8->color gl |
||
83 | mov edi,0x005080d0 ; color of frames RRGGBB |
||
84 | int 0x40 |
||
85 | |||
86 | mov eax,4 ; function 4 : write text to window |
||
87 | mov ebx,8*65536+8 ; [x start] *65536 + [y start] |
||
88 | mov ecx,0x00ddeeff ; color of text RRGGBB |
||
89 | mov edx,labelt ; pointer to text beginning |
||
90 | mov esi,labellen-labelt ; text length |
||
91 | int 0x40 |
||
147 | diamond | 92 | xor ecx,0xFFFFFF |
31 | halyavin | 93 | mov esi,4 |
94 | add ebx,23 |
||
95 | mov edx,tdec |
||
96 | int 0x40 |
||
97 | add ebx,23 |
||
98 | mov edx,thex |
||
99 | int 0x40 |
||
100 | |||
101 | mov ecx,[keyid] |
||
102 | mov eax,47 |
||
103 | mov ebx,3*65536 |
||
104 | mov edx,40*65536+31 |
||
105 | mov esi,0x224466 |
||
106 | int 0x40 |
||
107 | add edx,23 |
||
108 | mov bh,1 |
||
109 | int 0x40 |
||
110 | |||
111 | mov eax,12 ; function 12:tell os about windowdraw |
||
112 | mov ebx,2 ; 2, end of draw |
||
113 | int 0x40 |
||
114 | |||
115 | ret |
||
116 | |||
117 | |||
118 | ; DATA AREA |
||
119 | |||
120 | tdec: db 'DEC:' |
||
121 | thex: db 'HEX:' |
||
122 | labelt: |
||
123 | db 'KEYBOARD ASCIICODES-PRESS ANY KEY' |
||
124 | labellen:dd 0 |
||
125 | keyid:db 0 |
||
126 | I_END: |
||
127 |