Subversion Repositories Kolibri OS

Rev

Rev 2025 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
1798 yogev_ezra 1
;
2
;   BCD CLOCK
3
;
4
;   Compile with FASM for Menuet
5
;
6
;
7
 
8
use32
9
 
10
 org 0x0
11
 
12
 db 'MENUET01'
13
 dd 0x01
14
 dd START
15
 dd I_END
16
 dd 0x1000
17
 dd 0x1000
18
 dd 0x0 , 0x0
19
 
20
include 'lang.inc'
21
include '../../../macros.inc'
22
 
23
 
24
START:
25
red:
26
     call drawwindow
27
 
28
still:
29
 
30
 
31
    mov  eax,23   ; wait for timeout
32
    mov  ebx,50
33
    mcall
34
 
35
    cmp  eax,1 ; redraw ?
36
    je red
37
 
2025 Albom 38
    cmp  eax, 2 ; key
39
    je key
40
 
1798 yogev_ezra 41
    cmp  eax,3 ; button in buffer ?
42
    je button
43
 
44
    call  drawclock
45
 
46
    jmp still
2025 Albom 47
 
48
key:
49
    mov eax, 2
50
    int     0x40
51
    jmp still
52
 
1798 yogev_ezra 53
button:
2025 Albom 54
    mov  al,17	 ; get id
1798 yogev_ezra 55
    mcall
56
 
57
    cmp  ah,1 ; button id=1 ?
58
    jne  noclose
2025 Albom 59
    or	 eax,-1   ; close this program
1798 yogev_ezra 60
    mcall
61
  noclose:
62
 
63
    jmp  still
64
 
65
drawclock:
66
 
67
    mov eax,3 ; get time
68
    mcall
69
    bswap eax
70
    shr  eax,8
71
    mov  edi,dg1
72
    mov  ecx,6
73
dgtomem:
74
    push eax
2740 dunkaist 75
    and  al,0x0f
1798 yogev_ezra 76
    mov  [edi],al
77
    inc  edi
78
    pop  eax
79
    shr  eax,4
80
    loop dgtomem
2740 dunkaist 81
    mov  ebx,79*65536+11
1798 yogev_ezra 82
    mov  edi,dg1
83
digitlp:
2740 dunkaist 84
    mov  ecx,10*65536+11
1798 yogev_ezra 85
    xor  esi,esi
86
plotlp:
87
    xor  edx,edx
88
    test byte[edi],8
89
    je	 nobit
90
    mov  edx,0x00ff0000
91
nobit:
92
    mov  eax,13  ; plot 8,4,2,1
93
    mcall
2740 dunkaist 94
    add  ecx,13*65536
1798 yogev_ezra 95
    shl  byte[edi],1
96
    inc  esi
97
    cmp  esi,4
98
    jne  plotlp
99
    shr  byte[edi],4
100
    mov  edx,0x00880040
101
    mov  eax,13 ; draw digit box
102
    mcall
103
    pusha
104
    mov  edx,ebx
105
    and  edx,0xffff0000
106
    shr  ecx,16
107
    or	 edx,ecx
108
    add  edx,3*65536+2
109
    mov  ebx,0x00010100
110
    mov  ecx,[edi]
111
    mov  esi,0x00ffffff
112
    mov  eax,47  ; display decimal
113
    mcall
114
    popa
2740 dunkaist 115
    sub  ebx,13*65536
1798 yogev_ezra 116
    inc  edi
117
    cmp  edi,dg1+6
118
    jne  digitlp
119
    ret
120
 
121
 
122
drawwindow:
123
 
124
 
125
    mov  eax,12
126
    mov  ebx,1 ; start redraw
127
    mcall
128
 
2740 dunkaist 129
    mov  eax, 48
130
    mov  ebx, 4
131
    mcall
132
    mov  ecx, eax
1798 yogev_ezra 133
    xor  eax,eax ; window
2740 dunkaist 134
    mov  ebx,100*65536+113
135
    add  ecx,100*65536+87
1798 yogev_ezra 136
    mov  edx,0x34400088
137
    mov  edi,title
138
    mcall
139
 
140
call drawclock
141
 
142
    mov  eax,12
143
    mov  ebx,2 ; end redraw
144
    mcall
145
 
146
    ret
147
 
2025 Albom 148
title	db   'BCD Clock',0
1798 yogev_ezra 149
I_END:
2740 dunkaist 150
dg1:   db  ?