Go to most recent revision | Details | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
31 | halyavin | 1 | ;WARNING! Spaghetti code, size optimized |
2 | |||
3 | use32 |
||
4 | org 0x0 |
||
5 | |||
6 | db 'MENUET01' ; 8 byte id |
||
7 | dd 0x01 ; header version |
||
8 | dd START ; start of code |
||
9 | dd I_END ; size of image |
||
10 | dd 0x1000 ; memory for app |
||
11 | dd 0x1000 ; esp |
||
12 | dd 0x0 , 0x0 ; I_Param , I_Icon |
||
13 | |||
14 | include "lang.inc" |
||
15 | include "macros.inc" ; - 30 bytes !!! |
||
16 | |||
17 | |||
18 | START: |
||
19 | red: ; redraw |
||
20 | call draw_window |
||
21 | |||
22 | still: |
||
23 | |||
24 | mov eax,10 ; wait here for event |
||
25 | int 0x40 |
||
26 | |||
27 | cmp eax,1 ; redraw request ? |
||
28 | je red |
||
29 | cmp eax,2 ; key in buffer ? |
||
30 | je key |
||
31 | cmp eax,3 ; button in buffer ? |
||
32 | je button |
||
33 | |||
34 | ; jmp still |
||
35 | key: ; key |
||
36 | ; just read it and ignore |
||
37 | int 0x40 |
||
38 | jmp still |
||
39 | |||
40 | button: ; button |
||
41 | mov eax,17 ; get id |
||
42 | int 0x40 |
||
43 | cmp ah,1 ; button id=1 ? |
||
44 | je close |
||
45 | cmp ah,2 |
||
46 | je ramdiskcopy |
||
47 | cmp ah,3 |
||
48 | je ramdiskupdate |
||
49 | jmp togglewrite |
||
50 | close: |
||
51 | or eax,-1 ; close this program |
||
52 | jmp callsys |
||
53 | ramdiskcopy: |
||
54 | mov eax,16 |
||
55 | xor ebx,ebx |
||
56 | inc ebx |
||
57 | jmp callsys |
||
58 | ramdiskupdate: |
||
59 | mov eax,16 |
||
60 | xor ebx,ebx |
||
61 | inc ebx |
||
62 | inc ebx |
||
63 | jmp callsys |
||
64 | togglewrite: |
||
65 | call togglefdcwrite |
||
66 | callsys: |
||
67 | int 0x40 |
||
68 | jmp still |
||
69 | |||
70 | ; get fdc settings for writing & invert them. |
||
71 | togglefdcwrite: |
||
72 | mov eax,16 |
||
73 | mov ebx,4 |
||
74 | int 0x40 |
||
75 | xchg ecx,eax |
||
76 | xor ecx,1 |
||
77 | mov eax,16 |
||
78 | dec ebx |
||
79 | int 0x40 |
||
80 | |||
81 | mov [esp], dword still ; change return address ! |
||
82 | ;run trough drawwindow :] |
||
83 | |||
84 | ; ********************************************* |
||
85 | ; ******* WINDOW DEFINITIONS AND DRAW ******** |
||
86 | ; ********************************************* |
||
87 | |||
88 | |||
89 | draw_window: |
||
90 | |||
91 | |||
92 | mov eax,12 ; function 12:tell os about windowdraw |
||
93 | xor ebx,ebx ; 1, start of draw |
||
94 | inc ebx |
||
95 | int 0x40 |
||
96 | |||
97 | ; DRAW WINDOW |
||
98 | xor eax,eax ; function 0 : define and draw win |
||
99 | mov ebx,100*65536+250 ; [x start] *65536 + [x size] |
||
100 | mov ecx,100*65536+120 ; [y start] *65536 + [y size] |
||
101 | mov edx,0x03ffffff ; color of work area RRGGBB,8->color gl |
||
102 | int 0x40 |
||
103 | |||
104 | ;The important part, the buttons & text. |
||
105 | |||
106 | mov ebx,9*65536+36 |
||
107 | mov ecx,41*65536+14 |
||
108 | xor edx,edx |
||
109 | inc edx |
||
110 | inc edx |
||
111 | ;mov edx,2 |
||
112 | call clickbox |
||
113 | |||
114 | mov ebx,67*65536+49 |
||
115 | inc edx |
||
116 | call clickbox |
||
117 | |||
118 | mov ebx,12*65536+12 |
||
119 | mov ecx,81*65536+12 |
||
120 | inc edx |
||
121 | call clickbox |
||
122 | |||
123 | mov ecx,96*65536+12 |
||
124 | xor edx,edx |
||
125 | call clickbox |
||
126 | |||
127 | mov edi,0x10000000 |
||
128 | mov edx,titlebar |
||
129 | mov ebx,9*65536+9 |
||
130 | mov ecx,0x10ffffff |
||
131 | call print |
||
132 | |||
133 | ; mov edx,h1 |
||
134 | mov ebx,11*65536+28 |
||
135 | mov ecx,0x10808080 |
||
136 | call print |
||
137 | |||
138 | ; mov edx,comtext |
||
139 | add ebx,15 |
||
140 | xchg ecx,edi |
||
141 | call print |
||
142 | |||
143 | ; mov edx,h2 |
||
144 | add ebx,25 |
||
145 | xchg ecx,edi |
||
146 | call print |
||
147 | |||
148 | ; mov edx,setwrite |
||
149 | add ebx,15 |
||
150 | xchg ecx,edi |
||
151 | call print |
||
152 | |||
153 | ; mov edx,setread |
||
154 | add ebx,15 |
||
155 | xchg ecx,edi |
||
156 | call print |
||
157 | |||
158 | mov eax,16 |
||
159 | mov ebx,4 |
||
160 | int 0x40 |
||
161 | test al,1 |
||
162 | je nowritex |
||
163 | ; mov edx,xsign |
||
164 | mov ebx,14*65536+83 |
||
165 | xchg ecx,edi |
||
166 | call print |
||
167 | nowritex: |
||
168 | mov eax,12 ; function 12:tell os about windowdraw |
||
169 | mov ebx,2 ; 2, end of draw |
||
170 | int 0x40 |
||
171 | ret |
||
172 | |||
173 | clickbox: |
||
174 | pusha |
||
175 | mov edi,edx |
||
176 | cmp edx, 0 |
||
177 | je .disabledbox |
||
178 | mov eax,8 ; function 8 : define and draw button |
||
179 | int 0x40 |
||
180 | .disabledbox: |
||
181 | inc ecx |
||
182 | inc ebx |
||
183 | mov eax,13 |
||
184 | mov edx, 0x808080 |
||
185 | int 0x40 |
||
186 | cmp edi,0 |
||
187 | je .grayed |
||
188 | mov edx,0x80 |
||
189 | .grayed: |
||
190 | sub ebx,65536 |
||
191 | sub ecx,65536 |
||
192 | int 0x40 |
||
193 | add ebx,65534 |
||
194 | add ecx,65534 |
||
195 | mov edx,0xffffff |
||
196 | int 0x40 |
||
197 | popa |
||
198 | ret |
||
199 | |||
200 | print: |
||
201 | mov eax,edx |
||
202 | xor esi,esi |
||
203 | addchar: |
||
204 | inc eax |
||
205 | inc esi |
||
206 | cmp [eax],byte 0 |
||
207 | jne addchar |
||
208 | mov eax,4 |
||
209 | int 0x40 |
||
210 | add edx,esi |
||
211 | inc edx |
||
212 | ret |
||
213 | |||
214 | |||
215 | ; DATA AREA |
||
216 | |||
217 | titlebar: db 'RD2FD',0 |
||
218 | h1: db 'Commands',0 |
||
219 | comtext: db 'Copy or Update ramdisk to floppy',0 |
||
220 | h2: db 'Settings',0 |
||
221 | setwrite: db ' Write directly to floppy',0 |
||
222 | setread: db ' Read directly from floppy',0 |
||
223 | xsign: db 'X',0 |
||
224 | I_END: |
||
225 |