Rev 1798 | Go to most recent revision | 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 |
||
75 | and al,15 |
||
76 | mov [edi],al |
||
77 | inc edi |
||
78 | pop eax |
||
79 | shr eax,4 |
||
80 | loop dgtomem |
||
81 | mov ebx,74*65536+10 |
||
82 | mov edi,dg1 |
||
83 | digitlp: |
||
84 | mov ecx,10*65536+10 |
||
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 |
||
94 | add ecx,12*65536 |
||
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 |
||
115 | sub ebx,12*65536 |
||
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 | |||
129 | xor eax,eax ; window |
||
130 | mov ebx,100*65536+107 |
||
131 | mov ecx,100*65536+105 |
||
132 | mov edx,0x34400088 |
||
133 | mov edi,title |
||
134 | mcall |
||
135 | |||
136 | call drawclock |
||
137 | |||
138 | mov eax,12 |
||
139 | mov ebx,2 ; end redraw |
||
140 | mcall |
||
141 | |||
142 | ret |
||
143 | |||
2025 | Albom | 144 | title db 'BCD Clock',0 |
1798 | yogev_ezra | 145 | I_END: |
146 | dg1: db ? |