Subversion Repositories Kolibri OS

Rev

Rev 485 | Only display areas with differences | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 485 Rev 551
1
;
1
;
2
;   TIMER (show how much system works)
2
;   TIMER (show how much system works)
3
;
3
;
4
;   Compile with flat assembler
4
;   Compile with flat assembler
5
;
5
;
6
 
6
 
7
use32
7
use32
8
 
8
 
9
    org    0x0
9
    org    0x0
10
 
10
 
11
    db     'MENUET01'       ; 8 byte id
11
    db     'MENUET01'       ; 8 byte id
12
    dd     0x01             ; header version
12
    dd     0x01             ; header version
13
    dd     START            ; start of code
13
    dd     START            ; start of code
14
    dd     I_END            ; size of image
14
    dd     I_END            ; size of image
15
    dd     0x1000           ; memory for app
15
    dd     0x1000           ; memory for app
16
    dd     0x1000           ; esp
16
    dd     0x1000           ; esp
17
    dd     0x0 , 0x0        ; I_Param , I_Icon
17
    dd     0x0 , 0x0        ; I_Param , I_Icon
18
 
18
 
19
include 'lang.inc'
19
include 'lang.inc'
20
include '..\..\..\macros.inc'
20
include '..\..\..\macros.inc'
21
 
21
 
22
START:                      ; start of execution
22
START:                      ; start of execution
23
    mov  eax, 40
23
    mov  eax, 40
24
    mov  ebx, 101b
24
    mov  ebx, 101b
25
    mcall
25
    mcall
26
 
26
 
27
red:
27
red:
28
    call draw_window
28
    call draw_window
29
 
29
 
30
still:
30
still:
31
 
31
 
32
    mov  eax,23                 ; wait here for event
32
    mov  eax,23                 ; wait here for event
33
    mov  ebx,50
33
    mov  ebx,50
34
    mcall
34
    mcall
35
 
35
 
36
    cmp  eax,1                  ; redraw request ?
36
    cmp  eax,1                  ; redraw request ?
37
    je   red
37
    je   red
38
    cmp  eax,3                  ; button in buffer ?
38
    cmp  eax,3                  ; button in buffer ?
39
    je   button
39
    je   button
40
 
40
 
41
    call draw_clock
41
    call draw_clock
42
 
42
 
43
    jmp  still
43
    jmp  still
44
 
44
 
45
 
45
 
46
  button:                       ; button
46
  button:                       ; button
47
    or   eax,-1                 ; close this program
47
    or   eax,-1                 ; close this program
48
    mcall
48
    mcall
49
 
49
 
50
 
50
 
51
;   *********************************************
51
;   *********************************************
52
;   *******  WINDOW DEFINITIONS AND DRAW ********
52
;   *******  WINDOW DEFINITIONS AND DRAW ********
53
;   *********************************************
53
;   *********************************************
54
 
54
 
55
draw_clock:
55
draw_clock:
56
 
56
 
57
    mov  eax, 26           ; get system counter
57
    mov  eax, 26           ; get system counter
58
    mov  ebx, 9
58
    mov  ebx, 9
59
    mcall
59
    mcall
60
 
60
 
61
    cdq ;xor  edx,edx
61
    cdq ;xor  edx,edx
62
    mov  ebx,100
62
    mov  ebx,100
63
    div  ebx
63
    div  ebx
64
 
64
 
65
  push eax
65
  push eax
66
 
66
 
67
  xor  edx,edx
67
  xor  edx,edx
68
  mov  ebx,60
68
  mov  ebx,60
69
  div  ebx
69
  div  ebx
70
  mov  ecx,eax
70
  mov  ecx,eax
71
 
71
 
72
  push ecx
72
  push ecx
73
  push ecx
73
  push ecx
74
 
74
 
75
  xor  edx,edx
75
  xor  edx,edx
76
  mov  ebx,60
76
  mov  ebx,60
77
  div  ebx
77
  div  ebx
78
  mov  ecx,eax
78
  mov  ecx,eax
79
 
79
 
80
  mov  eax,47           ; HH
80
  mov  eax,47           ; HH
