Subversion Repositories Kolibri OS

Rev

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'
485 heavyiron 20
include '..\..\..\macros.inc'
31 halyavin 21
 
22
START:                      ; start of execution
23
    mov  eax, 40
24
    mov  ebx, 101b
485 heavyiron 25
    mcall
31 halyavin 26
 
27
red:
28
    call draw_window
29
 
30
still:
31
 
32
    mov  eax,23                 ; wait here for event
33
    mov  ebx,50
485 heavyiron 34
    mcall
31 halyavin 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
485 heavyiron 48
    mcall
31 halyavin 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
485 heavyiron 59
    mcall
31 halyavin 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
485 heavyiron 86
  mcall
31 halyavin 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
485 heavyiron 94
  mcall
31 halyavin 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
485 heavyiron 105
  mcall
31 halyavin 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
485 heavyiron 114
    mcall
31 halyavin 115
 
116
    mov  eax,12                    ; function 12:tell os about windowdraw
117
    mov  ebx,1                     ; 1, start of draw
485 heavyiron 118
    mcall
31 halyavin 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
551 spraid 125
    or   edx,0x34000000
485 heavyiron 126
    mov  edi,title
127
    mcall
31 halyavin 128
 
129
    call draw_clock
130
 
131
    mov  eax,12                    ; function 12:tell os about windowdraw
132
    mov  ebx,2                     ; 2, end of draw
485 heavyiron 133
    mcall
31 halyavin 134
 
135
    ret
136
 
137
 
138
; DATA AREA
139
 
140
if lang eq ru
485 heavyiron 141
    title   db   '',0
31 halyavin 142
else
485 heavyiron 143
    title   db   'TIMER',0
31 halyavin 144
end if
145
 
146
 
147
I_END:
148
 
149
temp dd ?
150
sc system_colors