libmenu: Fix cursor on exit from showmenus()
[syslinux.git] / sample / c32echo.c
blobcfde885d21447c14730501668d00f5a8b237b508
1 /* ----------------------------------------------------------------------- *
3 * Copyright 2002-2008 H. Peter Anvin - All Rights Reserved
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.
11 * ----------------------------------------------------------------------- */
14 * c32echo.c
16 * Simple COM32 program which only prints out its own command line
19 #include <com32.h>
21 #define NULL ((void *)0)
23 static inline void memset(void *buf, int ch, unsigned int len)
25 asm volatile ("cld; rep; stosb":"+D" (buf), "+c"(len):"a"(ch):"memory");
28 int __start(void)
30 com32sys_t inreg;
31 const char *p;
33 memset(&inreg, 0, sizeof inreg);
34 inreg.eax.b[1] = 0x02; /* Write Character */
36 for (p = __com32.cs_cmdline; *p; p++) {
37 inreg.edx.b[0] = *p;
38 __com32.cs_intcall(0x21, &inreg, NULL);
41 inreg.edx.b[0] = '\r';
42 __com32.cs_intcall(0x21, &inreg, NULL);
43 inreg.edx.b[0] = '\n';
44 __com32.cs_intcall(0x21, &inreg, NULL);
46 return 0;