コミットメタ情報

リビジョン4cad1c671ee8d6ba2a0f90fb091df0d1a93831a2 (tree)
日時2014-03-17 17:14:20
作者hikarupsp <hikarupsp@user...>
コミッターhikarupsp

ログメッセージ

マージミスを修正

変更サマリ

差分

--- a/osecpu.h
+++ b/osecpu.h
@@ -1,244 +1,242 @@
1-#ifndef _HDLOAD_OSECPU
2-#define _HDLOAD_OSECPU 1
3-
4-/* Visual Studio で fopen()やsprintf() などの古い関数を使用する時に出る警告を抑止する*/
5-#define _CRT_SECURE_NO_WARNINGS 1
6-
7-//
8-// Including stdc headers
9-//
10-
11-#include <stdio.h>
12-#include <string.h>
13-#include <limits.h>
14-#include <time.h>
15-#include <setjmp.h>
16-#include <stdlib.h>
17-
18-
19-//
20-// Compile options
21-//
22-
23-// Target architecture
24-// 1 : i386
25-#define JITC_ARCNUM 0x0001
26-
27-// Target operating system
28-// 1 : Windows 32bit
29-// 2 : Mac OSX 32bit
30-// 3 : blike for Linux
31-#ifdef _WIN32
32-#define DRV_OSNUM 0x0001
33-#endif
34-#ifdef __APPLE__
35-#define DRV_OSNUM 0x0002
36-#endif
37-#ifdef __linux__
38-#define DRV_OSNUM 0x0003
39-#endif
40-//#define DRV_OSNUM 0x0002
41-
42-// Decoder (syslib.ose) setting
43-// syslib.ose is necessary to work OSECPU
44-#define SYSLIB_OSE "syslib.ose"
45-
46-//
47-// Define constant values
48-//
49-
50-// SIGN1: The 2nd signature of OSECPU Format(05 e1)
51-// It will be changed in OSECPU Rev.2 to "e2" (no adaptation in their binary layers)
52-#define SIGN1 0xe1
53-
54-#define USE_DEBUGGER 1
55-#define USE_TEK5 1
56-
57-/* JITC mode flags */
58-#define JITC_LV_SLOWEST 0 /* デバッグ支援は何でもやる */
59-#define JITC_LV_SLOWER 1 /* エラーモジュールはレポートできるが、行番号は分からない、テストは過剰 */
60-#define JITC_LV_SAFE 2 /* とにかく止まる、場所は不明、テストは必要最小限 */
61-#define JITC_LV_FASTER 4 /* 情報は生成するがチェックをしない */
62-#define JITC_LV_FASTEST 5 /* 情報すら生成しない */
63-#define JITC_PHASE1 0x0001
64-#define JITC_SKIPCHECK 0x0002 /* セキュリティチェックを省略する(高速危険モード) */
65-#define JITC_NOSTARTUP 0x0004
66-#define JITC_MAXLABELS 4096
67-#define PTRCTRLSIZ 4096
68-
69-#define APPSIZ1 1 * 1024 * 1024 /* 1MB for now */
70-#define APPJITSIZE 1 * 1024 * 1024 /* 1MB for now */
71-#define SYSJITSIZ1 2 * 1024 * 1024 /* 1MB for now */
72-#define SYSLIBSIZ1 1 * 1024 * 1024 /* 1MB for now */
73-#define SYSTMP0SIZ 1 * 1024 * 1024 /* 1MB for now */
74-#define SYSTMP1SIZ 2 * 1024 * 1024 /* 1MB for now */
75-
76-#define KEYBUFSIZ 4096
77-
78-#define KEY_ENTER '\n'
79-#define KEY_ESC 27
80-#define KEY_BACKSPACE 8
81-#define KEY_TAB 9
82-#define KEY_PAGEUP 0x1020
83-#define KEY_PAGEDWN 0x1021
84-#define KEY_END 0x1022
85-#define KEY_HOME 0x1023
86-#define KEY_LEFT 0x1024
87-#define KEY_UP 0x1025
88-#define KEY_RIGHT 0x1026
89-#define KEY_DOWN 0x1027
90-#define KEY_INS 0x1028
91-#define KEY_DEL 0x1029
92-
93-//
94-// HOSECPU structures
95-//
96-typedef struct PtrCtrl HOSECPU_PointerControlTag;
97-struct PtrCtrl {
98- int liveSign;
99- int size, typ;
100- unsigned char *p0;
101-};
102-
103-typedef struct Ptr HOSECPU_PointerRegisterEntry;
104-struct Ptr {
105- // 32バイト(=256bit!)
106- unsigned char *p;
107-
108- /* static char *typName[] = {
109- "T_CODE", "T_VPTR", "T_SINT8", "T_UINT8",
110- "T_SINT16", "T_UINT16", "T_SINT32", "T_UINT32",
111- "T_SINT4", "T_UINT4", "T_SINT2", "T_UINT2",
112- "T_SINT1", "T_UINT1", "T_SINT12", "T_UINT12",
113- "T_SINT20", "T_UINT20", "T_SINT24", "T_UINT24",
114- "T_SINT28", "T_UINT28"
115- } ; */
116- int typ;
117- unsigned char *p0, *p1;
118- int liveSign;
119- HOSECPU_PointerControlTag *pls;
120- int flags, dummy; /* read/writeなど */
121-};
122-
123-typedef struct LabelTable HOSECPU_LabelListTag;
124-struct LabelTable {
125- unsigned char *p, *p1;
126- int opt;
127- /*
128- * default = -1
129- * TYP_CODE = 0
130- * T_UINT8 = 3
131- *
132- * 将来的には UInt8, SInt32, Flt64, UInt8, VPtr が使えるようになる http://osecpu.osask.jp/wiki/?page0053
133- */
134- int typ;
135-};
136-
137-typedef struct Device_Window HOSECPU_Device_Window;
138-struct Device_Window {
139- int *vram;
140- int xsize, ysize;
141-};
142-
143-typedef struct Regs HOSECPU_RuntimeEnvironment;
144-struct Regs {
145- int ireg[64]; // 整数レジスタ (4 * 64) = 256
146- HOSECPU_PointerRegisterEntry preg[64]; // ポインタレジスタ (32 * 64) = 2048
147- //
148- int debugInfo0; // 2304
149- int debugInfo1; // 2308
150- int dbg_currentCode; // 2312
151- int dmy; // 2316
152- //
153- HOSECPU_PointerControlTag *ptrCtrl; // 2320
154- char winClosed, autoSleep;
155- jmp_buf setjmpEnv;
156- int appReturnCode; // アプリ自体の終了コード
157-
158- /* Main environment */
159- int mainArgc; // HOSECPU起動引数の個数
160- const char **mainArgv; // HOSECPU起動引数リスト
161- unsigned char *appBin; // 実行するアプリのバイナリ
162- int appSize0;
163- int appSize1;
164- int executionLevel;
165-
166- /* for-junkApi */
167- unsigned char *buf0, *buf1, *junkStack, lastConsoleChar, *junkStack1;
168-
169- HOSECPU_LabelListTag *label;
170- int maxLabels;
171- unsigned char *jitbuf, *jitbuf1;
172- void(*errHndl)(HOSECPU_RuntimeEnvironment *);
173- char dbgr;
174- int mapDi1s[16][16];
175-};
176-
177-//
178-// Grobal values
179-//
180-
181-extern int *keybuf, keybuf_r, keybuf_w, keybuf_c;
182-extern HOSECPU_Device_Window mainWindow;
183-// di1_serial: デバッグ用。プログラム中の随所で加算される変数
184-extern int di1_serial;
185-
186-//
187-// Functions
188-//
189-
190-// @main.c
191-void putKeybuf(int i);
192-int HeavyOSECPUMain(int argc, char **argv);
193-
194-// @comlib.c
195-unsigned char *ComLib_main(const unsigned char *p, unsigned char *q);
196-// @dpndenv.c
197-// OSに依存する関数群を定義する。
198-void *mallocRWE(int bytes); // 実行権付きメモリのmalloc.
199-void drv_openWin(int x, int y, unsigned char *buf, char *winClosed);
200-void drv_flshWin(int sx, int sy, int x0, int y0);
201-void drv_sleep(int msec);
202-
203-// @function.c
204-void dbgrMain(HOSECPU_RuntimeEnvironment *r);
205-const char *searchArg(int argc, const char **argv, const char *tag, int i); // コマンドライン引数処理.
206-void devFunc(HOSECPU_RuntimeEnvironment *r); // junkApiを処理する関数
207-
208-// @jitc.c
209-void errorHandler(HOSECPU_RuntimeEnvironment *r);
210-void PRegCopy(HOSECPU_PointerRegisterEntry *dst, HOSECPU_PointerRegisterEntry *src);
211-// @jitcx86.c
212-int jitc0(unsigned char **qq, unsigned char *q1, const unsigned char *p0, const unsigned char *p1, int level, HOSECPU_LabelListTag *label);
213-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);
214-unsigned char *jitCompCallFunc(unsigned char *dst, void *func);
215-unsigned char *jitCompInit(unsigned char *dst);
216-void jitcRunBinary(void (*bin)(char *), HOSECPU_RuntimeEnvironment *env);
217-
218-// @randmt.c
219-void randStatInit(unsigned int seed);
220-void randStatNext();
221-unsigned int randGetNextUInt32(void);
222-
223-// @screen.c
224-static int iColor1[] = {
225- 0x000000, 0xff0000, 0x00ff00, 0xffff00,
226- 0x0000ff, 0xff00ff, 0x00ffff, 0xffffff
227-};
228-void putOsaskChar(int c, HOSECPU_RuntimeEnvironment *r);
229-void checkString(HOSECPU_RuntimeEnvironment *r, int rxx, int pxx);
230-void checkRect(HOSECPU_RuntimeEnvironment *r, int rxx);
231-int loadColor(HOSECPU_RuntimeEnvironment *r, int rxx);
232-
233-// @usetek.c
234-#if (USE_TEK5 != 0)
235-#include "tek.h"
236-int appackSub2(const UCHAR **pp, char *pif);
237-int appackSub3u(const UCHAR **pp, char *pif);
238-int tek5Decomp(UCHAR *buf, UCHAR *buf1, UCHAR *tmp);
239-#endif
240-
241-
242-#endif
243-
244->>>>>>> 4d5d6fa61ff576ba035ee4bd882e8476f2ceeb2b
1+#ifndef _HDLOAD_OSECPU
2+#define _HDLOAD_OSECPU 1
3+
4+/* Visual Studio で fopen()やsprintf() などの古い関数を使用する時に出る警告を抑止する*/
5+#define _CRT_SECURE_NO_WARNINGS 1
6+
7+//
8+// Including stdc headers
9+//
10+
11+#include <stdio.h>
12+#include <string.h>
13+#include <limits.h>
14+#include <time.h>
15+#include <setjmp.h>
16+#include <stdlib.h>
17+
18+
19+//
20+// Compile options
21+//
22+
23+// Target architecture
24+// 1 : i386
25+#define JITC_ARCNUM 0x0001
26+
27+// Target operating system
28+// 1 : Windows 32bit
29+// 2 : Mac OSX 32bit
30+// 3 : blike for Linux
31+#ifdef _WIN32
32+#define DRV_OSNUM 0x0001
33+#endif
34+#ifdef __APPLE__
35+#define DRV_OSNUM 0x0002
36+#endif
37+#ifdef __linux__
38+#define DRV_OSNUM 0x0003
39+#endif
40+//#define DRV_OSNUM 0x0002
41+
42+// Decoder (syslib.ose) setting
43+// syslib.ose is necessary to work OSECPU
44+#define SYSLIB_OSE "syslib.ose"
45+
46+//
47+// Define constant values
48+//
49+
50+// SIGN1: The 2nd signature of OSECPU Format(05 e1)
51+// It will be changed in OSECPU Rev.2 to "e2" (no adaptation in their binary layers)
52+#define SIGN1 0xe1
53+
54+#define USE_DEBUGGER 1
55+#define USE_TEK5 1
56+
57+/* JITC mode flags */
58+#define JITC_LV_SLOWEST 0 /* デバッグ支援は何でもやる */
59+#define JITC_LV_SLOWER 1 /* エラーモジュールはレポートできるが、行番号は分からない、テストは過剰 */
60+#define JITC_LV_SAFE 2 /* とにかく止まる、場所は不明、テストは必要最小限 */
61+#define JITC_LV_FASTER 4 /* 情報は生成するがチェックをしない */
62+#define JITC_LV_FASTEST 5 /* 情報すら生成しない */
63+#define JITC_PHASE1 0x0001
64+#define JITC_SKIPCHECK 0x0002 /* セキュリティチェックを省略する(高速危険モード) */
65+#define JITC_NOSTARTUP 0x0004
66+#define JITC_MAXLABELS 4096
67+#define PTRCTRLSIZ 4096
68+
69+#define APPSIZ1 1 * 1024 * 1024 /* 1MB for now */
70+#define APPJITSIZE 1 * 1024 * 1024 /* 1MB for now */
71+#define SYSJITSIZ1 2 * 1024 * 1024 /* 1MB for now */
72+#define SYSLIBSIZ1 1 * 1024 * 1024 /* 1MB for now */
73+#define SYSTMP0SIZ 1 * 1024 * 1024 /* 1MB for now */
74+#define SYSTMP1SIZ 2 * 1024 * 1024 /* 1MB for now */
75+
76+#define KEYBUFSIZ 4096
77+
78+#define KEY_ENTER '\n'
79+#define KEY_ESC 27
80+#define KEY_BACKSPACE 8
81+#define KEY_TAB 9
82+#define KEY_PAGEUP 0x1020
83+#define KEY_PAGEDWN 0x1021
84+#define KEY_END 0x1022
85+#define KEY_HOME 0x1023
86+#define KEY_LEFT 0x1024
87+#define KEY_UP 0x1025
88+#define KEY_RIGHT 0x1026
89+#define KEY_DOWN 0x1027
90+#define KEY_INS 0x1028
91+#define KEY_DEL 0x1029
92+
93+//
94+// HOSECPU structures
95+//
96+typedef struct PtrCtrl HOSECPU_PointerControlTag;
97+struct PtrCtrl {
98+ int liveSign;
99+ int size, typ;
100+ unsigned char *p0;
101+};
102+
103+typedef struct Ptr HOSECPU_PointerRegisterEntry;
104+struct Ptr {
105+ // 32バイト(=256bit!)
106+ unsigned char *p;
107+
108+ /* static char *typName[] = {
109+ "T_CODE", "T_VPTR", "T_SINT8", "T_UINT8",
110+ "T_SINT16", "T_UINT16", "T_SINT32", "T_UINT32",
111+ "T_SINT4", "T_UINT4", "T_SINT2", "T_UINT2",
112+ "T_SINT1", "T_UINT1", "T_SINT12", "T_UINT12",
113+ "T_SINT20", "T_UINT20", "T_SINT24", "T_UINT24",
114+ "T_SINT28", "T_UINT28"
115+ } ; */
116+ int typ;
117+ unsigned char *p0, *p1;
118+ int liveSign;
119+ HOSECPU_PointerControlTag *pls;
120+ int flags, dummy; /* read/writeなど */
121+};
122+
123+typedef struct LabelTable HOSECPU_LabelListTag;
124+struct LabelTable {
125+ unsigned char *p, *p1;
126+ int opt;
127+ /*
128+ * default = -1
129+ * TYP_CODE = 0
130+ * T_UINT8 = 3
131+ *
132+ * 将来的には UInt8, SInt32, Flt64, UInt8, VPtr が使えるようになる http://osecpu.osask.jp/wiki/?page0053
133+ */
134+ int typ;
135+};
136+
137+typedef struct Device_Window HOSECPU_Device_Window;
138+struct Device_Window {
139+ int *vram;
140+ int xsize, ysize;
141+};
142+
143+typedef struct Regs HOSECPU_RuntimeEnvironment;
144+struct Regs {
145+ int ireg[64]; // 整数レジスタ (4 * 64) = 256
146+ HOSECPU_PointerRegisterEntry preg[64]; // ポインタレジスタ (32 * 64) = 2048
147+ //
148+ int debugInfo0; // 2304
149+ int debugInfo1; // 2308
150+ int dbg_currentCode; // 2312
151+ int dmy; // 2316
152+ //
153+ HOSECPU_PointerControlTag *ptrCtrl; // 2320
154+ char winClosed, autoSleep;
155+ jmp_buf setjmpEnv;
156+ int appReturnCode; // アプリ自体の終了コード
157+
158+ /* Main environment */
159+ int mainArgc; // HOSECPU起動引数の個数
160+ const char **mainArgv; // HOSECPU起動引数リスト
161+ unsigned char *appBin; // 実行するアプリのバイナリ
162+ int appSize0;
163+ int appSize1;
164+ int executionLevel;
165+
166+ /* for-junkApi */
167+ unsigned char *buf0, *buf1, *junkStack, lastConsoleChar, *junkStack1;
168+
169+ HOSECPU_LabelListTag *label;
170+ int maxLabels;
171+ unsigned char *jitbuf, *jitbuf1;
172+ void(*errHndl)(HOSECPU_RuntimeEnvironment *);
173+ char dbgr;
174+ int mapDi1s[16][16];
175+};
176+
177+//
178+// Grobal values
179+//
180+
181+extern int *keybuf, keybuf_r, keybuf_w, keybuf_c;
182+extern HOSECPU_Device_Window mainWindow;
183+// di1_serial: デバッグ用。プログラム中の随所で加算される変数
184+extern int di1_serial;
185+
186+//
187+// Functions
188+//
189+
190+// @main.c
191+void putKeybuf(int i);
192+int HeavyOSECPUMain(int argc, char **argv);
193+
194+// @comlib.c
195+unsigned char *ComLib_main(const unsigned char *p, unsigned char *q);
196+// @dpndenv.c
197+// OSに依存する関数群を定義する。
198+void *mallocRWE(int bytes); // 実行権付きメモリのmalloc.
199+void drv_openWin(int x, int y, unsigned char *buf, char *winClosed);
200+void drv_flshWin(int sx, int sy, int x0, int y0);
201+void drv_sleep(int msec);
202+
203+// @function.c
204+void dbgrMain(HOSECPU_RuntimeEnvironment *r);
205+const char *searchArg(int argc, const char **argv, const char *tag, int i); // コマンドライン引数処理.
206+void devFunc(HOSECPU_RuntimeEnvironment *r); // junkApiを処理する関数
207+
208+// @jitc.c
209+void errorHandler(HOSECPU_RuntimeEnvironment *r);
210+void PRegCopy(HOSECPU_PointerRegisterEntry *dst, HOSECPU_PointerRegisterEntry *src);
211+// @jitcx86.c
212+int jitc0(unsigned char **qq, unsigned char *q1, const unsigned char *p0, const unsigned char *p1, int level, HOSECPU_LabelListTag *label);
213+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);
214+unsigned char *jitCompCallFunc(unsigned char *dst, void *func);
215+unsigned char *jitCompInit(unsigned char *dst);
216+void jitcRunBinary(void (*bin)(char *), HOSECPU_RuntimeEnvironment *env);
217+
218+// @randmt.c
219+void randStatInit(unsigned int seed);
220+void randStatNext();
221+unsigned int randGetNextUInt32(void);
222+
223+// @screen.c
224+static int iColor1[] = {
225+ 0x000000, 0xff0000, 0x00ff00, 0xffff00,
226+ 0x0000ff, 0xff00ff, 0x00ffff, 0xffffff
227+};
228+void putOsaskChar(int c, HOSECPU_RuntimeEnvironment *r);
229+void checkString(HOSECPU_RuntimeEnvironment *r, int rxx, int pxx);
230+void checkRect(HOSECPU_RuntimeEnvironment *r, int rxx);
231+int loadColor(HOSECPU_RuntimeEnvironment *r, int rxx);
232+
233+// @usetek.c
234+#if (USE_TEK5 != 0)
235+#include "tek.h"
236+int appackSub2(const UCHAR **pp, char *pif);
237+int appackSub3u(const UCHAR **pp, char *pif);
238+int tek5Decomp(UCHAR *buf, UCHAR *buf1, UCHAR *tmp);
239+#endif
240+
241+
242+#endif
旧リポジトリブラウザで表示