syslinux-3.08-2 sources from FC4
[bootcd.git] / syslinux / menu / libmenu / syslnx.c
1 /* -*- c -*- ------------------------------------------------------------- *
2  *   
3  *   Copyright 2004-2005 Murali Krishnan Ganapathy - All Rights Reserved
4  *
5  *   This program is free software; you can redistribute it and/or modify
6  *   it under the terms of the GNU General Public License as published by
7  *   the Free Software Foundation, Inc., 53 Temple Place Ste 330,
8  *   Boston MA 02111-1307, USA; either version 2 of the License, or
9  *   (at your option) any later version; incorporated herein by reference.
10  *
11  * ----------------------------------------------------------------------- */
12
13 #include <string.h>
14 #include <com32.h>
15 #include "syslnx.h"
16
17 com32sys_t inreg,outreg; // Global registers for this module
18
19 char issyslinux(void)
20 {
21   REG_EAX(inreg) = 0x00003000;
22   REG_EBX(inreg) = REG_ECX(inreg) = REG_EDX(inreg) = 0xFFFFFFFF;
23   __intcall(0x21,&inreg,&outreg);
24   return (REG_EAX(outreg) == 0x59530000) && 
25          (REG_EBX(outreg) == 0x4c530000) &&
26          (REG_ECX(outreg) == 0x4e490000) && 
27          (REG_EDX(outreg) == 0x58550000);
28 }
29
30 void runsyslinuxcmd(const char *cmd)
31 {
32   strcpy(__com32.cs_bounce, cmd);
33   REG_AX(inreg) = 0x0003; // Run command
34   REG_BX(inreg) = OFFS(__com32.cs_bounce);
35   inreg.es = SEG(__com32.cs_bounce);
36   __intcall(0x22, &inreg, &outreg);
37 }
38
39 void gototxtmode(void)
40 {
41   REG_AX(inreg) = 0x0005;
42   __intcall(0x22,&inreg,&outreg);
43 }
44