make scram work on T23 (fix issue #85)

This commit is contained in:
cinap_lenrek 2011-08-24 06:31:23 +02:00
parent 4593680a05
commit 94fd5b32e9

View file

@ -1,20 +1,36 @@
#include <u.h> #include <u.h>
#include </386/include/ureg.h> #include </386/include/ureg.h>
typedef struct Ureg Ureg;
#include <libc.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 void
main() main()
{ {
Ureg ureg; if((fd = open("/dev/apm", ORDWR)) < 0)
int fd; if((fd = open("#P/apm", ORDWR)) < 0)
sysfatal("open: %r");
fd = open("/dev/apm", OWRITE);
if(fd < 0) sysfatal("%r"); u.ax = 0x530E;
memset(&ureg, 0, sizeof ureg); u.bx = 0x0000;
ureg.ax = 0x5307; u.cx = 0x0102;
ureg.bx = 0x0001; apm();
ureg.cx = 0x0003; u.ax = 0x5307;
ureg.trap = 0x15; u.bx = 0x0001;
write(fd, &ureg, sizeof ureg); u.cx = 0x0003;
apm();
} }