Go to most recent revision | Details | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
1806 | yogev_ezra | 1 | ; new application structure |
2 | macro meos_app_start |
||
3 | { |
||
4 | use32 |
||
5 | org 0x0 |
||
6 | |||
7 | db 'MENUET01' |
||
8 | dd 0x01 |
||
9 | dd __start |
||
10 | dd __end |
||
11 | dd __memory |
||
12 | dd __stack |
||
13 | |||
14 | if used __params & ~defined __params |
||
15 | dd __params |
||
16 | else |
||
17 | dd 0x0 |
||
18 | end if |
||
19 | |||
20 | dd 0x0 |
||
21 | } |
||
22 | MEOS_APP_START fix meos_app_start |
||
23 | |||
24 | macro code |
||
25 | { |
||
26 | __start: |
||
27 | } |
||
28 | CODE fix code |
||
29 | |||
30 | macro data |
||
31 | { |
||
32 | __data: |
||
33 | } |
||
34 | DATA fix data |
||
35 | |||
36 | macro udata |
||
37 | { |
||
38 | if used __params & ~defined __params |
||
39 | __params: |
||
40 | db 0 |
||
41 | __end: |
||
42 | rb 255 |
||
43 | else |
||
44 | __end: |
||
45 | end if |
||
46 | __udata: |
||
47 | } |
||
48 | UDATA fix udata |
||
49 | |||
50 | macro meos_app_end |
||
51 | { |
||
52 | align 32 |
||
53 | rb 2048 |
||
54 | __stack: |
||
55 | __memory: |
||
56 | } |
||
57 | MEOS_APP_END fix meos_app_end |
||
58 | |||
59 | |||
60 | |||
61 | ; language for programs |
||
62 | lang fix ru ; ru en fr ge fi |
||
63 | ;lang equ ru |
||
64 | |||
65 | |||
66 | ; optimize the code for size |
||
67 | macro add arg1,arg2 |
||
68 | { |
||
69 | if arg1 in |
||
70 | if arg2 eqtype 0 |
||
71 | if arg2 = 1 |
||
72 | inc arg1 |
||
73 | else |
||
74 | add arg1,arg2 |
||
75 | end if |
||
76 | else |
||
77 | add arg1,arg2 |
||
78 | end if |
||
79 | else |
||
80 | add arg1,arg2 |
||
81 | end if |
||
82 | } |
||
83 | |||
84 | macro sub arg1,arg2 |
||
85 | { |
||
86 | if arg2 eqtype 0 |
||
87 | if arg2 = 1 |
||
88 | dec arg1 |
||
89 | else |
||
90 | sub arg1,arg2 |
||
91 | end if |
||
92 | else |
||
93 | sub arg1,arg2 |
||
94 | end if |
||
95 | } |
||
96 | |||
97 | macro mov arg1,arg2 |
||
98 | { |
||
99 | if arg1 in |
||
100 | if arg2 eqtype 0 |
||
101 | if arg2 = 0 |
||
102 | xor arg1,arg1 |
||
103 | else if arg2 = 1 |
||
104 | xor arg1,arg1 |
||
105 | inc arg1 |
||
106 | else if arg2 = -1 |
||
107 | or arg1,-1 |
||
108 | else if arg2 > -128 & arg2 < 128 |
||
109 | push arg2 |
||
110 | pop arg1 |
||
111 | else |
||
112 | mov arg1,arg2 |
||
113 | end if |
||
114 | else |
||
115 | mov arg1,arg2 |
||
116 | end if |
||
117 | else |
||
118 | mov arg1,arg2 |
||
119 | end if |
||
120 | } |
||
121 | |||
122 | |||
123 | macro struct name |
||
124 | { |
||
125 | virtual at 0 |
||
126 | name name |
||
127 | sizeof.#name = $ - name |
||
128 | end virtual |
||
129 | } |
||
130 | |||
131 | ; structures used in MeOS |
||
132 | struc process_information |
||
133 | { |
||
134 | .cpu_usage dd ? ; +0 |
||
135 | .window_stack_position dw ? ; +4 |
||
136 | .window_stack_value dw ? ; +6 |
||
137 | .not_used1 dw ? ; +8 |
||
138 | .process_name rb 12 ; +10 |
||
139 | .memory_start dd ? ; +22 |
||
140 | .used_memory dd ? ; +26 |
||
141 | .PID dd ? ; +30 |
||
142 | .x_start dd ? ; +34 |
||
143 | .y_start dd ? ; +38 |
||
144 | .x_size dd ? ; +42 |
||
145 | .y_size dd ? ; +46 |
||
146 | .slot_state dw ? ; +50 |
||
147 | rb (1024-52) |
||
148 | } |
||
149 | struct process_information |
||
150 | |||
151 | struc system_colors |
||
152 | { |
||
153 | .frame dd ? |
||
154 | .grab dd ? |
||
155 | .grab_button dd ? |
||
156 | .grab_button_text dd ? |
||
157 | .grab_text dd ? |
||
158 | .work dd ? |
||
159 | .work_button dd ? |
||
160 | .work_button_text dd ? |
||
161 | .work_text dd ? |
||
162 | .work_graph dd ? |
||
163 | } |
||
164 | struct system_colors |
||
165 | |||
166 | |||
167 | ; constants |
||
168 | |||
169 | ; events |
||
170 | EV_IDLE = 0 |
||
171 | EV_TIMER = 0 |
||
172 | EV_REDRAW = 1 |
||
173 | EV_KEY = 2 |
||
174 | EV_BUTTON = 3 |
||
175 | EV_EXIT = 4 |
||
176 | EV_BACKGROUND = 5 |
||
177 | EV_MOUSE = 6 |
||
178 | EV_IPC = 7 |
||
179 | EV_STACK = 8 |
||
180 | |||
181 | ; event mask bits for function 40 |
||
182 | EVM_REDRAW = 1b |
||
183 | EVM_KEY = 10b |
||
184 | EVM_BUTTON = 100b |
||
185 | EVM_EXIT = 1000b |
||
186 | EVM_BACKGROUND = 10000b |
||
187 | EVM_MOUSE = 100000b |
||
188 | EVM_IPC = 1000000b |
||
189 | EVM_STACK = 10000000b> |