Subversion Repositories Kolibri OS

Rev

Go to most recent revision | Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
31 halyavin 1
; mos.inc 0.0.2
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
;
20
;
21
; revision history
22
; ----------------
23
;
24
; 10-04-2002	version 0.0.2
25
;		- removed MOS_WNDCOLORS_SIZE and similar constants.
26
;		  while reading the docs i realized that NASM creates
27
;		  such symbols already itself...
28
;		+ macros: MOS_WAITEVENT, MOS_WAITEVENT_S, MOS_STARTREDRAW,
29
;		  MOS_STARTREDRAW_S, MOS_ENDREDRAW, MOS_ENDREDRAW_S,
30
;		  MOS_GETSCREENMAX, MOS_GETSCREENMAX_S, MOS_EXIT, MOS_EXIT_S
31
;		+ event bit masks
32
;		+ some syscall numbers
33
;		+ process info structure
34
;
35
; 08-??-2002	version 0.0.1
36
;		first release
37
;
38
%ifndef _MOS_INC
39
%define _MOS_INC
40
 
41
 
42
 
43
;**********************************************************
44
; generates a menuetos 01 header
45
; takes 2-6 parameters:
46
;
47
; MOS_HEADER01 start,end[,appmem,esp,i_param,i_icon]
48
;**********************************************************
49
 
50
%macro MOS_HEADER01 2-6 0x100000,0x7fff0,0,0
51
	org	0x0
52
	db	'MENUET01'		; 8 byte id
53
	dd	0x01			; header version
54
	dd	%1			; start of code
55
	dd	%2			; image size
56
	dd	%3			; application memory
57
	dd	%4			; esp
58
	dd	%5			; i_param
59
	dd	%6			; i_icon
60
%endmacro
61
 
62
 
63
;**********************************************************
64
; MOS_DWORD
65
; packs 2 words into a double word
66
;**********************************************************
67
 
68
%define MOS_DWORD(hi,lo) ((((hi) & 0xffff) << 16) + ((lo) & 0xffff))
69
 
70
 
71
;**********************************************************
72
; MOS_RGB
73
; creates a menuet os compatible color (0x00RRGGBB)
74
;**********************************************************
75
 
76
%define MOS_RGB(r,g,b) ((((r) & 255) << 16) + (((g) & 255) << 8) + ((b) & 255))
77
 
78
 
79
;**********************************************************
80
; window color structure
81
;**********************************************************
82
 
83
struc MOS_WNDCOLORS
84
	.frame:			resd	1
85
	.grab:			resd	1
86
	.grabButton:		resd	1
87
	.grabButtonText:	resd	1
88
	.grabText:		resd	1
89
	.work:			resd	1
90
	.workButton:		resd	1
91
	.workButtonText:	resd	1
92
	.workText:		resd	1
93
	.workGraphics:		resd	1
94
endstruc
95
 
96
 
97
;**********************************************************
98
; process info structure
99
;**********************************************************
100
 
101
struc MOS_PROCESSINFO
102
	.CPUUsage: 		resd	1	; cpu usage
103
	.windowStackPos:	resw	1	; process' position in windowing stack
104
	.windowStackVal:	resw	1	; window stack value at ecx
105
	.reserved1:		resw	1
106
	.processName:		resb	12	; process name
107
	.memStart:		resd	1	; start of process memory
108
	.memUsed:		resd	1	; memory used by the process
109
	.pid:			resd	1	; process id
110
	.reserved2:		resb	(1024-34)
111
endstruc
112
 
113
 
114
 
115
;**********************************************************
116
; system call numbers
117
;**********************************************************
118
 
119
MOS_SC_EXIT		equ	-1
120
MOS_SC_DEFINEWINDOW	equ	0
121
MOS_SC_PUTPIXEL		equ	1
122
MOS_SC_GETKEY		equ	2
123
MOS_SC_GETSYSCLOCK	equ	3
124
MOS_SC_WRITETEXT	equ	4
125
MOS_SC_DELAY		equ	5
126
MOS_SC_OPENFILEFLOPPY	equ	6
127
MOS_SC_PUTIMAGE		equ	7
128
MOS_SC_DEFINEBUTTON	equ	8
129
MOS_SC_GETPROCESSINFO	equ	9
130
MOS_SC_WAITEVENT	equ	10
131
MOS_SC_CHECKEVENT	equ	11
132
MOS_SC_REDRAWSTATUS	equ	12
133
MOS_SC_DRAWBAR		equ	13
134
MOS_SC_GETSCREENMAX	equ	14
135
MOS_SC_SETBACKGROUND	equ	15
136
MOS_SC_GETPRESSEDBUTTON	equ	17
137
MOS_SC_SYSTEMSERVICE	equ	18
138
MOS_SC_STARTPROGRAM	equ	19
139
MOS_SC_MIDIINTERFACE	equ	20
140
MOS_SC_DEVICESETUP	equ	21
141
MOS_SC_WAITEVENTTIMEOUT	equ	23
142
MOS_SC_CDAUDIO		equ	24
143
MOS_SC_SB16MIXER1	equ	25
144
MOS_SC_GETDEVICESETUP	equ	26
145
MOS_SC_WSS		equ	27
146
MOS_SC_SB16MIXER2	equ	28
147
MOS_SC_GETDATE		equ	29
148
MOS_SC_READHD		equ	30
149
MOS_SC_STARTPROGRAMHD	equ	31
150
MOS_SC_GETSCREENPIXEL	equ	35
151
MOS_SC_GETMOUSEPOSITION	equ	37
152
MOS_SC_DRAWLINE		equ	38
153
MOS_SC_GETBACKGROUND	equ	39
154
MOS_SC_SETEVENTMASK	equ	40
155
MOS_SC_WRITENUMBER	equ	47
156
MOS_SC_WINDOWPROPERTIES	equ	48
157
 
