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
;
2
;   SYSTEM CALL TRACE , V.Turjanmaa
3
;
4
;   Compile with FASM for Menuet
5
;
6
 
7
use32
8
 
9
               org    0x0
10
 
11
               db     'MENUET01'              ; 8 byte id
12
               dd     0x01                    ; header version
13
               dd     START                   ; start of code
14
               dd     I_END                   ; size of image
15
               dd     0x1000                  ; memory for app
16
               dd     0x1000                  ; esp
17
               dd     0x0 , 0x0               ; I_Param , I_Icon
18
 
19
include 'lang.inc'
20
include 'macros.inc'
21
 
22
START:                          ; start of execution
23
 
24
    call draw_window            ; at first, draw the window
25
 
26
still:
27
 
28
    mov  eax,23                 ; wait here for event
29
    mov  ebx,50
30
    int  0x40
31
 
32
    call display_calls
33
 
34
    cmp  eax,1                  ; redraw request ?
35
    je   red
36
    cmp  eax,2                  ; key in buffer ?
37
    je   key
38
    cmp  eax,3                  ; button in buffer ?
39
    je   button
40
 
41
    jmp  still
42
 
43
  red:                          ; redraw
44
    call draw_window
45
    jmp  still
46
 
47
  key:                          ; key
48
    mov  eax,2                  ; just read it and ignore
49
    int  0x40
50
    jmp  still
51
 
52
  button:                       ; button
53
    mov  eax,17                 ; get id
54
    int  0x40
55
 
56
    cmp  ah,1                   ; button id=1 ?
57
    jne  noclose
58
    mov  eax,-1                 ; close this program
59
    int  0x40
60
  noclose:
61
 
62
    jmp  still
63
 
64
 
65
;   *********************************************
66
;   *******  WINDOW DEFINITIONS AND DRAW ********
67
;   *********************************************
68
 
69
 
70
draw_window:
71
 
72
    mov  eax,12                    ; function 12:tell os about windowdraw
73
    mov  ebx,1                     ; 1, start of draw
74
    int  0x40
75
 
76
                                   ; DRAW WINDOW
77
    mov  eax,0                     ; function 0 : define and draw window
78
    mov  ebx,100*65536+465          ; [x start] *65536 + [x size]
79
    mov  ecx,50*65536+265          ; [y start] *65536 + [y size]
80
    mov  edx,0x03ffffff            ; color of work area RRGGBB,8->color gl
81
    mov  esi,0x808899ff            ; color of grab bar  RRGGBB,8->color gl
82
    mov  edi,0x008899ff            ; color of frames    RRGGBB
83
    int  0x40
84
 
85
                                   ; WINDOW LABEL
86
    mov  eax,4                     ; function 4 : write text to window
87
    mov  ebx,8*65536+8             ; [x start] *65536 + [y start]
88
    mov  ecx,0x00ddeeff            ; color of text RRGGBB
89
    mov  edx,labelt                ; pointer to text beginning
90
    mov  esi,labellen-labelt       ; text length
91
    int  0x40
92
 
93
    mov  eax,4
94
    mov  ebx,15*65536+55
95
    mov  ecx,0x0
96
    mov  edx,text
97
    mov  esi,70
98
    int  0x40
99
 
100
                                   ; CLOSE BUTTON
101
    mov  eax,8                     ; function 8 : define and draw button
102
    mov  ebx,(465-19)*65536+12     ; [x start] *65536 + [x size]
103
    mov  ecx,5*65536+12            ; [y start] *65536 + [y size]
104
    mov  edx,1                     ; button id
105
    mov  esi,0x6677cc              ; button color RRGGBB
106
;    int  0x40
107
 
108
    call display_calls
109
 
110
    mov  eax,12
111
    mov  ebx,2
112
    int  0x40
113
 
114
    ret
115
 
116
 
117
 
118
display_calls:
119
 
120
 
121
    pusha
122
 
123
    mov  eax,13
124
    mov  ebx,15*65536+70
125
    mov  ecx,35*65536+10
126
    mov  edx,0xffffff
127
    int  0x40
128
 
129
    mov  eax,59
130
    mov  ebx,0
131
    mov  ecx,I_END
132
    mov  edx,64*16
133
    int  0x40
134
 
135
    mov  ecx,eax
136
    mov  eax,47
137
    mov  ebx,10*65536
138
    mov  edx,15*65536+35
139
    mov  esi,0
140
    int  0x40
141
 
142
 
143
    mov  ebx,75
144
    mov  edx,I_END
145
  newline:
146
 
147
    push ebx
148
    push edx
149
 
150
    mov  edi,0
151
 
152
  new_x:
153
 
154
    mov  eax,13
155
    mov  ebx,edi
156
    shl  ebx,6+16
157
    add  ebx,15*65536
158
    mov  bx,6*8
159
    mov  ecx,[esp+4]
160
    shl  ecx,16
161
    mov  cx,10
162
    mov  edx,0xffffff
163
    int  0x40
164
 
165
    mov  eax,47
166
    mov  ebx,1+1*256+8*65536
167
 
168
    mov  ecx,[pos+edi*4]
169
    shl  ecx,2
170
    add  ecx,[esp+0]
171
 
172
    mov  edx,edi
173
    shl  edx,6+16
174
    mov  dx,[esp+4]
175
    or   edx,15*65536
176
    mov  esi,0x0
177
    int  0x40
178
 
179
    inc  edi
180
 
181
    cmp  edi,7
182
    jb   new_x
183
 
184
    pop  edx
185
    pop  ebx
186
 
187
    add  ebx,10
188
    add  edx,64
189
 
190
    cmp  edx,I_END+16*64
191
    jb   newline
192
 
193
    popa
194
    ret
195
 
196
 
197
 
198
 
199
; DATA AREA
200
 
201
pos dd 0,15,12,14,13,9,8
202
 
203
text:
204
  db '  PID        EAX        EBX       ECX        EDX        ESI       EDI '
205
 
206
 
207
labelt:
208
      db   'SYSTEM CALL TRACE'
209
labellen:
210
 
211
I_END: