make scram work on T23 (fix issue #85)
This commit is contained in:
parent
4593680a05
commit
94fd5b32e9
1 changed files with 28 additions and 12 deletions
|
@ -1,20 +1,36 @@
|
|||
#include <u.h>
|
||||
#include </386/include/ureg.h>
|
||||
typedef struct Ureg Ureg;
|
||||
#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()
|
||||
{
|
||||
Ureg ureg;
|
||||
int fd;
|
||||
|
||||
fd = open("/dev/apm", OWRITE);
|
||||
if(fd < 0) sysfatal("%r");
|
||||
memset(&ureg, 0, sizeof ureg);
|
||||
ureg.ax = 0x5307;
|
||||
ureg.bx = 0x0001;
|
||||
ureg.cx = 0x0003;
|
||||
ureg.trap = 0x15;
|
||||
write(fd, &ureg, sizeof ureg);
|
||||
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();
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue