Test program for the VESA code
[syslinux.git] / sample / c32echo.c
blob07409f4887bae8f8f9347c8ab9552073b92d1369
1 /* ----------------------------------------------------------------------- *
3 * Copyright 2002 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"
26 : "+D" (buf), "+c" (len) : "a" (ch) : "memory");
29 int __start(void)
31 com32sys_t inreg;
32 const char *p;
34 memset(&inreg, 0, sizeof inreg);
35 inreg.eax.b[1] = 0x02; /* Write Character */
37 for ( p = __com32.cs_cmdline ; *p ; p++ ) {
38 inreg.edx.b[0] = *p;
39 __com32.cs_intcall(0x21, &inreg, NULL);
42 inreg.edx.b[0] = '\r';
43 __com32.cs_intcall(0x21, &inreg, NULL);
44 inreg.edx.b[0] = '\n';
45 __com32.cs_intcall(0x21, &inreg, NULL);
47 return 0;