Subversion Repositories Kolibri OS

Rev

Rev 109 | Rev 485 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

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