1 #ident "$Id: hello2.c,v 1.4 2004/12/14 22:46:25 hpa Exp $"
2 /* ----------------------------------------------------------------------- *
4 * Copyright 2002 H. Peter Anvin - All Rights Reserved
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation, Inc., 53 Temple Place Ste 330,
9 * Boston MA 02111-1307, USA; either version 2 of the License, or
10 * (at your option) any later version; incorporated herein by reference.
12 * ----------------------------------------------------------------------- */
19 * This version shows how to use the bounce buffer for data transfer
20 * to the BIOS or COMBOOT system calls.
25 #define NULL ((void *)0)
27 static inline void memset(void *buf, int ch, unsigned int len)
29 asm volatile("cld; rep; stosb"
30 : "+D" (buf), "+c" (len) : "a" (ch) : "memory");
33 static void strcpy(char *dst, const char *src)
41 static void writemsg(const char *msg)
45 memset(&inreg, 0, sizeof inreg);
47 strcpy(__com32.cs_bounce, msg);
48 inreg.eax.w[0] = 0x0002; /* Write string */
49 inreg.ebx.w[0] = OFFS(__com32.cs_bounce);
50 inreg.es = SEG(__com32.cs_bounce);
51 __com32.cs_intcall(0x22, &inreg, NULL);
56 writemsg("Hello, World!\r\n"
58 writemsg(__com32.cs_cmdline);