-#ifndef _HDLOAD_OSECPU
+#ifndef _HDLOAD_OSECPU
#define _HDLOAD_OSECPU 1
/* Visual Studio で fopen()やsprintf() などの古い関数を使用する時に出る警告を抑止する*/
// 1 : Windows 32bit
// 2 : Mac OSX 32bit
// 3 : blike for Linux
-
#ifdef _WIN32
#define DRV_OSNUM 0x0001
#endif
// syslib.ose is necessary to work OSECPU
#define SYSLIB_OSE "syslib.ose"
+//
+// Define constant values
+//
-/*
- * The 2nd signature of OSECPU Format(05 e1)
- * It will be changed in OSECPU Rev.2 to "e2" (no adaptation in their binary layers)
- */
+// SIGN1: The 2nd signature of OSECPU Format(05 e1)
+// It will be changed in OSECPU Rev.2 to "e2" (no adaptation in their binary layers)
#define SIGN1 0xe1
#define USE_DEBUGGER 1
#define USE_TEK5 0 //元々は1
+/* JITC mode flags */
+#define JITC_LV_SLOWEST 0 /* デバッグ支援は何でもやる */
+#define JITC_LV_SLOWER 1 /* エラーモジュールはレポートできるが、行番号は分からない、テストは過剰 */
+#define JITC_LV_SAFE 2 /* とにかく止まる、場所は不明、テストは必要最小限 */
+#define JITC_LV_FASTER 4 /* 情報は生成するがチェックをしない */
+#define JITC_LV_FASTEST 5 /* 情報すら生成しない */
+#define JITC_PHASE1 0x0001
+#define JITC_SKIPCHECK 0x0002 /* セキュリティチェックを省略する(高速危険モード) */
+#define JITC_NOSTARTUP 0x0004
+#define JITC_MAXLABELS 4096
+#define PTRCTRLSIZ 4096
+
#define APPSIZ1 1 * 1024 * 1024 /* 1MB for now */
#define JITSIZ1 1 * 1024 * 1024 /* 1MB for now */
#define SJITSIZ1 1 * 1024 * 1024 /* 1MB for now */
#define KEYBUFSIZ 4096
+#define KEY_ENTER '\n'
+#define KEY_ESC 27
+#define KEY_BACKSPACE 8
+#define KEY_TAB 9
+#define KEY_PAGEUP 0x1020
+#define KEY_PAGEDWN 0x1021
+#define KEY_END 0x1022
+#define KEY_HOME 0x1023
+#define KEY_LEFT 0x1024
+#define KEY_UP 0x1025
+#define KEY_RIGHT 0x1026
+#define KEY_DOWN 0x1027
+#define KEY_INS 0x1028
+#define KEY_DEL 0x1029
+
//
// HOSECPU structures
//
int typ;
};
+typedef struct Device_Window HOSECPU_Device_Window;
+struct Device_Window {
+ int *vram;
+ int xsize, ysize;
+};
+
typedef struct Regs HOSECPU_RuntimeEnvironment;
struct Regs {
int ireg[64]; /* 32bit整数レジスタ */
int executionLevel;
/* for-junkApi */
- int argc;
- const char **argv;
unsigned char *buf0, *buf1, *junkStack, lastConsoleChar, *junkStack1;
-
+
HOSECPU_LabelListTag *label;
int maxLabels;
unsigned char *jitbuf, *jitbuf1;
int mapDi1s[16][16];
};
-
//
-// Define constant values
+// Grobal values
//
-#define KEY_ENTER '\n'
-#define KEY_ESC 27
-#define KEY_BACKSPACE 8
-#define KEY_TAB 9
-#define KEY_PAGEUP 0x1020
-#define KEY_PAGEDWN 0x1021
-#define KEY_END 0x1022
-#define KEY_HOME 0x1023
-#define KEY_LEFT 0x1024
-#define KEY_UP 0x1025
-#define KEY_RIGHT 0x1026
-#define KEY_DOWN 0x1027
-#define KEY_INS 0x1028
-#define KEY_DEL 0x1029
-
-//
-// Grobal static values
-//
-
-static int *keybuf, keybuf_r, keybuf_w, keybuf_c;
-static int *vram = NULL, v_xsiz, v_ysiz;
-
-//デバッグ用。プログラム中の随所で加算される変数
-static int di1_serial = 0;
+extern int *keybuf, keybuf_r, keybuf_w, keybuf_c;
+extern HOSECPU_Device_Window mainWindow;
+// di1_serial: デバッグ用。プログラム中の随所で加算される変数
+extern int di1_serial;
//
// Functions
// @function.c
void dbgrMain(HOSECPU_RuntimeEnvironment *r);
const char *searchArg(int argc, const char **argv, const char *tag, int i); // コマンドライン引数処理.
-void randStatInit(unsigned int seed);
-void randStatNext();
void devFunc(HOSECPU_RuntimeEnvironment *r); // junkApiを処理する関数
// @jitc.c
-/* JITCのフラグ群 */
-#define JITC_LV_SLOWEST 0 /* デバッグ支援は何でもやる */
-#define JITC_LV_SLOWER 1 /* エラーモジュールはレポートできるが、行番号は分からない、テストは過剰 */
-#define JITC_LV_SAFE 2 /* とにかく止まる、場所は不明、テストは必要最小限 */
-#define JITC_LV_FASTER 4 /* 情報は生成するがチェックをしない */
-#define JITC_LV_FASTEST 5 /* 情報すら生成しない */
-#define JITC_PHASE1 0x0001
-#define JITC_SKIPCHECK 0x0002 /* セキュリティチェックを省略する(高速危険モード) */
-#define JITC_NOSTARTUP 0x0004
-#define JITC_MAXLABELS 4096
-#define PTRCTRLSIZ 4096
int jitc0(unsigned char **qq, unsigned char *q1, const unsigned char *p0, const unsigned char *p1, int level, HOSECPU_LabelListTag *label);
int jitCompiler(unsigned char *dst, unsigned char *dst1, const unsigned char *src, const unsigned char *src1, const unsigned char *src0, HOSECPU_LabelListTag *label, int maxLabels, int level, int debugInfo1, int flags);
unsigned char *jitCompCallFunc(unsigned char *dst, void *func);
unsigned char *jitCompInit(unsigned char *dst);
void errorHandler(HOSECPU_RuntimeEnvironment *r);
+// @randmt.c
+void randStatInit(unsigned int seed);
+void randStatNext();
+unsigned int randGetNextUInt32(void);
+
// @screen.c
static int iColor1[] = {
0x000000, 0xff0000, 0x00ff00, 0xffff00,