Rev 485 | Only display areas with differences | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 485 | Rev 8163 | ||
---|---|---|---|
1 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
1 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
2 | ; |
2 | ; |
3 | ; MENU / DIALOG EXAMPLE |
3 | ; MENU / DIALOG EXAMPLE |
4 | ; |
4 | ; |
5 | ; Compile with FASM for Menuet |
5 | ; Compile with FASM |
6 | ; |
6 | ; |
7 | 7 | ||
8 | use32 |
8 | use32 |
9 | 9 | ||
10 | org 0x0 |
10 | org 0x0 |
11 | 11 | ||
12 | db 'MENUET01' ; 8 byte id |
12 | db 'MENUET01' ; 8 byte id |
13 | dd 0x01 ; header version |
13 | dd 0x01 ; header version |
14 | dd START ; start of code |
14 | dd START ; start of code |
15 | dd I_END ; size of image |
15 | dd I_END ; size of image |
16 | dd 0x10000 ; memory for app |
16 | dd 0x10000 ; memory for app |
17 | dd 0x10000 ; esp |
17 | dd 0x10000 ; esp |
18 | dd 0x0 , 0x0 ; I_Param , I_Icon |
18 | dd 0x0 , 0x0 ; I_Param , I_Icon |
19 | 19 | ||
20 | include 'lang.inc' |
20 | include 'lang.inc' |
21 | include '..\..\..\..\macros.inc' |
21 | include '..\..\..\..\macros.inc' |
22 | include 'dialogs1.inc' |
22 | include 'dialogs1.inc' |
23 | 23 | ||
24 | menu_history dd 0x0 |
24 | menu_history dd 0x0 |
25 | 25 | ||
26 | START: ; start of execution |
26 | START: ; start of execution |
27 | 27 | ||
28 | red: |
28 | red: |
29 | call draw_window_main |
29 | call draw_window_main |
30 | 30 | ||
31 | still: ; wait here for event |
31 | still: ; wait here for event |
32 | 32 | ||
33 | mov eax,10 |
33 | mov eax,10 |
34 | mcall |
34 | mcall |
35 | 35 | ||
36 | cmp eax,1 ; process events |
36 | cmp eax,1 ; process events |
37 | je red |
37 | je red |
38 | cmp eax,2 |
38 | cmp eax,2 |
39 | je key |
39 | je key |
40 | cmp eax,3 |
40 | cmp eax,3 |
41 | je button |
41 | je button |
42 | 42 | ||
43 | call check_mouse ; DIALOG CHECK |
43 | call check_mouse ; DIALOG CHECK |
44 | 44 | ||
45 | mov eax,[menu_action] |
45 | mov eax,[menu_action] |
46 | cmp eax,[menu_history] |
46 | cmp eax,[menu_history] |
47 | je nodisplay |
47 | je nodisplay |
48 | 48 | ||
49 | mov [menu_history],eax |
49 | mov [menu_history],eax |
50 | 50 | ||
51 | mov eax,13 |
51 | mov eax,13 |
52 | mov ebx,220*65536+6*4 |
52 | mov ebx,220*65536+6*4 |
53 | mov ecx,70*65536+8 |
53 | mov ecx,70*65536+8 |
54 | mov edx,0xffffff |
54 | mov edx,0xffffff |
55 | mcall |
55 | mcall |
56 | 56 | ||
57 | mov eax,4 ; show menu selections |
57 | mov eax,4 ; show menu selections |
58 | mov ebx,220*65536+70 |
58 | mov ebx,220*65536+70 |
59 | mov ecx,0x000000 |
59 | mov ecx,0x000000 |
60 | mov edx,menu_action |
60 | mov edx,menu_action |
61 | mov esi,4 |
61 | mov esi,4 |
62 | mcall |
62 | mcall |
63 | 63 | ||
64 | nodisplay: |
64 | nodisplay: |
65 | 65 | ||
66 | cmp word [menu_action],word 'AD' ; user requests close |
66 | cmp word [menu_action],word 'AD' ; user requests close |
67 | jne no_menu_close |
67 | jne no_menu_close |
68 | mov eax,-1 |
68 | mov eax,-1 |
69 | mcall |
69 | mcall |
70 | no_menu_close: |
70 | no_menu_close: |
71 | 71 | ||
72 | jmp still |
72 | jmp still |
73 | 73 | ||
74 | key: |
74 | key: |
75 | mov eax,2 ; key in buffer |
75 | mov eax,2 ; key in buffer |
76 | mcall |
76 | mcall |
77 | jmp still |
77 | jmp still |
78 | 78 | ||
79 | button: ; button in buffer |
79 | button: ; button in buffer |
80 | mov eax,17 |
80 | mov eax,17 |
81 | mcall |
81 | mcall |
82 | 82 | ||
83 | cmp ah,1 ; close application |
83 | cmp ah,1 ; close application |
84 | jne noclose |
84 | jne noclose |
85 | or eax,-1 |
85 | or eax,-1 |
86 | mcall |
86 | mcall |
87 | noclose: |
87 | noclose: |
88 | 88 | ||
89 | cmp ah,2 |
89 | cmp ah,2 |
90 | jne no_alert_box ; ALERT BOX |
90 | jne no_alert_box ; ALERT BOX |
91 | mov eax,170 ; window width |
91 | mov eax,170 ; window width |
92 | mov ebx,alert_text ; asciiz string |
92 | mov ebx,alert_text ; asciiz string |
93 | mov ecx,1 ; OK button |
93 | mov ecx,1 ; OK button |
94 | call alert_box ; function call |
94 | call alert_box ; function call |
95 | jmp still |
95 | jmp still |
96 | no_alert_box: |
96 | no_alert_box: |
97 | 97 | ||
98 | cmp ah,3 |
98 | cmp ah,3 |
99 | jne no_choose_box ; CHOOSE BOX |
99 | jne no_choose_box ; CHOOSE BOX |
100 | mov eax,220 ; window width |
100 | mov eax,220 ; window width |
101 | mov ebx,choose_text ; asciiz string |
101 | mov ebx,choose_text ; asciiz string |
102 | mov ecx,2 ; YES/NO buttons |
102 | mov ecx,2 ; YES/NO buttons |
103 | call alert_box ; function call |
103 | call alert_box ; function call |
104 | jmp still |
104 | jmp still |
105 | no_choose_box: |
105 | no_choose_box: |
106 | 106 | ||
107 | 107 | ||
108 | jmp still |
108 | jmp still |
109 | 109 | ||
110 | 110 | ||
111 | 111 | ||
112 | 112 | ||
113 | ; ********************************************* |
113 | ; ********************************************* |
114 | ; ******* WINDOW DEFINITIONS AND DRAW ******** |
114 | ; ******* WINDOW DEFINITIONS AND DRAW ******** |
115 | ; ********************************************* |
115 | ; ********************************************* |
116 | 116 | ||
117 | draw_window_main: |
117 | draw_window_main: |
118 | 118 | ||
119 | mov eax,12 ; function 12:tell os about windowdraw |
119 | mov eax,12 ; function 12:tell os about windowdraw |
120 | mov ebx,1 ; 1, start of draw |
120 | mov ebx,1 ; 1, start of draw |
121 | mcall |
121 | mcall |
122 | 122 | ||
123 | mov eax,0 ; open window |
123 | mov eax,0 ; open window |
124 | mov ebx,100*65536+300 |
124 | mov ebx,100*65536+300 |
125 | mov ecx,100*65536+120 |
125 | mov ecx,100*65536+120 |
126 | mov edx,0x02ffffff |
126 | mov edx,0x02ffffff |
127 | mov esi,0x805080d0 |
127 | mov esi,0x805080d0 |
128 | mov edi,0x005080d0 |
128 | mov edi,0x005080d0 |
129 | mcall |
129 | mcall |
130 | 130 | ||
131 | call draw_menu ; DRAW MENU |
131 | call draw_menu ; DRAW MENU |
132 | 132 | ||
133 | mov eax,4 ; window label |
133 | mov eax,4 ; window label |
134 | mov ebx,8*65536+8 |
134 | mov ebx,8*65536+8 |
135 | mov ecx,0x10ddeeff |
135 | mov ecx,0x10ddeeff |
136 | mov edx,labelt |
136 | mov edx,labelt |
137 | mov esi,labellen-labelt |
137 | mov esi,labellen-labelt |
138 | mcall |
138 | mcall |
139 | 139 | ||
140 | mov eax,8 ; close button |
140 | mov eax,8 ; close button |
141 | mov ebx,(300-17)*65536+10 |
141 | mov ebx,(300-17)*65536+10 |
142 | mov ecx,5*65536+10 |
142 | mov ecx,5*65536+10 |
143 | mov edx,1 |
143 | mov edx,1 |
144 | mov esi,0x4466bb |
144 | mov esi,0x4466bb |
145 | mcall |
145 | mcall |
146 | 146 | ||
147 | mov eax,8 ; button : OPEN ALERT BOX |
147 | mov eax,8 ; button : OPEN ALERT BOX |
148 | mov ebx,25*65536+150 |
148 | mov ebx,25*65536+150 |
149 | mov ecx,61*65536+14 |
149 | mov ecx,61*65536+14 |
150 | mov edx,2 |
150 | mov edx,2 |
151 | mov esi,0x4466aa |
151 | mov esi,0x4466aa |
152 | mcall |
152 | mcall |
153 | 153 | ||
154 | mov eax,8 ; button : OPEN CHOOSE BOX |
154 | mov eax,8 ; button : OPEN CHOOSE BOX |
155 | mov ebx,25*65536+150 |
155 | mov ebx,25*65536+150 |
156 | mov ecx,81*65536+14 |
156 | mov ecx,81*65536+14 |
157 | mov edx,3 |
157 | mov edx,3 |
158 | mov esi,0x4466aa |
158 | mov esi,0x4466aa |
159 | mcall |
159 | mcall |
160 | 160 | ||
161 | mov ebx,20*65536+55 ; draw info text with function 4 |
161 | mov ebx,20*65536+55 ; draw info text with function 4 |
162 | mov ecx,0xffffff |
162 | mov ecx,0xffffff |
163 | mov edx,text |
163 | mov edx,text |
164 | mov esi,40 |
164 | mov esi,40 |
165 | newline: |
165 | newline: |
166 | mov eax,4 |
166 | mov eax,4 |
167 | mcall |
167 | mcall |
168 | add ebx,10 |
168 | add ebx,10 |
169 | add edx,40 |
169 | add edx,40 |
170 | cmp [edx],byte 'x' |
170 | cmp [edx],byte 'x' |
171 | jne newline |
171 | jne newline |
172 | 172 | ||
173 | mov eax,12 ; function 12:tell os about windowdraw |
173 | mov eax,12 ; function 12:tell os about windowdraw |
174 | mov ebx,2 ; 2, end of draw |
174 | mov ebx,2 ; 2, end of draw |
175 | mcall |
175 | mcall |
176 | 176 | ||
177 | ret |
177 | ret |
178 | 178 | ||
179 | 179 | ||
180 | ; DATA AREA |
180 | ; DATA AREA |
181 | 181 | ||
182 | text: |
182 | text: |
183 | db ' ' |
183 | db ' ' |
184 | db ' OPEN ALERT BOX ' |
184 | db ' OPEN ALERT BOX ' |
185 | db ' ' |
185 | db ' ' |
186 | db ' OPEN CHOOSE BOX ' |
186 | db ' OPEN CHOOSE BOX ' |
187 | 187 | ||
188 | db 'x <- END MARKER, DONT DELETE ' |
188 | db 'x <- END MARKER, DONT DELETE ' |
189 | 189 | ||
190 | labelt: |
190 | labelt: |
191 | db 'EXAMPLE APPLICATION' |
191 | db 'EXAMPLE APPLICATION' |
192 | labellen: |
192 | labellen: |
193 | 193 | ||
194 | alert_text db ' File not found !',0 |
194 | alert_text db ' File not found !',0 |
195 | choose_text db ' Save file before exit ? ',0 |
195 | choose_text db ' Save file before exit ? ',0 |
196 | 196 | ||
197 | I_END:-> |
197 | I_END:-> |