aboutsummaryrefslogtreecommitdiff
path: root/emulators/hercules/files/patch-hc.c
diff options
context:
space:
mode:
Diffstat (limited to 'emulators/hercules/files/patch-hc.c')
-rw-r--r--emulators/hercules/files/patch-hc.c54
1 files changed, 54 insertions, 0 deletions
diff --git a/emulators/hercules/files/patch-hc.c b/emulators/hercules/files/patch-hc.c
new file mode 100644
index 000000000000..23359f5ced93
--- /dev/null
+++ b/emulators/hercules/files/patch-hc.c
@@ -0,0 +1,54 @@
+--- /dev/null Mon Dec 16 17:18:27 2002
++++ hc.c Mon Dec 16 17:21:15 2002
+@@ -0,0 +1,51 @@
++#include "hercules.h"
++
++#include "opcode.h"
++
++#include "inline.h"
++
++static int hcd;
++
++DEF_INST(hconsole_get_char)
++{
++ char ch;
++
++ E(inst, execflag, regs);
++
++ if (hcd == 0)
++ hcd = open("/home/tzukanov/hercules/hc",
++ O_RDWR | O_NONBLOCK | O_CREAT, 0);
++ if (read(hcd, &ch, 1) == 1)
++ regs->GR_LHLCL(1) = ch;
++ else
++ regs->GR_L(1) = -1;
++}
++
++DEF_INST(hconsole_put_char)
++{
++ char ch;
++
++ E(inst, execflag, regs);
++
++
++ if (hcd == 0)
++ hcd = open("/home/tzukanov/hercules/hc",
++ O_RDWR | O_NONBLOCK | O_CREAT, 0);
++ ch = regs->GR_LHLCL(1);
++ write(hcd, &ch, 1);
++}
++
++#if !defined(_GEN_ARCH)
++
++#if defined(_ARCHMODE2)
++ #define _GEN_ARCH _ARCHMODE2
++ #include "hc.c"
++#endif
++
++#if defined(_ARCHMODE3)
++ #undef _GEN_ARCH
++ #define _GEN_ARCH _ARCHMODE3
++ #include "hc.c"
++#endif
++
++#endif /*!defined(_GEN_ARCH)*/