+static unsigned char recvbyte(void)
+{
+ return Getch4();
+}
+
+static unsigned short recvword(void)
+{
+ static unsigned char b1, b2;
+ static unsigned short ret;
+ b1 = recvbyte();
+ b2 = recvbyte();
+ ret = (unsigned short)(b2 << 8) | b1;
+ return ret;
+}
+
+static unsigned int recvdword(void)
+{
+ static unsigned char b1, b2, b3, b4;
+ static unsigned int ret;
+ b1 = recvbyte();
+ b2 = recvbyte();
+ b3 = recvbyte();
+ b4 = recvbyte();
+ ret = ((unsigned int) (b4 << 24)) | ((unsigned int) (b3 << 16)) | ((unsigned int) (b2 << 8)) |(unsigned int)b1;
+ return ret;
+}
+
+static void halt(void)
+{
+ while(1) {
+ HWWD_CL = 0;
+ }
+}
+
+static void panic(void)
+{
+ PDR14 = 0x22;
+ halt();
+}
+