]> 4ch.mooo.com Git - 16.git/blob - 16/PCGPE10/TIMER.ASM
modified: 16/modex16/scroll.c
[16.git] / 16 / PCGPE10 / TIMER.ASM
1 ;--------------------------------------------------------------------------\r
2 ; Here is a source for measuring relative speed of computer. This source\r
3 ; will NOT function properly under multitaskers, as they use timer them-\r
4 ; selves. At least DesqView, OS/2 and Windows mess up with timer.\r
5 ;\r
6 ; This source is copyright 1994 of Teemu Peltonen aka Quark/Remedy Prods.\r
7 ; If you modify this source, please do not spread it! You may spread the\r
8 ; unmodified source as much as you like, but please check that length of\r
9 ; the actual source (not including this comment between vertical lines) is\r
10 ; 91 lines!\r
11 ;\r
12 ; The way of measuring computer's speed is not the best possible, but it\r
13 ; works. Here's a small kind of table of speeds:\r
14 ;\r
15 ; CPU           Output value\r
16 ; 486DX/33MHz   024Ch\r
17 ; 486SX/20MHz   03D4h\r
18 ; 386DX/40MHz   05EDh\r
19 ; 386DX/16MHz   0DBAh\r
20 ; 286  /10MHz   1500h\r
21 ; 086  /4.77MHz 6006h\r
22 ;\r
23 ; Notice! Values may differ from these about 2 up or down. You should\r
24 ; run the tester for about five times and use the value that seems to\r
25 ; appear most times. Disk caches and others can mess up test.\r
26 ;\r
27 ; Thanks to my BBS's users for testing this piece of software!\r
28 ;\r
29 ; If you wish to add your computer's speed here, please contact author.\r
30 ; Feel free to contact me, even if you wouldn't want to add your speed..\r
31 ; Contact addresses are:\r
32 ; teemu.peltonen@stream.nullnet.fi in Internet\r
33 ; Teemu Peltonen@2:222/100         in Fidonet\r
34 ; Teemu Peltonen@68:100/100        in DGi-net\r
35 ; Or call Bitstream BBS (+358-21-4383244) and leave a comment to operator\r
36 ; (command C).\r
37 ;--------------------------------------------------------------------------\r
38 stacki  segment para stack use16 'stack'\r
39         dw      100h dup (?)\r
40 stacki  ends\r
41 \r
42 data    segment para public use16 'data'\r
43 hexval  db      '0123456789ABCDEF'\r
44 stringi db      'Relative speed of computer is '\r
45 d       db      0\r
46 c       db      0\r
47 b       db      0\r
48 a       db      0\r
49 endi    db      'h.$'\r
50 data    ends\r
51 \r
52 code    segment para public use16 'code'\r
53         assume cs:code, ds:data, ss:stacki\r
54 startup:\r
55         mov     ax, seg data\r
56         mov     ds, ax\r
57 \r
58         cli\r
59 \r
60         mov     al, 34h\r
61         out     43h, al         ;OUT can be used as immediate\r
62                                 ;if register value under 100h\r
63 \r
64         xor     al, al\r
65         out     40h, al\r
66         out     40h, al\r
67 \r
68         sti\r
69 \r
70         mov     cx, 1000h       ;action here,\r
71 here:                           ;must not take\r
72         dec     cx              ;more than 1/18\r
73         jnz     here            ;(0.0555) seconds to run\r
74 \r
75         cli\r
76 \r
77         mov     al, 4h\r
78         out     43h, al\r
79 \r
80 \r
81         in      al, 40h\r
82         mov     dl, al\r
83         in      al, 40h\r
84         mov     dh, al\r
85 \r
86         sti\r
87 \r
88         neg     dx              ;Action took bx/1193180 seconds\r
89 \r
90         mov     cl, dh\r
91         and     cl, 11110000b\r
92         shr     cl, 4\r
93         xor     bx, bx\r
94         mov     bl, cl\r
95         mov     ah, hexval[bx]\r
96         mov     d, ah\r
97 \r
98         mov     cl, dh\r
99         and     cl, 00001111b\r
100         xor     bx, bx\r
101         mov     bl, cl\r
102         mov     ah, hexval[bx]\r
103         mov     c, ah\r
104 \r
105         mov     cl, dl\r
106         and     cl, 11110000b\r
107         shr     cl, 4\r
108         xor     bx, bx\r
109         mov     bl, cl\r
110         mov     ah, hexval[bx]\r
111         mov     b, ah\r
112 \r
113         mov     cl, dl\r
114         and     cl, 00001111b\r
115         xor     bx, bx\r
116         mov     bl, cl\r
117         mov     ah, hexval[bx]\r
118         mov     a, ah\r
119 \r
120 \r
121         mov     ax, 0900h\r
122         mov     dx, offset stringi\r
123         int     21h\r
124 \r
125         mov     ax, 4c00h\r
126         int     21h\r
127 \r
128 code    ends\r
129         end     startup\r