158
 
159
;**********************************************************
160
; event numbers
161
;**********************************************************
162
 
163
MOS_EVT_NONE		equ	0
164
MOS_EVT_REDRAW		equ	1
165
MOS_EVT_KEY		equ	2
166
MOS_EVT_BUTTON		equ	3
167
 
168
 
169
;**********************************************************
170
; event bits
171
;**********************************************************
172
 
173
MOS_EVTBIT_REDRAW	equ	(1 <<  0)
174
MOS_EVTBIT_KEY		equ	(1 <<  1)
175
MOS_EVTBIT_BUTTON	equ	(1 <<  2)
176
MOS_EVTBIT_ENDREQUEST	equ	(1 <<  3)
177
MOS_EVTBIT_BGDRAW	equ	(1 <<  4)
178
MOS_EVTBIT_MOUSECHANGE	equ	(1 <<  5)
179
MOS_EVTBIT_IPCEVENT	equ	(1 <<  6)
180
MOS_EVTBIT_IRQ0		equ	(1 << 16)
181
MOS_EVTBIT_IRQ1		equ	(1 << 17)
182
MOS_EVTBIT_IRQ2		equ	(1 << 18)
183
MOS_EVTBIT_IRQ3		equ	(1 << 19)
184
MOS_EVTBIT_IRQ4		equ	(1 << 20)
185
MOS_EVTBIT_IRQ5		equ	(1 << 21)
186
MOS_EVTBIT_IRQ6		equ	(1 << 22)
187
MOS_EVTBIT_IRQ7		equ	(1 << 23)
188
MOS_EVTBIT_IRQ8		equ	(1 << 24)
189
MOS_EVTBIT_IRQ9		equ	(1 << 25)
190
MOS_EVTBIT_IRQ10	equ	(1 << 26)
191
MOS_EVTBIT_IRQ11	equ	(1 << 27)
192
MOS_EVTBIT_IRQ12	equ	(1 << 28)
193
MOS_EVTBIT_IRQ13	equ	(1 << 29)
194
MOS_EVTBIT_IRQ14	equ	(1 << 30)
195
MOS_EVTBIT_IRQ15	equ	(1 << 31)
196
 
197
 
198
;**********************************************************
199
; exit application (syscall -1)
200
;**********************************************************
201
 
202
; exit application
203
%macro MOS_EXIT 0
204
	mov eax,MOS_SC_EXIT
205
	int 0x40
206
%endmacro
207
 
208
; exit application, smaller version
209
%macro MOS_EXIT_S 0
210
	xor eax,eax
211
	dec eax
212
	int 0x40
213
%endmacro
214
 
215
 
216
;**********************************************************
217
; wait event stuff
218
; (MOS_SC_WAITEVENT, syscall 10)
219
;**********************************************************
220
 
221
; wait for event
222
; destroys	:	nothing
223
; returns	:	eax = event type
224
%macro MOS_WAITEVENT 0
225
	mov eax,MOS_SC_WAITEVENT
226
	int 0x40
227
%endmacro
228
 
229
; wait for event, smaller version
230
; destroys	:	flags
231
; returns	:	eax = event type
232
%macro MOS_WAITEVENT_S 0
233
	xor eax,eax
234
	mov al,MOS_SC_WAITEVENT
235
	int 0x40
236
%endmacro
237
 
238
 
239
;**********************************************************
240
; window redraw status stuff
241
; (MOS_SC_REDRAWSTATUS, syscall 12)
242
;**********************************************************
243
 
244
MOS_RS_STARTREDRAW	equ	1
245
MOS_RS_ENDREDRAW	equ	2
246
 
247
; start window redraw
248
; destroys: eax,ebx
249
%macro MOS_STARTREDRAW 0
250
	mov ebx,MOS_RS_STARTREDRAW
251
	mov eax,MOS_SC_REDRAWSTATUS
252
	int 0x40
253
%endmacro
254
 
255
; start window redraw, smaller version
256
; destroys: eax,ebx,flags
257
%macro MOS_STARTREDRAW_S 0
258
	xor ebx,ebx
259
	inc ebx
260
	xor eax,eax
261
	mov al,MOS_SC_REDRAWSTATUS
262
	int 0x40
263
%endmacro
264
 
265
; end window redraw
266
; destroys: eax,ebx
267
%macro MOS_ENDREDRAW 0
268
	mov ebx,MOS_RS_ENDREDRAW
269
	mov eax,MOS_SC_REDRAWSTATUS
270
	int 0x40
271
%endmacro
272
 
273
; end window redraw, smaller version
274
; destroys: eax,ebx,flags
275
%macro MOS_ENDREDRAW_S 0
276
	xor ebx,ebx
277
	mov bl,MOS_RS_ENDREDRAW
278
	xor eax,eax
279
	mov al,MOS_SC_REDRAWSTATUS
280
	int 0x40
281
%endmacro
282
 
283
 
284
;**********************************************************
285
; get screen max stuff (syscall 14)
286
;**********************************************************
287
 
288
; get screen dimensions in eax
289
; destroys: nothing
290
%macro MOS_GETSCREENMAX 0
291
	mov eax,MOS_SC_GETSCREENMAX
292
	int 0x40
293
%endmacro
294
 
295
; get screen dimensions in eax, smaller version
296
; destroys: flags
297
%macro MOS_GETSCREENMAX_S 0
298
	xor eax,eax
299
	mov al,MOS_SC_GETSCREENMAX
300
	int 0x40
301
%endmacro
302
 
303
 
304
 
305
%endif