* weird m68hc11 emulos sim code
@ 2021-01-30 15:40 Mike Frysinger
0 siblings, 0 replies; only message in thread
From: Mike Frysinger @ 2021-01-30 15:40 UTC (permalink / raw)
To: andrew.burgess; +Cc: gdb
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
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2021-01-30 15:40 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-01-30 15:40 weird m68hc11 emulos sim code Mike Frysinger
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).