81
  mov  esi,[sc.work_text]
81
  mov  esi,[sc.work_text]
82
  or   esi,0x50000000
82
  or   esi,0x50000000
83
  mov  edi,[sc.work]
83
  mov  edi,[sc.work]
84
  mov  ebx,0x00020000
84
  mov  ebx,0x00020000
85
  mov  edx,15*65536+5
85
  mov  edx,15*65536+5
86
  mcall
86
  mcall
87
 
87
 
88
  pop  eax              ; MM
88
  pop  eax              ; MM
89
  imul ecx,ecx,60
89
  imul ecx,ecx,60
90
  sub  eax,ecx
90
  sub  eax,ecx
91
  mov  ecx,eax
91
  mov  ecx,eax
92
  mov  eax,47
92
  mov  eax,47
93
  add  edx,20*65536
93
  add  edx,20*65536
94
  mcall
94
  mcall
95
 
95
 
96
  pop  ecx
96
  pop  ecx
97
  pop  eax
97
  pop  eax
98
 
98
 
99
  imul ecx,ecx,60
99
  imul ecx,ecx,60
100
  sub  eax,ecx
100
  sub  eax,ecx
101
 
101
 
102
  mov  ecx,eax          ; SS
102
  mov  ecx,eax          ; SS
103
  mov  eax,47
103
  mov  eax,47
104
  add  edx,20*65536
104
  add  edx,20*65536
105
  mcall
105
  mcall
106
 
106
 
107
  ret
107
  ret
108
 
108
 
109
draw_window:
109
draw_window:
110
    mov  eax,48
110
    mov  eax,48
111
    mov  ebx,3
111
    mov  ebx,3
112
    mov  ecx,sc
112
    mov  ecx,sc
113
    mov  edx,sizeof.system_colors
113
    mov  edx,sizeof.system_colors
114
    mcall
114
    mcall
115
 
115
 
116
    mov  eax,12                    ; function 12:tell os about windowdraw
116
    mov  eax,12                    ; function 12:tell os about windowdraw
117
    mov  ebx,1                     ; 1, start of draw
117
    mov  ebx,1                     ; 1, start of draw
118
    mcall
118
    mcall
119
 
119
 
120
                                   ; DRAW WINDOW
120
                                   ; DRAW WINDOW
121
    xor  eax,eax                   ; function 0 : define and draw window
121
    xor  eax,eax                   ; function 0 : define and draw window
122
    mov  ebx,100*65536+100         ; [x start] *65536 + [x size]
122
    mov  ebx,100*65536+100         ; [x start] *65536 + [x size]
123
    mov  ecx,100*65536+40          ; [y start] *65536 + [y size]
123
    mov  ecx,100*65536+40          ; [y start] *65536 + [y size]
124
    mov  edx,[sc.work]             ; color of work area RRGGBB,8->color gl
124
    mov  edx,[sc.work]             ; color of work area RRGGBB,8->color gl
125
    or   edx,0x33000000
125
    or   edx,0x34000000
126
    mov  edi,title
126
    mov  edi,title
127
    mcall
127
    mcall
128
 
128
 
129
    call draw_clock
129
    call draw_clock
130
 
130
 
131
    mov  eax,12                    ; function 12:tell os about windowdraw
131
    mov  eax,12                    ; function 12:tell os about windowdraw
132
    mov  ebx,2                     ; 2, end of draw
132
    mov  ebx,2                     ; 2, end of draw
133
    mcall
133
    mcall
134
 
134
 
135
    ret
135
    ret
136
 
136
 
137
 
137
 
138
; DATA AREA
138
; DATA AREA
139
 
139
 
140
if lang eq ru
140
if lang eq ru
141
    title   db   '’€‰Œ…',0
141
    title   db   '’€‰Œ…',0
142
else
142
else
143
    title   db   'TIMER',0
143
    title   db   'TIMER',0
144
end if
144
end if
145
 
145
 
146
 
146
 
147
I_END:
147
I_END:
148
 
148
 
149
temp dd ?
149
temp dd ?
150
sc system_colors
150
sc system_colors