weird m68hc11 emulos sim code

Mike Frysinger via Gdb <[email protected]>
Newsgroups gmane.comp.gdb.devel
Message-ID <YBV92PFcGtHmWL7o@vapier>
it looks like this came in via the initial port back in 2000.  i'm not
familiar with this target or emulos, so hopefully you can explain it
as you were the author :).

sim/m68hc11/emulos.c:

// This is called by M6811_EMUL_SYSCALL.
void
emul_os (int code, sim_cpu *cpu)
{
  cpu->cpu_current_cycle = 8;
  switch (code)
    {
      /* 0xCD 0x01 */
    case 0x01:
      emul_write (cpu);
      break;
...

static void 
emul_write (sim_cpu *cpu)
{
  int addr = cpu_get_x (cpu) & 0x0FFFF;
  int size = cpu_get_d (cpu) & 0x0FFFF;

  if (addr + size > 0x0FFFF) {
    size = 0x0FFFF - addr;
  }
  cpu->cpu_running = 0;
  while (size)
    {
      uint8 val = memory_read8 (cpu, addr);

      write(0, &val, 1);
      addr ++;
      size--;
    }
}

it's writing to fd 0 which is stdin.  is that correct ?
was this meant to write to stdout as a sort of debug syscall ?
-mike
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.