/* 
 * (C) 1995 under GPL: Wayne Meissner
 * 
 * $Author$
 * $Date$
 * $Source$
 * $Revision$
 * 
 */

#include <stdio.h>
#include <go32.h>
#include <dos.h>
#include <dpmi.h>
#include <stdlib.h>
#include <unistd.h>

#include "daemon.h"
#include "dosemu.h"

int
main (int argc, char **argv) {
  union REGS regs;
  struct SREGS sregs;
  _go32_dpmi_seginfo m;
  
  char *message = (char *)malloc (100);
  char buf[4096];
  sprintf (message, "testing 1 2 3. This is a static string");
  printf ("&message = %d, %p\n", (int)message, (void *)message);
  
  m.size=10;
  if (_go32_dpmi_allocate_dos_memory (&m) != 0) {
    fprintf (stderr, "allocate_dos_memory() failed\n");
    fprintf (stderr, "maximum size = %d\n", m.size);
/*    exit (-1); */
  }

  dosmemput (message, strlen (message) + 1, m.rm_segment * 16);
  dosmemget ((int)message, strlen(message), buf);
  printf ("buf = %s\n", buf);
  _go32_dpmi_free_dos_memory(&m);
#if 0
  regs.x.bx = m.rm_segment;
  regs.x.cx = m.rm_offset;
#else
  regs.x.bx = (int)message;
#endif
  regs.x.ax = DAEMON_HELPER;
  sregs.ds = _go32_my_ds();
  sregs.cs = _go32_my_cs();
  sregs.ss = _go32_my_ss();

  int86 (DOS_HELPER, &regs, &regs);
  return 0;
}
