blob: 7bd2299fe3ad58ab8e1d3193e87e40e6b5011fac (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
|
#include <u.h>
#include </386/include/ureg.h>
#include <libc.h>
struct Ureg u;
int fd;
void
apm(void)
{
seek(fd, 0, 0);
if(write(fd, &u, sizeof u) < 0)
sysfatal("write: %r");
seek(fd, 0, 0);
if(read(fd, &u, sizeof u) < 0)
sysfatal("read: %r");
if(u.flags & 1)
sysfatal("apm: %lux", (u.ax>>8) & 0xFF);
}
void
main()
{
if((fd = open("/dev/apm", ORDWR)) < 0)
if((fd = open("#P/apm", ORDWR)) < 0)
sysfatal("open: %r");
u.ax = 0x530E;
u.bx = 0x0000;
u.cx = 0x0102;
apm();
u.ax = 0x5307;
u.bx = 0x0001;
u.cx = 0x0003;
apm();
}
|