Go to most recent revision | Details | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
31 | halyavin | 1 | ; mos.inc 0.03 |
2 | ; Copyright (c) 2002 Thomas Mathys |
||
3 | ; killer@vantage.ch |
||
4 | ; |
||
5 | ; This program is free software; you can redistribute it and/or modify |
||
6 | ; it under the terms of the GNU General Public License as published by |
||
7 | ; the Free Software Foundation; either version 2 of the License, or |
||
8 | ; (at your option) any later version. |
||
9 | ; |
||
10 | ; This program is distributed in the hope that it will be useful, |
||
11 | ; but WITHOUT ANY WARRANTY; without even the implied warranty of |
||
12 | ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||
13 | ; GNU General Public License for more details. |
||
14 | ; |
||
15 | ; You should have received a copy of the GNU General Public License |
||
16 | ; along with this program; if not, write to the Free Software |
||
17 | ; Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
||
18 | ; |
||
19 | %ifndef _MOS_INC |
||
20 | %define _MOS_INC |
||
21 | |||
22 | |||
23 | ;********************************************************** |
||
24 | ; generates a menuetos 01 header |
||
25 | ; takes 6 parameters: |
||
26 | ; |
||
27 | ; MOS_HEADER01 start, end, appmem, esp, i_param, i_icon |
||
28 | ;********************************************************** |
||
29 | |||
30 | %macro MOS_HEADER01 6 |
||
31 | org 0x0 |
||
32 | db 'MENUET01' ; 8 byte id |
||
33 | dd 0x01 ; header version |
||
34 | dd %1 ; start of code |
||
35 | dd %2 ; image size |
||
36 | dd %3 ; application memory |
||
37 | dd %4 ; esp |
||
38 | dd %5 ; i_param |
||
39 | dd %6 ; i_icon |
||
40 | %endmacro |
||
41 | |||
42 | |||
43 | ;********************************************************** |
||
44 | ; MOS_DWORD |
||
45 | ; packs 2 words into a double word |
||
46 | ;********************************************************** |
||
47 | |||
48 | %define MOS_DWORD(hi,lo) ((((hi) & 0xffff) << 16) + ((lo) & 0xffff)) |
||
49 | |||
50 | |||
51 | ;********************************************************** |
||
52 | ; MOS_RGB |
||
53 | ; creates a menuet os compatible color (0x00RRGGBB) |
||
54 | ;********************************************************** |
||
55 | |||
56 | %define MOS_RGB(r,g,b) ((((r) & 255) << 16) + (((g) & 255) << 8) + ((b) & 255)) |
||
57 | |||
58 | |||
59 | ;********************************************************** |
||
60 | ; window stuff |
||
61 | ;********************************************************** |
||
62 | |||
63 | ; default window colors |
||
64 | struc MOS_WNDCOLORS |
||
65 | .frame: resd 1 |
||
66 | .grab: resd 1 |
||
67 | .grabButton: resd 1 |
||
68 | .grabButtonText: resd 1 |
||
69 | .grabText: resd 1 |
||
70 | .work: resd 1 |
||
71 | .workButton: resd 1 |
||
72 | .workButtonText: resd 1 |
||
73 | .workText: resd 1 |
||
74 | .workGraphics: resd 1 |
||
75 | endstruc |
||
76 | |||
77 | ; skinned window borders |
||
78 | MOS_WND_SKIN_BORDER_LEFT equ 5 |
||
79 | MOS_WND_SKIN_BORDER_RIGHT equ 5 |
||
80 | MOS_WND_SKIN_BORDER_BOTTOM equ 5 |
||
81 | |||
82 | |||
83 | ;********************************************************** |
||
84 | ; process info structure |
||
85 | ;********************************************************** |
||
86 | |||
87 | struc MOS_PROCESSINFO |
||
88 | .CPUUsage: resd 1 |
||
89 | .windowStackPos: resw 1 |
||
90 | .windowStackVal: resw 1 |
||
91 | .reserved1: resw 1 |
||
92 | .processName: resb 12 |
||
93 | .memStart: resd 1 |
||
94 | .memUsed: resd 1 |
||
95 | .pid: resd 1 |
||
96 | .wndXPos resd 1 |
||
97 | .wndYPos resd 1 |
||
98 | .wndWidth resd 1 |
||
99 | .wndHeight resd 1 |
||
100 | .reserved2: resb (1024 - 50) |
||
101 | endstruc |
||
102 | |||
103 | |||
104 | |||
105 | ;********************************************************** |
||
106 | ; system call numbers |
||
107 | ;********************************************************** |
||
108 | |||
109 | MOS_SC_EXIT equ -1 |
||
110 | MOS_SC_DEFINEWINDOW equ 0 |
||
111 | MOS_SC_PUTPIXEL equ 1 |
||
112 | MOS_SC_GETKEY equ 2 |
||
113 | MOS_SC_GETSYSCLOCK equ 3 |
||
114 | MOS_SC_WRITETEXT equ 4 |
||
115 | MOS_SC_DELAY equ 5 |
||
116 | MOS_SC_OPENFILEFLOPPY equ 6 ; obsolete |
||
117 | MOS_SC_PUTIMAGE equ 7 |
||
118 | MOS_SC_DEFINEBUTTON equ 8 |
||
119 | MOS_SC_GETPROCESSINFO equ 9 |
||
120 | MOS_SC_WAITEVENT equ 10 |
||
121 | MOS_SC_CHECKEVENT equ 11 |
||
122 | MOS_SC_REDRAWSTATUS equ 12 |
||
123 | MOS_SC_DRAWBAR equ 13 |
||
124 | MOS_SC_GETSCREENMAX equ 14 |
||
125 | MOS_SC_SETBACKGROUND equ 15 |
||
126 | MOS_SC_GETPRESSEDBUTTON equ 17 |
||
127 | MOS_SC_SYSTEMSERVICE equ 18 |
||
128 | MOS_SC_STARTPROGRAM equ 19 ; obsolete |
||
129 | MOS_SC_MIDIINTERFACE equ 20 |
||
130 | MOS_SC_DEVICESETUP equ 21 |
||
131 | MOS_SC_WAITEVENTTIMEOUT equ 23 |
||
132 | MOS_SC_CDAUDIO equ 24 |
||
133 | MOS_SC_SB16MIXER1 equ 25 |
||
134 | MOS_SC_GETDEVICESETUP equ 26 |
||
135 | MOS_SC_WSS equ 27 |
||
136 | MOS_SC_SB16MIXER2 equ 28 |
||
137 | MOS_SC_GETDATE equ 29 |
||
138 | MOS_SC_READHD equ 30 ; obsolete |
||
139 | MOS_SC_STARTPROGRAMHD equ 31 ; obsolete |
||
140 | MOS_SC_DELETEFILEFLOPPY equ 32 |
||
141 | MOS_SC_SAVEFILERAMDISK equ 33 ; obsolete |
||
142 | MOS_SC_READDIRRAMDISK equ 34 ; obsolete |
||
143 | MOS_SC_GETSCREENPIXEL equ 35 |
||
144 | MOS_SC_GETMOUSEPOSITION equ 37 |
||
145 | MOS_SC_DRAWLINE equ 38 |
||
146 | MOS_SC_GETBACKGROUND equ 39 |
||
147 | MOS_SC_SETEVENTMASK equ 40 |
||
148 | MOS_SC_GETIRQOWNER equ 41 |
||
149 | MOS_SC_GETDATAREADBYIRQ equ 42 |
||
150 | MOS_SC_SENDDATATODEVICE equ 43 |
||
151 | MOS_SC_PROGRAMIRQS equ 44 |
||
152 | MOS_SC_RESERVEFREEIRQ equ 45 |
||
153 | MOS_SC_RESERVEFREEPORTS equ 46 |
||
154 | MOS_SC_WRITENUMBER equ 47 |
||
155 | MOS_SC_WINDOWPROPERTIES equ 48 |
||
156 | MOS_SC_SHAPEDWINDOWS equ 50 |
||
157 | MOS_SC_CREATETHREAD equ 51 |
||
158 | MOS_SC_STACKDRIVERSTATE equ 52 |
||
159 | MOS_SC_SOCKETINTERFACE equ 53 |
||
160 | MOS_SC_SOUNDINTERFACE equ 55 |
||
161 | MOS_SC_WRITEFILEHD equ 56 ; obsolete |
||
162 | MOS_SC_DELETEFILEHD equ 57 |
||
163 | MOS_SC_SYSTREEACCESS equ 58 |
||
164 | MOS_SC_SYSCALLTRACE equ 59 |
||
165 | MOS_SC_IPC equ 60 |
||
166 | MOS_SC_DIRECTGRAPHICS equ 61 |
||
167 | MOS_SC_PCI equ 62 |
||
168 | MOS_SC_DEBUGBOARD equ 63 |
||
169 | |||
170 | |||
171 | ;********************************************************** |
||
172 | ; event numbers |
||
173 | ;********************************************************** |
||
174 | |||
175 | MOS_EVT_NONE equ 0 |
||
176 | MOS_EVT_REDRAW equ 1 |
||
177 | MOS_EVT_KEY equ 2 |
||
178 | MOS_EVT_BUTTON equ 3 |
||
179 | |||
180 | |||
181 | ;********************************************************** |
||
182 | ; event bits |
||
183 | ;********************************************************** |
||
184 | |||
185 | MOS_EVTBIT_REDRAW equ (1 << 0) |
||
186 | MOS_EVTBIT_KEY equ (1 << 1) |
||
187 | MOS_EVTBIT_BUTTON equ (1 << 2) |
||
188 | MOS_EVTBIT_ENDREQUEST equ (1 << 3) |
||
189 | MOS_EVTBIT_BGDRAW equ (1 << 4) |
||
190 | MOS_EVTBIT_MOUSECHANGE equ (1 << 5) |
||
191 | MOS_EVTBIT_IPCEVENT equ (1 << 6) |
||
192 | MOS_EVTBIT_IRQ0 equ (1 << 16) |
||
193 | MOS_EVTBIT_IRQ1 equ (1 << 17) |
||
194 | MOS_EVTBIT_IRQ2 equ (1 << 18) |
||
195 | MOS_EVTBIT_IRQ3 equ (1 << 19) |
||
196 | MOS_EVTBIT_IRQ4 equ (1 << 20) |
||
197 | MOS_EVTBIT_IRQ5 equ (1 << 21) |
||
198 | MOS_EVTBIT_IRQ6 equ (1 << 22) |
||
199 | MOS_EVTBIT_IRQ7 equ (1 << 23) |
||
200 | MOS_EVTBIT_IRQ8 equ (1 << 24) |
||
201 | MOS_EVTBIT_IRQ9 equ (1 << 25) |
||
202 | MOS_EVTBIT_IRQ10 equ (1 << 26) |
||
203 | MOS_EVTBIT_IRQ11 equ (1 << 27) |
||
204 | MOS_EVTBIT_IRQ12 equ (1 << 28) |
||
205 | MOS_EVTBIT_IRQ13 equ (1 << 29) |
||
206 | MOS_EVTBIT_IRQ14 equ (1 << 30) |
||
207 | MOS_EVTBIT_IRQ15 equ (1 << 31) |
||
208 | |||
209 | |||
210 | ;********************************************************** |
||
211 | ; exit application (syscall -1) |
||
212 | ;********************************************************** |
||
213 | |||
214 | ; exit application |
||
215 | %macro MOS_EXIT 0 |
||
216 | mov eax,MOS_SC_EXIT |
||
217 | int 0x40 |
||
218 | %endmacro |
||
219 | |||
220 | ; exit application, smaller version |
||
221 | %macro MOS_EXIT_S 0 |
||
222 | xor eax,eax |
||
223 | dec eax |
||
224 | int 0x40 |
||
225 | %endmacro |
||
226 | |||
227 | |||
228 | ;********************************************************** |
||
229 | ; wait event stuff |
||
230 | ; (MOS_SC_WAITEVENT, syscall 10) |
||
231 | ;********************************************************** |
||
232 | |||
233 | ; wait for event |
||
234 | ; destroys : nothing |
||
235 | ; returns : eax = event type |
||
236 | %macro MOS_WAITEVENT 0 |
||
237 | mov eax,MOS_SC_WAITEVENT |
||
238 | int 0x40 |
||
239 | %endmacro |
||
240 | |||
241 | ; wait for event, smaller version |
||
242 | ; destroys : flags |
||
243 | ; returns : eax = event type |
||
244 | %macro MOS_WAITEVENT_S 0 |
||
245 | xor eax,eax |
||
246 | mov al,MOS_SC_WAITEVENT |
||
247 | int 0x40 |
||
248 | %endmacro |
||
249 | |||
250 | |||
251 | ;********************************************************** |
||
252 | ; window redraw status stuff |
||
253 | ; (MOS_SC_REDRAWSTATUS, syscall 12) |
||
254 | ;********************************************************** |
||
255 | |||
256 | MOS_RS_STARTREDRAW equ 1 |
||
257 | MOS_RS_ENDREDRAW equ 2 |
||
258 | |||
259 | ; start window redraw |
||
260 | ; destroys: eax,ebx |
||
261 | %macro MOS_STARTREDRAW 0 |
||
262 | mov ebx,MOS_RS_STARTREDRAW |
||
263 | mov eax,MOS_SC_REDRAWSTATUS |
||
264 | int 0x40 |
||
265 | %endmacro |
||
266 | |||
267 | ; start window redraw, smaller version |
||
268 | ; destroys: eax,ebx,flags |
||
269 | %macro MOS_STARTREDRAW_S 0 |
||
270 | xor ebx,ebx |
||
271 | inc ebx |
||
272 | xor eax,eax |
||
273 | mov al,MOS_SC_REDRAWSTATUS |
||
274 | int 0x40 |
||
275 | %endmacro |
||
276 | |||
277 | ; end window redraw |
||
278 | ; destroys: eax,ebx |
||
279 | %macro MOS_ENDREDRAW 0 |
||
280 | mov ebx,MOS_RS_ENDREDRAW |
||
281 | mov eax,MOS_SC_REDRAWSTATUS |
||
282 | int 0x40 |
||
283 | %endmacro |
||
284 | |||
285 | ; end window redraw, smaller version |
||
286 | ; destroys: eax,ebx,flags |
||
287 | %macro MOS_ENDREDRAW_S 0 |
||
288 | xor ebx,ebx |
||
289 | mov bl,MOS_RS_ENDREDRAW |
||
290 | xor eax,eax |
||
291 | mov al,MOS_SC_REDRAWSTATUS |
||
292 | int 0x40 |
||
293 | %endmacro |
||
294 | |||
295 | |||
296 | ;********************************************************** |
||
297 | ; get screen max stuff (syscall 14) |
||
298 | ;********************************************************** |
||
299 | |||
300 | ; get screen dimensions in eax |
||
301 | ; destroys: nothing |
||
302 | %macro MOS_GETSCREENMAX 0 |
||
303 | mov eax,MOS_SC_GETSCREENMAX |
||
304 | int 0x40 |
||
305 | %endmacro |
||
306 | |||
307 | ; get screen dimensions in eax, smaller version |
||
308 | ; destroys: flags |
||
309 | %macro MOS_GETSCREENMAX_S 0 |
||
310 | xor eax,eax |
||
311 | mov al,MOS_SC_GETSCREENMAX |
||
312 | int 0x40 |
||
313 | %endmacro |
||
314 | |||
315 | |||
316 | ;******************************************************************** |
||
317 | ; opcode hacks |
||
318 | ;******************************************************************** |
||
319 | |||
320 | ; nasm refuses to assemble stuff like |
||
321 | ; push dword 4.44 |
||
322 | ; with the following macro this becomes possible: |
||
323 | ; fpush32 9.81 |
||
324 | ; don't forget to use a decimal point. things like |
||
325 | ; fpush32 1 |
||
326 | ; will probably not do what you expect. instead, write: |
||
327 | ; fpush32 1.0 |
||
328 | %macro fpush32 1 |
||
329 | db 0x68 ; push imm32 |
||
330 | dd %1 |
||
331 | %endm |
||
332 | |||
333 | %endif><>><>><>><>><>><>><>><>><>><>><>><>><>><>><>><>><>><>><>><>><>><>><>><>><>><> |
||
334 |