# Mac desktop service store files
.DS_Store
+HeavyOSECPU.xcodeproj/project.pbxproj
+HeavyOSECPU.xcodeproj/project.xcworkspace/contents.xcworkspacedata
+HeavyOSECPU.xcodeproj/project.xcworkspace/xcshareddata/HeavyOSECPU.xccheckout
+HeavyOSECPU.xcodeproj/project.xcworkspace/xcuserdata/hikaru.xcuserdatad/UserInterfaceState.xcuserstate
+HeavyOSECPU.xcodeproj/xcuserdata/hikaru.xcuserdatad/xcschemes/HeavyOSECPU.xcscheme
+HeavyOSECPU.xcodeproj/xcuserdata/hikaru.xcuserdatad/xcschemes/xcschememanagement.plist
+++ /dev/null
-
-Microsoft Visual Studio Solution File, Format Version 12.00
-# Visual Studio 2013
-VisualStudioVersion = 12.0.30110.0
-MinimumVisualStudioVersion = 10.0.40219.1
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "HeavyOSECPU", "HeavyOSECPU\HeavyOSECPU.vcxproj", "{300C89E4-CD40-4017-B8A5-1B01C5B6C3B0}"
-EndProject
-Global
- GlobalSection(SolutionConfigurationPlatforms) = preSolution
- Debug|Win32 = Debug|Win32
- Release|Win32 = Release|Win32
- EndGlobalSection
- GlobalSection(ProjectConfigurationPlatforms) = postSolution
- {300C89E4-CD40-4017-B8A5-1B01C5B6C3B0}.Debug|Win32.ActiveCfg = Debug|Win32
- {300C89E4-CD40-4017-B8A5-1B01C5B6C3B0}.Debug|Win32.Build.0 = Debug|Win32
- {300C89E4-CD40-4017-B8A5-1B01C5B6C3B0}.Release|Win32.ActiveCfg = Release|Win32
- {300C89E4-CD40-4017-B8A5-1B01C5B6C3B0}.Release|Win32.Build.0 = Release|Win32
- EndGlobalSection
- GlobalSection(SolutionProperties) = preSolution
- HideSolutionNode = FALSE
- EndGlobalSection
-EndGlobal
+++ /dev/null
-<?xml version="1.0" encoding="utf-8"?>
-<Project DefaultTargets="Build" ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <ItemGroup Label="ProjectConfigurations">
- <ProjectConfiguration Include="Debug|Win32">
- <Configuration>Debug</Configuration>
- <Platform>Win32</Platform>
- </ProjectConfiguration>
- <ProjectConfiguration Include="Release|Win32">
- <Configuration>Release</Configuration>
- <Platform>Win32</Platform>
- </ProjectConfiguration>
- </ItemGroup>
- <PropertyGroup Label="Globals">
- <ProjectGuid>{300C89E4-CD40-4017-B8A5-1B01C5B6C3B0}</ProjectGuid>
- <Keyword>Win32Proj</Keyword>
- <RootNamespace>HeavyOSECPU</RootNamespace>
- </PropertyGroup>
- <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
- <ConfigurationType>Application</ConfigurationType>
- <UseDebugLibraries>true</UseDebugLibraries>
- <PlatformToolset>v120</PlatformToolset>
- <CharacterSet>Unicode</CharacterSet>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
- <ConfigurationType>Application</ConfigurationType>
- <UseDebugLibraries>false</UseDebugLibraries>
- <PlatformToolset>v120</PlatformToolset>
- <WholeProgramOptimization>true</WholeProgramOptimization>
- <CharacterSet>Unicode</CharacterSet>
- </PropertyGroup>
- <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
- <ImportGroup Label="ExtensionSettings">
- </ImportGroup>
- <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
- </ImportGroup>
- <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
- </ImportGroup>
- <PropertyGroup Label="UserMacros" />
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
- <LinkIncremental>true</LinkIncremental>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
- <LinkIncremental>false</LinkIncremental>
- </PropertyGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
- <ClCompile>
- <PrecompiledHeader>
- </PrecompiledHeader>
- <WarningLevel>Level3</WarningLevel>
- <Optimization>Disabled</Optimization>
- <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
- </ClCompile>
- <Link>
- <SubSystem>Console</SubSystem>
- <GenerateDebugInformation>true</GenerateDebugInformation>
- </Link>
- </ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
- <ClCompile>
- <WarningLevel>Level3</WarningLevel>
- <PrecompiledHeader>
- </PrecompiledHeader>
- <Optimization>MaxSpeed</Optimization>
- <FunctionLevelLinking>true</FunctionLevelLinking>
- <IntrinsicFunctions>true</IntrinsicFunctions>
- <PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
- </ClCompile>
- <Link>
- <SubSystem>Console</SubSystem>
- <GenerateDebugInformation>true</GenerateDebugInformation>
- <EnableCOMDATFolding>true</EnableCOMDATFolding>
- <OptimizeReferences>true</OptimizeReferences>
- </Link>
- </ItemDefinitionGroup>
- <ItemGroup>
- <ClInclude Include="comlib.h" />
- <ClInclude Include="dependent.h" />
- <ClInclude Include="function.h" />
- <ClInclude Include="jitc.h" />
- <ClInclude Include="osecpu.h" />
- <ClInclude Include="screen.h" />
- <ClInclude Include="switch.h" />
- </ItemGroup>
- <ItemGroup>
- <ClCompile Include="comlib.c" />
- <ClCompile Include="dependent.c" />
- <ClCompile Include="function.c" />
- <ClCompile Include="jitc.c" />
- <ClCompile Include="main.c" />
- <ClCompile Include="screen.c" />
- </ItemGroup>
- <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
- <ImportGroup Label="ExtensionTargets">
- </ImportGroup>
-</Project>
\ No newline at end of file
+++ /dev/null
-<?xml version="1.0" encoding="utf-8"?>
-<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <ItemGroup>
- <Filter Include="ソース ファイル">
- <UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
- <Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
- </Filter>
- <Filter Include="ヘッダー ファイル">
- <UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
- <Extensions>h;hh;hpp;hxx;hm;inl;inc;xsd</Extensions>
- </Filter>
- <Filter Include="リソース ファイル">
- <UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
- <Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
- </Filter>
- </ItemGroup>
- <ItemGroup>
- <ClInclude Include="osecpu.h">
- <Filter>ヘッダー ファイル</Filter>
- </ClInclude>
- <ClInclude Include="switch.h">
- <Filter>ヘッダー ファイル</Filter>
- </ClInclude>
- <ClInclude Include="dependent.h">
- <Filter>ヘッダー ファイル</Filter>
- </ClInclude>
- <ClInclude Include="function.h">
- <Filter>ヘッダー ファイル</Filter>
- </ClInclude>
- <ClInclude Include="jitc.h">
- <Filter>ヘッダー ファイル</Filter>
- </ClInclude>
- <ClInclude Include="comlib.h">
- <Filter>ヘッダー ファイル</Filter>
- </ClInclude>
- <ClInclude Include="screen.h">
- <Filter>ヘッダー ファイル</Filter>
- </ClInclude>
- </ItemGroup>
- <ItemGroup>
- <ClCompile Include="main.c">
- <Filter>ソース ファイル</Filter>
- </ClCompile>
- <ClCompile Include="dependent.c">
- <Filter>ソース ファイル</Filter>
- </ClCompile>
- <ClCompile Include="jitc.c">
- <Filter>ソース ファイル</Filter>
- </ClCompile>
- <ClCompile Include="function.c">
- <Filter>ソース ファイル</Filter>
- </ClCompile>
- <ClCompile Include="screen.c">
- <Filter>ソース ファイル</Filter>
- </ClCompile>
- <ClCompile Include="comlib.c">
- <Filter>ソース ファイル</Filter>
- </ClCompile>
- </ItemGroup>
-</Project>
\ No newline at end of file
+++ /dev/null
-#ifndef _HDLOAD_FUNCTION
-#define _HDLOAD_FUNCTION 1
-
-/* \83v\83\8d\83O\83\89\83\80\82Ì\82·\82×\82Ä\82Ì\95\94\95ª\82Å\94Ä\97p\93I\82É\97\98\97p\82Å\82«\82é\8aÖ\90\94\82ð\92è\8b`\82·\82é\81B */
-
-
-void dbgrMain(struct Regs *r);
-const unsigned char *searchArg(int argc, const unsigned char **argv, const unsigned char *tag, int i); // \83R\83}\83\93\83h\83\89\83C\83\93\88ø\90\94\8f\88\97\9d.
-void randStatInit(unsigned int seed);
-void randStatNext();
-void devFunc(struct Regs *r); // junkApi\82ð\8f\88\97\9d\82·\82é\8aÖ\90\94
-
-
-
-
-#endif
\ No newline at end of file
+++ /dev/null
-#ifndef _HDLOAD_SWITCH
-#define _HDLOAD_SWITCH 1
-
-/*
- * \82±\82Ì\83t\83@\83C\83\8b\82ð\95Ò\8fW\82·\82é\82±\82Æ\82Å\83R\83\93\83p\83C\83\8b\82Ì\8ed\95û\82ð\95Ï\8dX\82Å\82«\82Ü\82·
- */
-
-
-/*
- * CPU\82Ì\83A\81[\83L\83e\83N\83`\83\83
- * 1 : i386
- */
-#define JITC_ARCNUM 0x0001
-
-/*
- * \8eÀ\8ds\8aÂ\8b«\82Æ\82È\82éOS\82Ì\8eí\97Þ
- * 1 : Win32
- * 2 : Mac OS
- * 3 : blike for Linux
- */
-#define DRV_OSNUM 0x0001
-
-/*
- * \83t\83\8d\83\93\83g\83G\83\93\83h\83R\81[\83h->\83o\83b\83N\83G\83\93\83h\83R\81[\83h \82ð\8eÀ\8ds\82·\82ésyslib(decorder)\83t\83@\83C\83\8b\82ð\8ew\92è\82·\82é\81B
- * OSECPU\82Ì\93®\8dì\82É\82Ísyslib.ose\82ª\95K\97v\81B
- */
-#define SYSLIB_OSE "syslib.ose"
-#define SIGN1 0xe1
-
-
-
-#define USE_DEBUGGER 1
-#define USE_TEK5 0 //\8c³\81X\82Í1
-
-#define APPSIZ1 1 * 1024 * 1024 /* \82Æ\82è\82 \82¦\82¸1MB\82Å */
-#define JITSIZ1 1 * 1024 * 1024 /* \82Æ\82è\82 \82¦\82¸1MB\82Å */
-#define SJITSIZ1 1 * 1024 * 1024 /* \82Æ\82è\82 \82¦\82¸1MB\82Å */
-#define SYSLIBSIZ1 1 * 1024 * 1024 /* \82Æ\82è\82 \82¦\82¸1MB\82Å */
-#define SYSTMP0SIZ 1 * 1024 * 1024 /* \82Æ\82è\82 \82¦\82¸1MB\82Å */
-#define SYSTMP1SIZ 2 * 1024 * 1024 /* \82Æ\82è\82 \82¦\82¸2MB\82Å */
-
-#define KEYBUFSIZ 4096
-
-#endif
-
#ifndef _HDLOAD_COMLIB
#define _HDLOAD_COMLIB 1
-/* ComLib\8aÖ\8cW */
+/* ComLib関係 */
unsigned char *ComLib_main(const unsigned char *p, unsigned char *q);
HINSTANCE hi;
HWND hw;
BITMAPINFO bmi;
- int tmcount1, tmcount2, flags, smp; /* bit0: \8fI\97¹ */
+ int tmcount1, tmcount2, flags, smp; /* bit0: 終了 */
HANDLE mtx;
char *winClosed;
};
#define BL_CLEARREP 0x00000008
#define BL_DELFFF 0x00000010
-#define BL_KEYMODE 0x00000000 // \8dì\82è\82©\82¯, make/remake/break\82ª\8c©\82¦\82é\82©\82Ç\82¤\82©
+#define BL_KEYMODE 0x00000000 // 作りかけ, make/remake/breakが見えるかどうか
#define w bl_work
#define dw bld_work
for (;;) {
i = GetMessage(&msg, NULL, 0, 0);
- if (i == 0 || i == -1) /* \83G\83\89\81[\82à\82µ\82\82Í\8fI\97¹\83\81\83b\83Z\81[\83W */
+ if (i == 0 || i == -1) /* エラーもしくは終了メッセージ */
break;
- /* \82»\82Ì\82Ù\82©\82Í\82Æ\82è\82 \82¦\82¸\83f\83t\83H\83\8b\83g\8f\88\97\9d\82Å */
+ /* そのほかはとりあえずデフォルト処理で */
TranslateMessage(&msg);
DispatchMessage(&msg);
}
// PostQuitMessage(0);
- dw.flags |= 1; /* \8fI\97¹, bld_waitNF()\82ª\8c©\82Â\82¯\82é */
+ dw.flags |= 1; /* 終了, bld_waitNF()が見つける */
if (dw.winClosed != NULL)
*dw.winClosed = 1;
return 0;
{
Sleep(msec);
// MsgWaitForMultipleObjects(1, &threadhandle, FALSE, msec, QS_ALLINPUT);
- /* \95×\8b\95s\91«\82Å\82Ü\82¾\8f\91\82«\95û\82ª\95ª\82©\82è\82Ü\82¹\82ñ! */
+ /* 勉強不足でまだ書き方が分かりません! */
return;
}
#ifndef _HDLOAD_DEPENDENT
#define _HDLOAD_DEPENDENT
-/* OS\82É\88Ë\91¶\82·\82é\8aÖ\90\94\8cQ\82ð\92è\8b`\82·\82é\81B */
+/* OSに依存する関数群を定義する。 */
-void *mallocRWE(int bytes); // \8eÀ\8ds\8c \95t\82«\83\81\83\82\83\8a\82Ìmalloc.
+void *mallocRWE(int bytes); // 実行権付きメモリのmalloc.
void drv_openWin(int x, int y, unsigned char *buf, char *winClosed);
void drv_flshWin(int sx, int sy, int x0, int y0);
void drv_sleep(int msec);
int i, ddx, ddy, j, ch, dx, dy;
if ((mod & 3) == 0 && sx == 1 && sy == 1) {
- // \83\81\83W\83\83\81[\83P\81[\83X\82ð\8d\82\91¬\89».
+ // メジャーケースを高速化.
for (i = 0; i < len; i++) {
ch = puc[i];
if (0x10 <= ch && ch <= 0x1f)
(*(r->errHndl))(r);
j = q[3];
if ((q[2] & 4) == 0) {
- // j\82Í\95\84\8d\86\95t\82«\90®\90\94.
+ // jは符号付き整数.
if ((q[2] & 8) != 0 && j > 0) sign = '+';
if (j < 0) { sign = '-'; j *= -1; }
}
else {
- // j\82Í\95\84\8d\86\96³\82µ\90®\90\94.
+ // jは符号無し整数.
if ((q[2] & 8) != 0 && j != 0) sign = '+';
}
for (k = q[1] - 1; k >= 0; k--) {
void devFunc(struct Regs *r)
{
FILE *fp;
- r = (struct Regs *) (((char *)r) - 128); /* \83T\83C\83Y\82ð\90ß\96ñ\82·\82é\82½\82ß\82ÉEBP\82ð128\83o\83C\83g\82¸\82ç\82µ\82Ä\82¢\82é\82Ì\82ð\8c³\82É\96ß\82· */
+ r = (struct Regs *) (((char *)r) - 128); /* サイズを節約するためにEBPを128バイトずらしているのを元に戻す */
int i, c;
int x, y, len, dx, dy;
unsigned char *puc;
switch (r->ireg[0x30]) {
case 0xff00:
- printf("R31=%d(dec)\n", r->ireg[0x31]);
+ printf("R31=%d(dec)¥n", r->ireg[0x31]);
break;
case 0xff01:
if (r->buf0 == NULL)
r->buf0 = malloc(1024 * 1024);
if (r->argc <= r->ireg[0x31]) {
- fprintf(stderr, "devFunc: error: R30=ff01: argc error: R31=%08X\n", r->ireg[0x31]);
+ fprintf(stderr, "devFunc: error: R30=ff01: argc error: R31=%08X¥n", r->ireg[0x31]);
exit(1);
}
fp = fopen(r->argv[r->ireg[0x31]], "rb");
if (fp == NULL) {
- fprintf(stderr, "devFunc: error: R30=ff01: fopen error: '%s'\n", r->argv[r->ireg[0x31]]);
+ fprintf(stderr, "devFunc: error: R30=ff01: fopen error: '%s'¥n", r->argv[r->ireg[0x31]]);
exit(1);
}
i = fread(r->buf0, 1, 1024 * 1024 - 4, fp);
if (i >= 1024 * 1024 - 4 || i < 0) {
- fprintf(stderr, "devFunc: error: R30=ff01: fread error: '%s'\n", r->argv[r->ireg[0x31]]);
+ fprintf(stderr, "devFunc: error: R30=ff01: fread error: '%s'¥n", r->argv[r->ireg[0x31]]);
exit(1);
}
fclose(fp);
case 0xff02:
/* return: none */
if (r->argc <= r->ireg[0x31]) {
- fprintf(stderr, "devFunc: error: R30=ff02: argc error: R31=%08X\n", r->ireg[0x31]);
+ fprintf(stderr, "devFunc: error: R30=ff02: argc error: R31=%08X¥n", r->ireg[0x31]);
exit(1);
}
fp = fopen(r->argv[r->ireg[0x31]], "wb");
if (fp == NULL) {
- fprintf(stderr, "devFunc: error: R30=ff02: fopen error: '%s'\n", r->argv[r->ireg[0x31]]);
+ fprintf(stderr, "devFunc: error: R30=ff02: fopen error: '%s'¥n", r->argv[r->ireg[0x31]]);
exit(1);
}
if (r->ireg[0x32] >= 1024 * 1024 || r->ireg[0x32] < 0){
- fprintf(stderr, "devFunc: error: R30=ff02: fwrite error: R02=%08X\n", r->ireg[0x32]);
+ fprintf(stderr, "devFunc: error: R30=ff02: fwrite error: R02=%08X¥n", r->ireg[0x32]);
exit(1);
}
fwrite(r->preg[0x31].p, 1, r->ireg[0x32], fp);
break;
case 0xff04:
- printf("P31.(p-p0)=%d(dec)\n", r->preg[0x31].p - r->preg[0x31].p0);
+ printf("P31.(p-p0)=%d(dec)¥n", r->preg[0x31].p - r->preg[0x31].p0);
break;
case 0xff05:
break;
case 0xff06:
- // R31\82Í\83\8a\83^\81[\83\93\83R\81[\83h.
- // \82±\82ê\82ð\94½\89f\82·\82×\82«\82¾\82ª\81A\8c»\8fó\82Í\8eè\94²\82«\82Å\82¢\82Â\82à\90³\8fí\8fI\97¹.
+ // R31はリターンコード.
+ // これを反映すべきだが、現状は手抜きでいつも正常終了.
longjmp(*(r->setjmpEnv), 1);
break;
case 0xff07:
- // \83}\83V\82É\82È\82Á\82½\95¶\8e\9a\97ñ\95\\8e¦.OSASK\95¶\8e\9a\97ñ\82É\91Î\89\9e.off\82É\82·\82ê\82Î\92Ê\8fí\82Ì\95¶\8e\9a\97ñ\8f\88\97\9d\82à\82Å\82«\82é.\8c»\8fó\82Íon\82Ì\82Ý\83T\83|\81[\83g.
+ // マシになった文字列表示.OSASK文字列に対応.offにすれば通常の文字列処理もできる.現状はonのみサポート.
checkString(r, 0x31, 0x31);
devFunc0001(r->ireg[0x31], r->preg[0x31].p, r);
break;
case 0xff08:
// JITC on JITC
- // R31: \8c¾\8cê(back-end, front-end, ...
+ // R31: 言語(back-end, front-end, ...
// R32: level
// R33: debugInfo1
checkString(r, 0x34, 0x31);
r->preg[0x31].typ = 0; // TYP_CODE
r->preg[0x31].p0 = r->jitbuf;
r->preg[0x31].p1 = r->jitbuf + 1;
- //int j; for (j = 0; j < i; j++) printf("%02X ", r->jitbuf[j]); putchar('\n');
+ //int j; for (j = 0; j < i; j++) printf("%02X ", r->jitbuf[j]); putchar('¥n');
r->jitbuf += i;
static unsigned char ff08_ret[3] = { 0x1e, 0x3f, 0x30 };
i = jitCompiler(r->jitbuf, r->jitbuf1, ff08_ret, ff08_ret + 3, puc, r->label, r->maxLabels, r->ireg[0x32], -1, JITC_NOSTARTUP + JITC_PHASE1 + 0);
break;
case 0xff09:
- // \82½\82Ô\82ñbit7\82ð\8eg\82Á\82½\83e\83L\83X\83g\82Í\82¤\82Ü\82\8f\88\97\9d\82Å\82«\82È\82¢\81i\82±\82ê\82Í\82à\82Í\82â\8ed\97l\82É\82µ\82Ä\82à\96â\91è\82È\82¢\82©\82à\81j.
+ // たぶんbit7を使ったテキストはうまく処理できない(これはもはや仕様にしても問題ないかも).
checkString(r, 0x31, 0x31);
len = devFunc0016(sizeof pucbuf, pucbuf, r->ireg[0x31], r->preg[0x31].p, r->ireg[0x32], (int *)r->preg[0x32].p, r);
devFunc0001(len, pucbuf, r);
break;
case 0xff40:
- /* R31\82ÆR32\82Å\83T\83C\83Y\82ð\8ew\92è */
+ /* R31とR32でサイズを指定 */
v_xsiz = r->ireg[0x31];
v_ysiz = r->ireg[0x32];
if (v_xsiz <= 0 || v_ysiz <= 0)
break;
case 0xff41:
- /* R31\82ÆR32\82Å\83T\83C\83Y\82ð\8ew\92è\81AR33\82ÆR34\82Åx0,y0\8ew\92è */
+ /* R31とR32でサイズを指定、R33とR34でx0,y0指定 */
if (r->ireg[0x31] == -1) { r->ireg[0x31] = v_xsiz; r->ireg[0x33] &= 0; }
if (r->ireg[0x32] == -1) { r->ireg[0x32] = v_ysiz; r->ireg[0x34] &= 0; }
checkRect(r, 0x31);
case 0xff43:
// 1:peek
// 2:stdin
- // 4,8: \83\\81[\83X\8ew\92è.
- // 16: shift, lock\8cn\82ð\97L\8cø\89».
- // 32: \8d¶\89E\82Ìshift\8cn\82ð\8bæ\95Ê\82·\82é.
- if (r->ireg[0x31] == 2) { // \82È\82º3\82É\82µ\82È\82©\82Á\82½\82Ì\82©...
+ // 4,8: ソース指定.
+ // 16: shift, lock系を有効化.
+ // 32: 左右のshift系を区別する.
+ if (r->ireg[0x31] == 2) { // なぜ3にしなかったのか...
r->ireg[0x30] = fgetc(stdin);
if (r->ireg[0x30] == EOF)
r->ireg[0x30] = -1;
break;
case 0xff47: // fillOval(opt:R31, xsiz:R32, ysiz:R33, x0:R34, y0:R35, c:R36)
- // \82±\82ê\82Ì\8cv\8eZ\90¸\93x\82Í\83A\81[\83L\83e\83N\83`\83\83\82É\88Ë\91¶\82·\82é.
+ // これの計算精度はアーキテクチャに依存する.
c = loadColor(r, 0x36);
if (r->ireg[0x32] == -1) { r->ireg[0x32] = v_xsiz; r->ireg[0x34] &= 0; }
if (r->ireg[0x33] == -1) { r->ireg[0x33] = v_ysiz; r->ireg[0x35] &= 0; }
devFunc0006(r->ireg[0x31], r->ireg[0x32], r->ireg[0x33], r->ireg[0x34], r->ireg[0x35], loadColor(r, 0x36), r->ireg[0x37], r->preg[0x31].p, r);
break;
- case 0xff49: /* \93K\93\96\82È\97\90\90\94\82ð\95Ô\82· */
+ case 0xff49: /* 適当な乱数を返す */
randStatNext();
unsigned u32t;
u32t = randStat.stat[0] + (randStat.stat[2] >> 8);
r->ireg[0x30] = (r->ireg[0x30] & 0x7fffffff) % (r->ireg[0x31] + 1);
break;
- case 0xff4a: /* seed\82Ì\8ew\92è */
+ case 0xff4a: /* seedの指定 */
randStatInit(r->ireg[0x31]);
break;
- case 0xff4b: /* \93K\93\96\82Èseed\82ð\92ñ\8b\9f */
+ case 0xff4b: /* 適当なseedを提供 */
r->ireg[0x30] = (int)(time(NULL) ^ (long)0x55555555);
break;
break;
default:
- printf("devFunc: error: R30=%08X\n", r->ireg[0x30]);
+ printf("devFunc: error: R30=%08X¥n", r->ireg[0x30]);
exit(1);
}
--- /dev/null
+#ifndef _HDLOAD_FUNCTION
+#define _HDLOAD_FUNCTION 1
+
+/* プログラムのすべての部分で汎用的に利用できる関数を定義する。 */
+
+
+void dbgrMain(struct Regs *r);
+const unsigned char *searchArg(int argc, const unsigned char **argv, const unsigned char *tag, int i); // コマンドライン引数処理.
+void randStatInit(unsigned int seed);
+void randStatNext();
+void devFunc(struct Regs *r); // junkApiを処理する関数
+
+
+
+
+#endif
\ No newline at end of file
void errorHandler(struct Regs *r)
{
puts("security error! abort...");
- printf("debugInfo0=%d, debugInfo1=%d\n", r->debugInfo0, r->debugInfo1);
+ printf("debugInfo0=%d, debugInfo1=%d¥n", r->debugInfo0, r->debugInfo1);
#if (USE_DEBUGGER != 0)
dbgrMain(r);
#endif
}
#if (JITC_ARCNUM == 0x0001) /* x86-32bit */
-/* \91¼\82ÌCPU\82Ö\88Ú\90A\82·\82é\90l\82Ö:
-\88È\89º\82Í\8dÅ\93K\89»\82Ì\82½\82ß\82Ì\82à\82Ì\82È\82Ì\82Å\81A\82·\82×\82Ä0\82Æ\82µ\82Ä\8aÈ\92P\82É\88Ú\90A\82µ\82Ä\82à\96â\91è\82 \82è\82Ü\82¹\82ñ */
+/* 他のCPUへ移植する人へ:
+以下は最適化のためのものなので、すべて0として簡単に移植しても問題ありません */
#define jitCompA0001_USE_R3F_CMPJMP 1*1
#define jitCompA0001_USE_R3F_IMM32 1*1
#define jitCompA0001_USE_R3F_IMM8 1*1
#define jitCompA0001_USE_R3F_INCDEC 1*1
#define jitCompA0001_OPTIMIZE_JMP 1*1
-#define jitCompA0001_OPTIMIZE_MOV 1*1 /* 1\82É\82·\82é\82Æ\91¬\93x\92á\89º\82·\82é\81H */
+#define jitCompA0001_OPTIMIZE_MOV 1*1 /* 1にすると速度低下する? */
#define jitCompA0001_OPTIMIZE_CMP 1*1
-#define jitCompA0001_OPTIMIZE_ALIGN 4*1 /* 0-8\82ð\91z\92è */
+#define jitCompA0001_OPTIMIZE_ALIGN 4*1 /* 0-8を想定 */
#define jitCompA0001_EBP128 128*1
struct JitCompWork {
{
if (p0 >= 0x3f || p0 < 0) w->err = JITC_ERR_PREGNUM;
if (p1 >= 0x3f || p1 < 0) w->err = JITC_ERR_PREGNUM;
- /* \94ä\8ar\89Â\94\\89Â\94\\82È\82Ì\82©\82Ì\83`\83F\83b\83N\82Ì\83R\81[\83h\82ð\8fo\97Í */ /* \96¢\8a®\90¬ */
+ /* 比較可能可能なのかのチェックのコードを出力 */ /* 未完成 */
return;
}
}
void jitCompA0001_checkType(struct JitCompWork *w, int pxx, int typ, int ac)
-// data\97p.
-// \8f«\97\88\93I\82É\82Íalive\82â\83A\83N\83Z\83X\8c \83`\83F\83b\83N\82à\93ü\82ê\82é
+// data用.
+// 将来的にはaliveやアクセス権チェックも入れる
{
jitCompA0001_checkType0(w, pxx, typ, ac);
return;
void func3c(char *ebp, int opt, int r1, int p1, int lenR, int lenP, int r0, int p0);
void func3d(char *ebp, int opt, int r1, int p1, int lenR, int lenP, int r0, int p0);
void funcf4(char *ebp, int pxx, int typ, int len);
-void funcf5(char *ebp, int pxx, int typ, int len); // pxx\82Í\83_\83~\81[\82Å\8eQ\8fÆ\82³\82ê\82È\82¢.
+void funcf5(char *ebp, int pxx, int typ, int len); // pxxはダミーで参照されない.
void funcf6(char *ebp, int pxx, int typ, int len);
-void funcf7(char *ebp, int pxx, int typ, int len); // typ\82Ælen\82Í\83_\83~\81[\82Å\8eQ\8fÆ\82³\82ê\82È\82¢.
-// F5\82Ì\8fê\8d\87\81Adecoder\82ª\91Î\89\9e\82·\82éalloc-free\82ð\8c\8b\82Ñ\82Â\82¯\82é\82Ì\82ª\8aÈ\92P\82Å\81Atyp\82âlen\82ð\8ew\92è\95K\90{\82É\82µ\82Ä\82à\83t\83\8d\83\93\83g\83G\83\93\83h\83R\81[\83h\82É\89e\8b¿\82Í\82È\82¢.
+void funcf7(char *ebp, int pxx, int typ, int len); // typとlenはダミーで参照されない.
+// F5の場合、decoderが対応するalloc-freeを結びつけるのが簡単で、typやlenを指定必須にしてもフロントエンドコードに影響はない.
void errHndl(struct Regs *r);
int jitCompiler(unsigned char *dst, unsigned char *dst1, const unsigned char *src, const unsigned char *src1, const unsigned char *src0, struct LabelTable *label, int maxLabels, int level, int debugInfo1, int flags)
-/* IA-32\97p */
-/* \96{\97\88\82È\82ç\82±\82Ì\83\8c\83C\83\84\82Å\82Í\95¶\96@\83`\83F\83b\83N\82µ\82È\82¢ */
+/* IA-32用 */
+/* 本来ならこのレイヤでは文法チェックしない */
{
struct JitCompWork w;
unsigned char *dst00 = dst, *errmsg = "", *enter0 = NULL, *tmp_ucp;
timecount++;
if (timecount >= 64) {
timecount -= 64;
- /* \96¢\8a®\90¬(timeout\83`\83F\83b\83N\83R\81[\83h\82ð\93ü\82ê\82é) */
+ /* 未完成(timeoutチェックコードを入れる) */
}
prefix_continue:
switch (*src) {
}
#if (jitCompA0001_OPTIMIZE_ALIGN != 0)
for (;;) {
- i = ((int)w.dst) & (jitCompA0001_OPTIMIZE_ALIGN - 1); /* ALIGN\82Å\8a\84\82Á\82½\82 \82Ü\82è\82ð\8cv\8eZ */
+ i = ((int)w.dst) & (jitCompA0001_OPTIMIZE_ALIGN - 1); /* ALIGNで割ったあまりを計算 */
if (i == 0) break;
i = jitCompA0001_OPTIMIZE_ALIGN - i;
if (i == 1) { jitCompPutByte1(w.dst, 0x90); j += i; } /* NOP(); */
}
if ((flags & JITC_PHASE1) == 0) {
i = jitCompGetLabelNum(&w, src + 2);
- //printf("i=%06X %06X\n", i, src-src0);
+ //printf("i=%06X %06X¥n", i, src-src0);
if (label[i].opt != 0 && w.err == 0) { w.err = JITC_ERR_LABELREDEF; goto err_w; }
if (w.prefix != 0) { w.err = JITC_ERR_PREFIX; goto err_w; }
label[i].opt = src[1] + 1;
}
cmp0reg = -1;
timecount = 0;
- /* \96¢\8a®\90¬(timeout\83`\83F\83b\83N\83R\81[\83h\82ð\93ü\82ê\82é) */
+ /* 未完成(timeoutチェックコードを入れる) */
break;
case 0x02: /* LIMM */
jitCompA0001_movRxxEax(&w, src[1]);
break;
- case 0x03: /* PLIMM */ /* \96¢\8a®\90¬(pls\82Ü\82Å\91Î\89\9e) */
+ case 0x03: /* PLIMM */ /* 未完成(plsまで対応) */
i = jitCompGetLabelNum(&w, src + 2);
if ((flags & JITC_PHASE1) != 0 && w.err == 0) {
if (label[i].opt == 0) { w.err = JITC_ERR_LABELNODEF; goto err_w; }
w.dst0 = w.dst;
goto prefix_continue;
- case 0x08: /* LMEM */ /* \8a®\90¬ */
+ case 0x08: /* LMEM */ /* 完成 */
i = jitCompGetImm32(src + 2);
if (i == 0x0001) w.err = JITC_ERR_BADTYPE;
if (level < JITC_LV_FASTER) {
jitCompA000_loadRegCacheEdx(&w);
break;
- case 0x09: /* SMEM */ /* \8a®\90¬ */
+ case 0x09: /* SMEM */ /* 完成 */
i = jitCompGetImm32(src + 2);
if (i == 0x0001) w.err = JITC_ERR_BADTYPE;
if (level < JITC_LV_FASTER) {
jitCompA0001_checkLimit(&w, reg1, src[6]);
if (reg0 == 0 /* EAX */)
jitCompA0001_movEaxRxx(&w, src[1]);
- /* \92l\82Ì\94Í\88Í\83`\83F\83b\83N */
+ /* 値の範囲チェック */
i = jitCompA000_convTyp(jitCompGetImm32(src + 2));
switch (i) {
case 0x0002:
jitCompA000_loadRegCacheEdx(&w);
break;
- case 0x0a: /* PLMEM */ /* \8a®\90¬ */
+ case 0x0a: /* PLMEM */ /* 完成 */
i = jitCompGetImm32(src + 2);
if (i != 0x0001) w.err = JITC_ERR_BADTYPE;
if (level < JITC_LV_FASTER) {
}
reg0 = jitCompA000_selectPRegCache(src[1], 0 /* EAX */);
reg1 = jitCompA000_selectPRegCache(src[6], 2 /* EDX */);
- // if (reg0 != 0 /* EAX */ && reg1 == 2 /* EDX */) /* \82±\82ê\82ð\82â\82Á\82Ä\82Í\82¢\82¯\82È\82¢\81I(by K, 2013.08.02) */
+ // if (reg0 != 0 /* EAX */ && reg1 == 2 /* EDX */) /* これをやってはいけない!(by K, 2013.08.02) */
// reg1 = 0; /* EAX */
if (reg0 == reg1 && reg0 != 0) { // bugfix: hinted by yao, 2013.09.14. thanks!
jitCompA000_storePRegCacheAll(&w);
jitCompA000_loadRegCacheEdx(&w);
break;
- case 0x0b: /* PSMEM */ /* \8a®\90¬ */
+ case 0x0b: /* PSMEM */ /* 完成 */
i = jitCompGetImm32(src + 2);
if (i != 0x0001) w.err = JITC_ERR_BADTYPE;
if (level < JITC_LV_FASTER) {
}
reg0 = jitCompA000_selectPRegCache(src[1], 0 /* EAX */);
reg1 = jitCompA000_selectPRegCache(src[6], 2 /* EDX */);
- // if (reg0 != 0 /* EAX */ && reg1 == 2 /* EDX */) /* \82±\82ê\82ð\82â\82Á\82Ä\82Í\82¢\82¯\82È\82¢\81I(by K, 2013.08.02) */
+ // if (reg0 != 0 /* EAX */ && reg1 == 2 /* EDX */) /* これをやってはいけない!(by K, 2013.08.02) */
// reg1 = 0; /* EAX */
if (reg1 == 2 /* EDX */)
jitCompA000_storeRegCacheEdx(&w);
jitCompA000_loadRegCacheEdx(&w);
break;
- case 0x0e: /* PADD */ /* \8a®\90¬ */
+ case 0x0e: /* PADD */ /* 完成 */
if (level < JITC_LV_FASTER) {
- jitCompA0001_checkType0(&w, src[6], jitCompGetImm32(src + 2), 2); // other, alive\83e\83X\83g\82Í\82Æ\82è\82 \82¦\82¸\82µ\82È\82¢.
+ jitCompA0001_checkType0(&w, src[6], jitCompGetImm32(src + 2), 2); // other, aliveテストはとりあえずしない.
cmp0reg = -1;
}
reg0 = jitCompA000_selectPRegCache(src[1], 0 /* EAX */);
cmp0reg = -1;
break;
- case 0x0f: /* PDIF */ /* \96¢\8a®\90¬ */
+ case 0x0f: /* PDIF */ /* 未完成 */
reg0 = jitCompA000_selectRegCache(src[1], 0 /* EAX */);
- jitCompA000_storePRegCacheAll(&w); // \8eè\94²\82«.
+ jitCompA000_storePRegCacheAll(&w); // 手抜き.
jitCompA0001_checkCompPtr(&w, src[6], src[7]);
jitCompA0001_movReg32EbpDisp(&w, reg0, 256 + src[6] * 32 + 0); /* MOV(reg0, [EBP+?]); */
jitCompPutByte1(w.dst, 0x2b); /* SUB(EAX, [EBP+?]); */
reg0 = jitCompA000_selectRegCache(src[1], 0 /* EAX */);
reg1 = jitCompA000_selectRegCache(src[2], -1 /* mem */);
#if (jitCompA0001_USE_R3F_IMM32 != 0)
- if (src[2] == 0x3f) { // SUB\82Ì\82Ý\8aY\93\96.
+ if (src[2] == 0x3f) { // SUBのみ該当.
if (*src != 0x15) w.err = JITC_ERR_REGNUM;
reg2 = jitCompA000_selectRegCache(src[3], -1 /* mem */);
if (reg2 >= 0)
break;
}
#endif
- jitCompA000_storeRegCacheAll(&w); // \8eè\94²\82«.
+ jitCompA000_storeRegCacheAll(&w); // 手抜き.
jitCompA0001_movReg32EbpDisp(&w, 1 /* ECX */, src[3] * 4); /* MOV(ECX, [EBP+?]); */
#if (jitCompA0001_USE_R3F_IMM32 != 0)
if (src[2] == 0x3f) {
if (*src == 0x18) { jitCompPutByte2(w.dst, 0xd3, 0xe0); } /* SHL(EAX, CL); */
if (*src == 0x19) { jitCompPutByte2(w.dst, 0xd3, 0xf8); } /* SAR(EAX, CL); */
jitCompA0001_movRxxEax(&w, src[1]);
- jitCompA000_loadRegCacheAll(&w); // \8eè\94²\82«.
+ jitCompA000_loadRegCacheAll(&w); // 手抜き.
cmp0reg = src[1];
cmp0lev = 1;
break;
if (src[1] >= 0x3f) w.err = JITC_ERR_REGNUM;
if (src[2] >= 0x40) w.err = JITC_ERR_REGNUM;
if (src[3] >= 0x40) w.err = JITC_ERR_REGNUM;
- jitCompA000_storeRegCacheAll(&w); // \8eè\94²\82«.
+ jitCompA000_storeRegCacheAll(&w); // 手抜き.
#if (jitCompA0001_USE_R3F_IMM32 != 0)
if (src[3] == 0x3f) {
jitCompPutByte1(w.dst, 0xb8 | 1); /* MOV(ECX, ?); */
jitCompA0001_movReg32EbpDisp(&w, 0 /* EAX */, src[2] * 4); /* MOV(EAX, [EBP+?]); */
#endif
jitCompPutByte1(w.dst, 0x99); /* CDQ(); */
- /* ECX\82ª\83[\83\8d\82Å\82Í\82È\82¢\82±\82Æ\82ð\8am\94F\82·\82×\82« */
+ /* ECXがゼロではないことを確認すべき */
jitCompPutByte2(w.dst, 0xf7, 0xf9); /* IDIV(ECX); */
if (*src == 0x1a) { jitCompA0001_movEbpDispReg32(&w, src[1] * 4, 0 /* EAX */); }
if (*src == 0x1b) { jitCompA0001_movEbpDispReg32(&w, src[1] * 4, 2 /* EDX */); }
- jitCompA000_loadRegCacheAll(&w); // \8eè\94²\82«.
+ jitCompA000_loadRegCacheAll(&w); // 手抜き.
cmp0reg = -1;
break;
if (level < JITC_LV_FASTEST) {
cmp0reg = -1;
if (level < JITC_LV_FASTER) {
- // typ \82ª\88ê\92v\82µ\82Ä\82¢\82é\82±\82Æ\82ð\8am\94F.
- // pls\82ÆliveSign\82ª\88ê\92v\82µ\82Ä\82¢\82é\82±\82Æ\82ð\8am\94F.
+ // typ が一致していることを確認.
+ // plsとliveSignが一致していることを確認.
- // preg1\82Íp0 <= p <= p1 \82ð\96\9e\82½\82µ\82Ä\82¢\82é\82©\81H.
- // \90V\82µ\82¢p0/p1\82Í\8cÃ\82¢p0\81`p1\82É\93K\8d\87\82µ\82Ä\82¢\82é\82©\81H.
+ // preg1はp0 <= p <= p1 を満たしているか?.
+ // 新しいp0/p1は古いp0〜p1に適合しているか?.
}
}
- case 0x1e: /* PCP */ /* \96¢\8a®\90¬(p1\82Ü\82Å\8a®\90¬) */
+ case 0x1e: /* PCP */ /* 未完成(p1まで完成) */
if (src[1] >= 0x40 || src[2] >= 0x40) w.err = JITC_ERR_PREGNUM;
if (src[2] == 0x3f) w.err = JITC_ERR_PREGNUM;
if (src[1] != 0x3f) {
- /* src[2] == 0xff \82Ì\8fê\8d\87\82É\91Î\89\9e\82Å\82«\82Ä\82È\82¢ */
- jitCompA000_storePRegCacheAll(&w); // \8eè\94²\82«.
+ /* src[2] == 0xff の場合に対応できてない */
+ jitCompA000_storePRegCacheAll(&w); // 手抜き.
for (i = 0; i < 32; i += 4) {
jitCompA0001_movReg32EbpDisp(&w, 0 /* EAX */, 256 + src[2] * 32 + i); /* MOV(EAX, [EBP+?]); */
jitCompA0001_movEbpDispReg32(&w, 256 + src[1] * 32 + i, 0 /* EAX */); /* MOV([EBP+?], EAX); */
}
- jitCompA000_loadPRegCacheAll(&w); // \8eè\94²\82«.
+ jitCompA000_loadPRegCacheAll(&w); // 手抜き.
}
else {
if (level < JITC_LV_FASTER) {
jitCompPutByte3(w.dst, 0x83, 0xf8, 0); /* CMP(EAX, 0); */
jitCompPutByte2(w.dst, 0x0f, 0x85); /* JNE */
jitCompPutImm32(&w, errfnc - (w.dst + 4));
- /* \83Z\83L\83\85\83\8a\83e\83B\83`\83F\83b\83N\82ª\91«\82è\82Ä\82È\82¢!(alive\82Æ\82©) */
+ /* セキュリティチェックが足りてない!(aliveとか) */
}
reg0 = 0; /* EAX */
- jitCompA000_storePRegCacheAll(&w); // \8eè\94²\82«.
+ jitCompA000_storePRegCacheAll(&w); // 手抜き.
jitCompA0001_movReg32EbpDisp(&w, reg0, 256 + src[2] * 32 + 0); /* MOV(EAX, [EBP+?]); */
if (level < JITC_LV_FASTER) {
jitCompPutByte1(w.dst, 0x3b); /* CMP(reg0, [EBP+?]); */
if (jitCompGetImm32(src + 2) == 0) {
if (level < JITC_LV_FASTER)
jitCompA0001_checkType0(&w, src[6], jitCompGetImm32(src + 7), 2);
- jitCompA000_storePRegCacheAll(&w); // \8eè\94²\82«.
+ jitCompA000_storePRegCacheAll(&w); // 手抜き.
for (i = 0; i < 32 - 4; i += 4) {
jitCompA0001_movReg32EbpDisp(&w, 0 /* EAX */, 256 + src[6] * 32 + i); /* MOV(EAX, [EBP+?]); */
if (i == 4) {
jitCompPutByte1(w.dst, 0xb8); /* MOV(EAX, ?); */
jitCompPutImm32(&w, debugInfo1);
jitCompA0001_movEbpDispReg32(&w, 256 + src[1] * 32 + 28, 0 /* EAX */); /* MOV([EBP+?], EAX); */
- jitCompA000_loadPRegCacheAll(&w); // \8eè\94²\82«.
+ jitCompA000_loadPRegCacheAll(&w); // 手抜き.
cmp0reg = -1;
break;
}
if (jitCompGetImm32(src + 7) == 0) {
- jitCompA000_storePRegCacheAll(&w); // \8eè\94²\82«.
+ jitCompA000_storePRegCacheAll(&w); // 手抜き.
for (i = 0; i < 32 - 4; i += 4) {
jitCompA0001_movReg32EbpDisp(&w, 0 /* EAX */, 256 + src[6] * 32 + i); /* MOV(EAX, [EBP+?]); */
if (i == 4) {
jitCompPutByte2(w.dst, 0x31, 0xc0); /* XOR(EAX, EAX); (2) */
jitCompA0001_movEbpDispReg32(&w, 256 + src[1] * 32 + 0, 0 /* EAX */); /* MOV([EBP+?], EAX); (1+1+4) */
}
- jitCompA000_loadPRegCacheAll(&w); // \8eè\94²\82«.
+ jitCompA000_loadPRegCacheAll(&w); // 手抜き.
cmp0reg = -1;
break;
}
reg0 = jitCompA000_selectRegCache(src[2], 0 /* EAX */);
reg1 = jitCompA000_selectRegCache(src[3], -1 /* mem */);
if (src[1] == 0x3f) {
- /* \93Á\8eê\8d\\95¶\83`\83F\83b\83N */
+ /* 特殊構文チェック */
if (w.prefix != 0) { w.err = JITC_ERR_PREFIX; goto err_w; }
if (src[4] != 0x04 || src[5] != 0x3f || src[6] != 0x03 || src[7] != 0x3f) {
w.err = JITC_ERR_IDIOM; goto err_w;
};
#if (jitCompA0001_USE_R3F_CMPJMP != 0)
if (src[1] == 0x3f) {
- /* \93Á\8eê\8d\\95¶\82ð\97\98\97p\82µ\82½\8dÅ\93K\89» */
+ /* 特殊構文を利用した最適化 */
jitCompPutByte2(w.dst, 0x0f, 0x80 | cmpcc_table0[*src - 0x20]);
src += 6;
i = jitCompGetLabelNum(&w, src + 2);
continue;
}
#endif
- /* \88ê\94Ê\93I\82ÈJITC */
+ /* 一般的なJITC */
reg0 = jitCompA000_selectRegCache(src[1], 0 /* EAX */);
jitCompPutByte3(w.dst, 0x0f, 0x90 | cmpcc_table0[*src - 0x20], 0xc0 | reg0); /* SETcc(BYTE(reg0)); */
jitCompPutByte3(w.dst, 0x0f, 0xb6, 0xc0 | reg0 << 3 | reg0); /* MOVZX(reg0, BYTE(reg0)); */
case 0x2c: /* PCMPLE */
case 0x2d: /* PCMPG */
if (src[1] == 0x3f) {
- /* \93Á\8eê\8d\\95¶\83`\83F\83b\83N */
+ /* 特殊構文チェック */
if (w.prefix != 0) { w.err = JITC_ERR_PREFIX; goto err_w; }
if (src[4] != 0x04 || src[5] != 0x3f || src[6] != 0x03 || src[7] != 0x3f) {
w.err = JITC_ERR_IDIOM; goto err_w;
}
}
if (src[2] >= 0x40) w.err = JITC_ERR_PREGNUM;
- jitCompA000_storePRegCacheAll(&w); // \8eè\94²\82«.
+ jitCompA000_storePRegCacheAll(&w); // 手抜き.
if (src[3] != 0xff)
jitCompA0001_checkCompPtr(&w, src[2], src[3]);
jitCompA0001_movReg32EbpDisp(&w, 0 /* EAX */, 256 + src[2] * 32 + 0); /* MOV(EAX, [EBP+?]); */
jitCompA0001_85DispN(&w, 256 + src[3] * 32 + 0, 0);
}
else {
- /* \83k\83\8b\83|\83C\83\93\83^\82Æ\82Ì\94ä\8ar\82Í\82±\82ê\82Å\82¢\82¢\82Ì\82©\81H\82½\82Ô\82ñ\82æ\82\82È\82¢ */
+ /* ヌルポインタとの比較はこれでいいのか?たぶんよくない */
jitCompPutByte3(w.dst, 0x83, 0xf8, 0x00); /* CMP(EAX, 0); */
}
cmp0reg = -1;
case 0x31: /* tfree(old:F5) */
case 0x32: /* malloc(old:F6) */
case 0x33: /* mfree(old:F7) */
- jitCompA000_storeRegCacheAll(&w); // \8eè\94²\82«.
- jitCompA000_storePRegCacheAll(&w); // \8eè\94²\82«.
+ jitCompA000_storeRegCacheAll(&w); // 手抜き.
+ jitCompA000_storePRegCacheAll(&w); // 手抜き.
jitCompPutByte2(w.dst, 0x6a, src[3]); /* PUSH(?); */
jitCompPutByte2(w.dst, 0x6a, src[2]); /* PUSH(?); */
jitCompPutByte2(w.dst, 0x6a, src[1]); /* PUSH(?); */
if (*src == 0x33) j = ((unsigned char *)&funcf7) - (w.dst + 4);
jitCompPutImm32(&w, j);
jitCompPutByte3(w.dst, 0x83, 0xc4, 0x10); /* ADD(ESP,16); */
- jitCompA000_loadRegCacheAll(&w); // \8eè\94²\82«.
- jitCompA000_loadPRegCacheAll(&w); // \8eè\94²\82«.
+ jitCompA000_loadRegCacheAll(&w); // 手抜き.
+ jitCompA000_loadPRegCacheAll(&w); // 手抜き.
cmp0reg = -1;
break;
- case 0x34: /* data (\8eb\92è) */
+ case 0x34: /* data (暫定) */
cmp0reg = -1;
if (w.prefix != 0) { w.err = JITC_ERR_PREFIX; goto err_w; }
int k = jitCompGetImm32(&src[1]), tmpData, bitCount, dataWidth = jitCompA000_dataWidth(k);
continue;
case 0x3c: /* ENTER */
- jitCompA000_storeRegCacheAll(&w); // \8eè\94²\82«.
- jitCompA000_storePRegCacheAll(&w); // \8eè\94²\82«.
+ jitCompA000_storeRegCacheAll(&w); // 手抜き.
+ jitCompA000_storePRegCacheAll(&w); // 手抜き.
jitCompPutByte2(w.dst, 0x6a, src[6]); /* PUSH(?); */
jitCompPutByte2(w.dst, 0x6a, src[5]); /* PUSH(?); */
jitCompPutByte2(w.dst, 0x6a, src[4] & 0x0f); /* PUSH(?); */
j = ((unsigned char *)&func3c) - (w.dst + 4);
jitCompPutImm32(&w, j);
jitCompPutByte3(w.dst, 0x83, 0xc4, 0x20); /* ADD(ESP,32); */
- jitCompA000_loadRegCacheAll(&w); // \8eè\94²\82«.
- jitCompA000_loadPRegCacheAll(&w); // \8eè\94²\82«.
+ jitCompA000_loadRegCacheAll(&w); // 手抜き.
+ jitCompA000_loadPRegCacheAll(&w); // 手抜き.
cmp0reg = -1;
break;
case 0x3d: /* LEAVE */
- jitCompA000_storeRegCacheAll(&w); // \8eè\94²\82«.
- jitCompA000_storePRegCacheAll(&w); // \8eè\94²\82«.
+ jitCompA000_storeRegCacheAll(&w); // 手抜き.
+ jitCompA000_storePRegCacheAll(&w); // 手抜き.
jitCompPutByte2(w.dst, 0x6a, src[6]); /* PUSH(?); */
jitCompPutByte2(w.dst, 0x6a, src[5]); /* PUSH(?); */
jitCompPutByte2(w.dst, 0x6a, src[4] & 0x0f); /* PUSH(?); */
j = ((unsigned char *)&func3d) - (w.dst + 4);
jitCompPutImm32(&w, j);
jitCompPutByte3(w.dst, 0x83, 0xc4, 0x20); /* ADD(ESP,32); */
- jitCompA000_loadRegCacheAll(&w); // \8eè\94²\82«.
- jitCompA000_loadPRegCacheAll(&w); // \8eè\94²\82«.
+ jitCompA000_loadRegCacheAll(&w); // 手抜き.
+ jitCompA000_loadPRegCacheAll(&w); // 手抜き.
cmp0reg = -1;
break;
if (w.err == (JITC_ERR_MASK & JITC_ERR_BADTYPE)) errmsg = "bad type code";
if (w.err == (JITC_ERR_MASK & JITC_ERR_PREFIXFAR)) errmsg = "prefix internal error";
if (w.err == (JITC_ERR_MASK & JITC_ERR_INTERNAL)) errmsg = "general internal error";
- if (*errmsg != '\0') {
- fprintf(stderr, "JITC: %s at %06X (debugInfo0=%d)\n ", errmsg, src - src0, debugInfo0);
+ if (*errmsg != '¥0') {
+ fprintf(stderr, "JITC: %s at %06X (debugInfo0=%d)¥n ", errmsg, src - src0, debugInfo0);
for (i = 0; i < 16; i++)
fprintf(stderr, "%02X ", src[i]);
static char *table[0x30] = {
"PCMPE", "PCMPNE", "PCMPL", "PCMPGE", "PCMPLE", "PCMPG", "??", "EXT" };
errmsg = "??";
if (*src < 0x30) errmsg = table[*src];
- fprintf(stderr, "(%s)\n", errmsg);
+ fprintf(stderr, "(%s)¥n", errmsg);
}
return -1;
}
jitCompA000_storeRegCacheAll(&w);
jitCompA000_storePRegCacheAll(&w);
jitCompPutByte1(w.dst, 0x60); /* PUSHAD(); */
- jitCompPutByte1(w.dst, 0x50); /* PUSH(EAX); */ /* for 16byte-align\81iwin32\82Å\82Í\95s\97v\82È\82Ì\82¾\82¯\82Ç\81AMacOS\82É\82Í\95K\97v\82ç\82µ\82¢\81j */
+ jitCompPutByte1(w.dst, 0x50); /* PUSH(EAX); */ /* for 16byte-align(win32では不要なのだけど、MacOSには必要らしい) */
jitCompPutByte1(w.dst, 0x55); /* PUSH(EBP); */
jitCompPutByte1(w.dst, 0xe8); /* CALL(func); */
int j = ((unsigned char *)func) - (w.dst + 4);
jitCompPutImm32(&w, j);
- jitCompPutByte1(w.dst, 0x58); /* POP(EAX); */ /* \81iwin32\82Å\82Í\95s\97v\82È\82Ì\82¾\82¯\82Ç\81AMacOS\82É\82Í\95K\97v\82ç\82µ\82¢\81j */
+ jitCompPutByte1(w.dst, 0x58); /* POP(EAX); */ /* (win32では不要なのだけど、MacOSには必要らしい) */
jitCompPutByte1(w.dst, 0x58); /* POP(EAX); */
jitCompPutByte1(w.dst, 0x61); /* POPAD(); */
jitCompA000_loadRegCacheAll(&w);
{
r = (struct Regs *) (((char *)r) - jitCompA0001_EBP128);
(*(r->errHndl))(r);
- // \82±\82±\82É\8bA\82Á\82Ä\82«\82Ä\82Í\82¢\82¯\82È\82¢.
+ // ここに帰ってきてはいけない.
}
int jitc0(unsigned char **qq, unsigned char *q1, const unsigned char *p0, const unsigned char *p1, int level, struct LabelTable *label)
for (;;) {
unsigned char cmd[64], *p;
int i, j, k;
- printf("\ndbgr>");
+ printf("¥ndbgr>");
p = fgets(cmd, 64, stdin);
if (p == NULL) break;
- if (cmd[0] == '\0') continue;
+ if (cmd[0] == '¥0') continue;
if (cmd[0] == 'q' && cmd[1] <= ' ') break;
- if (cmd[0] == 'p' && cmd[1] <= ' ' && cmd[1] != '\0') {
+ if (cmd[0] == 'p' && cmd[1] <= ' ' && cmd[1] != '¥0') {
p = &cmd[2];
- while (*p <= ' ' && *p != '\0') p++;
+ while (*p <= ' ' && *p != '¥0') p++;
if (*p == 'R') {
i = dbgrGetRegNum(p + 1);
if (0 <= i && i <= 0x3f) {
- printf("R%02X = 0x%08X = %d\n", i, r->ireg[i], r->ireg[i]);
+ printf("R%02X = 0x%08X = %d¥n", i, r->ireg[i], r->ireg[i]);
}
else
puts("register name error");
};
p = typName[r->preg[i].typ];
}
- printf("P%02X:\n type = %s(%04X), (origin-ptr) = 0x%08X\n", i, p, r->preg[i].typ, r->preg[i].p0);
+ printf("P%02X:¥n type = %s(%04X), (origin-ptr) = 0x%08X¥n", i, p, r->preg[i].typ, r->preg[i].p0);
if (r->preg[i].p != NULL && r->preg[i].p0 != NULL) {
j = jitCompA000_dataWidth(jitCompA000_convTyp(r->preg[i].typ)) >> 3;
if (j <= 0) j = 1;
k = (r->preg[i].p1 - r->preg[i].p0) / j;
- printf(" size = 0x%08X = %d\n", k, k);
+ printf(" size = 0x%08X = %d¥n", k, k);
k = (r->preg[i].p - r->preg[i].p0) / j;
- printf(" pos = 0x%08X = %d\n", k, k);
+ printf(" pos = 0x%08X = %d¥n", k, k);
}
else {
puts(" null pointer");
#ifndef _HDLOAD_JITC
#define _HDLOAD_JITC 1
-/* JITC\82Ì\83t\83\89\83O\8cQ */
-#define JITC_LV_SLOWEST 0 /* \83f\83o\83b\83O\8ex\89\87\82Í\89½\82Å\82à\82â\82é */
-#define JITC_LV_SLOWER 1 /* \83G\83\89\81[\83\82\83W\83\85\81[\83\8b\82Í\83\8c\83|\81[\83g\82Å\82«\82é\82ª\81A\8ds\94Ô\8d\86\82Í\95ª\82©\82ç\82È\82¢\81A\83e\83X\83g\82Í\89ß\8fè */
-#define JITC_LV_SAFE 2 /* \82Æ\82É\82©\82\8e~\82Ü\82é\81A\8fê\8f\8a\82Í\95s\96¾\81A\83e\83X\83g\82Í\95K\97v\8dÅ\8f¬\8cÀ */
-#define JITC_LV_FASTER 4 /* \8fî\95ñ\82Í\90¶\90¬\82·\82é\82ª\83`\83F\83b\83N\82ð\82µ\82È\82¢ */
-#define JITC_LV_FASTEST 5 /* \8fî\95ñ\82·\82ç\90¶\90¬\82µ\82È\82¢ */
+/* 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 /* \83Z\83L\83\85\83\8a\83e\83B\83`\83F\83b\83N\82ð\8fÈ\97ª\82·\82é\81i\8d\82\91¬\8aë\8c¯\83\82\81[\83h\81j */
+#define JITC_SKIPCHECK 0x0002 /* セキュリティチェックを省略する(高速危険モード) */
#define JITC_NOSTARTUP 0x0004
#define JITC_MAXLABELS 4096
#define PTRCTRLSIZ 4096
int osecpuMain(int argc, char **argv)
{
unsigned char *appbin = malloc(APPSIZ1), *up;
- unsigned char *jitbuf = mallocRWE(1024 * 1024); /* \82Æ\82è\82 \82¦\82¸1MB\82Å */
+ unsigned char *jitbuf = mallocRWE(1024 * 1024); /* とりあえず1MBで */
unsigned char *sysjit0 = mallocRWE(SJITSIZ1), *sysjit1 = sysjit0, *sysjit00 = sysjit0;
unsigned char *systmp0 = malloc(SYSTMP0SIZ);
unsigned char *systmp1 = malloc(SYSTMP1SIZ);
}
ptrCtrl[0].size = -2;
- /* syslib\82Ì\93Ç\82Ý\8d\9e\82Ý */
+ /* syslibの読み込み */
unsigned char *syslib = malloc(SYSLIBSIZ1);
int appsiz0, appsiz1;
FILE *fp = fopen(SYSLIB_OSE, "rb");
syslib[0] = '/';
strcpy(syslib + 1, argv[0]);
up = syslib + 1;
- while (*up != '\0') up++;
+ while (*up != '¥0') up++;
while (*up != '/' && *up != 0x5c) up--;
up++;
strcpy(up, SYSLIB_OSE);
fp = fopen(syslib + 1, "rb");
}
if (fp == NULL) {
- fputs("syslib-file fopen error.\n", stderr);
+ fputs("syslib-file fopen error.¥n", stderr);
return 1;
}
appsiz0 = fread(syslib, 1, SYSLIBSIZ1 - 4, fp);
fclose(fp);
if (appsiz0 >= SYSLIBSIZ1 - 4) {
- fputs("syslib-file too large.\n", stderr);
+ fputs("syslib-file too large.¥n", stderr);
return 1;
}
if (syslib[0] == 0x05 && syslib[1] == 0xc1) {
sysjit0 = sysjit1;
i = jitc0(&sysjit1, sysjit00 + SJITSIZ1, syslib + 32, syslib + SYSLIBSIZ1, JITC_LV_SLOWEST + 9, label);
if (i != 0) {
- fputs("syslib-file JITC error.\n", stderr);
+ fputs("syslib-file JITC error.¥n", stderr);
return 1;
}
di1_serial++;
- /* \83A\83v\83\8a\83o\83C\83i\83\8a\82Ì\93Ç\82Ý\8d\9e\82Ý */
+ /* アプリバイナリの読み込み */
if (argc <= 1) { return 0; }
const unsigned char *argv1 = argv[1];
if (argv1[0] == ':' && argv1[2] == ':') {
}
fp = fopen(argv1, "rb");
if (fp == NULL) {
- fputs("app-file load error.\n", stderr);
+ fputs("app-file load error.¥n", stderr);
return 1;
}
appsiz1 = appsiz0 = fread(appbin, 1, APPSIZ1 - 4, fp);
fclose(fp);
if (appsiz0 >= APPSIZ1 - 4) {
- fputs("app-file too large.\n", stderr);
+ fputs("app-file too large.¥n", stderr);
return 1;
}
if (appsiz0 < 3) {
header_error:
- fputs("app-file header error.\n", stderr);
+ fputs("app-file header error.¥n", stderr);
return 1;
}
appsiz1 = -9;
#endif
if (appsiz1 < 0) {
- fputs("unsupported-format(tek5)\n", stderr);
+ fputs("unsupported-format(tek5)¥n", stderr);
return 1;
}
}
void(*jitfunc)(char *);
unsigned char *jp = jitbuf; /* JIT-pointer */
- /* \83t\83\8d\83\93\83g\83G\83\93\83h\83R\81[\83h\82ð\83o\83b\83N\83G\83\93\83h\83R\81[\83h\82É\95Ï\8a·\82·\82é */
+ /* フロントエンドコードをバックエンドコードに変換する */
if ((appbin[2] & 0xf0) != 0) {
systmp0[0] = appbin[0];
systmp0[1] = appbin[1];
regs.preg[0x0c].p = (void *)typLabel;
regs.preg[0x0d].p = opTbl;
jitfunc = (void *)sysjit0;
- (*jitfunc)(((char *)®s) + 128); /* \83T\83C\83Y\82ð\90ß\96ñ\82·\82é\82½\82ß\82ÉEBP\82ð128\83o\83C\83g\82¸\82ç\82· */
+ (*jitfunc)(((char *)®s) + 128); /* サイズを節約するためにEBPを128バイトずらす */
if (regs.ireg[0] != 0) {
jp = regs.preg[2].p - 1;
- fprintf(stderr, "unpack error: %02X (at %06X) (R00=%d)\n", *jp, jp - systmp0, regs.ireg[0]);
+ fprintf(stderr, "unpack error: %02X (at %06X) (R00=%d)¥n", *jp, jp - systmp0, regs.ireg[0]);
if ((argDebug & 2) != 0) {
fp = fopen("debug2.bin", "wb");
fwrite(systmp0, 1, jp - systmp0 + 16, fp);
tm1 = clock() / (double)CLOCKS_PER_SEC;
- /* \83\8c\83W\83X\83^\8f\89\8aú\89» */
+ /* レジスタ初期化 */
for (i = 0; i < 64; i++)
regs.ireg[i] = 0;
for (i = 0; i < 64; i++) {
regs.winClosed = 0;
regs.autoSleep = 0;
regs.setjmpEnv = &setjmpEnv;
- regs.lastConsoleChar = '\n';
+ regs.lastConsoleChar = '¥n';
regs.label = label;
regs.maxLabels = JITC_MAXLABELS;
fclose(fp);
}
- /* JIT\83R\81[\83h\8eÀ\8ds */
+ /* JITコード実行 */
jitfunc = (void *)jitbuf;
if (setjmp(setjmpEnv) == 0)
- (*jitfunc)(((char *)®s) + 128); /* \83T\83C\83Y\82ð\90ß\96ñ\82·\82é\82½\82ß\82ÉEBP\82ð128\83o\83C\83g\82¸\82ç\82· */
+ (*jitfunc)(((char *)®s) + 128); /* サイズを節約するためにEBPを128バイトずらす */
if (regs.autoSleep != 0) {
if (vram != NULL)
drv_flshWin(v_xsiz, v_ysiz, 0, 0);
while (regs.winClosed == 0)
drv_sleep(100);
}
- if (regs.lastConsoleChar != '\n')
- putchar('\n');
+ if (regs.lastConsoleChar != '¥n')
+ putchar('¥n');
tm2 = clock() / (double)CLOCKS_PER_SEC;
- /* \8eÀ\8ds\8c\8b\89Ê\8am\94F\82Ì\82½\82ß\82Ì\83\8c\83W\83X\83^\83_\83\93\83v */
+ /* 実行結果確認のためのレジスタダンプ */
if (searchArg(argc, argv, "verbose:1", 0) != NULL) {
- printf("time: JITC=%.3f[sec], exec=%.3f[sec]\n", tm1 - tm0, tm2 - tm1);
- printf("size: OSECPU=%d, decomp=%d, tmp=%d, native=%d\n", appsiz0, appsiz1, tmpsiz, appsiz2);
- printf("result:\n");
- printf("R00:0x%08X R01:0x%08X R02:0x%08X R03:0x%08X\n", regs.ireg[0], regs.ireg[1], regs.ireg[2], regs.ireg[3]);
+ printf("time: JITC=%.3f[sec], exec=%.3f[sec]¥n", tm1 - tm0, tm2 - tm1);
+ printf("size: OSECPU=%d, decomp=%d, tmp=%d, native=%d¥n", appsiz0, appsiz1, tmpsiz, appsiz2);
+ printf("result:¥n");
+ printf("R00:0x%08X R01:0x%08X R02:0x%08X R03:0x%08X¥n", regs.ireg[0], regs.ireg[1], regs.ireg[2], regs.ireg[3]);
}
#if (USE_DEBUGGER != 0)
dbgrMain(®s);
#ifndef _HDLOAD_OSECPU
#define _HDLOAD_OSECPU 1
-// \83v\83\8d\83W\83F\83N\83g\82Ì\82·\82×\82Ä\82Ì\83t\83@\83C\83\8b\82Å\93Ç\82Ý\8d\9e\82Þ\83w\83b\83_
+// プロジェクトのすべてのファイルで読み込むヘッダ
#include <stdio.h>
#include <string.h>
unsigned char *p0;
};
-struct Ptr { /* 32\83o\83C\83g(=256bit!) */
+struct Ptr { /* 32バイト(=256bit!) */
unsigned char *p;
int typ;
unsigned char *p0, *p1;
int liveSign;
struct PtrCtrl *pls;
- int flags, dummy; /* read/write\82È\82Ç */
+ int flags, dummy; /* read/writeなど */
};
struct LabelTable {
};
struct Regs {
- int ireg[64]; /* 32bit\90®\90\94\83\8c\83W\83X\83^ */
- struct Ptr preg[64]; /* \83|\83C\83\93\83^\83\8c\83W\83X\83^ */
+ int ireg[64]; /* 32bit整数レジスタ */
+ struct Ptr preg[64]; /* ポインタレジスタ */
int debugInfo0, debugInfo1, dmy[2]; /* 2304 */
struct PtrCtrl *ptrCtrl; /* 2320 */
int mapDi1s[16][16];
};
-#define KEY_ENTER '\n'
+#define KEY_ENTER '¥n'
#define KEY_ESC 27
#define KEY_BACKSPACE 8
#define KEY_TAB 9
#if (USE_TEK5 != 0)
-/* tek.c\82ð\88Ú\90A\82·\82é\82Ì\82Í\91å\95Ï\82¾\82Æ\8ev\82Á\82½\82Ì\82Å\81A\92f\94O */
+/* tek.cを移植するのは大変だと思ったので、断念 */
#error "tek is not supported. edit switch.h and set USE_TEK5=0"
// #include "tek.c"
0x00, 0x60, 0x10, 0x08, 0x08, 0x08, 0x08, 0x06, 0x08, 0x08, 0x08, 0x08, 0x10, 0x60, 0x00, 0x00,
0x00, 0x72, 0x8c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x10, 0x28, 0x44, 0x82, 0xfe, 0x82, 0xfe, 0x00, 0x00, 0x00, 0x00, 0x00
-};/* tinyMT\82Ì32bit\94Å\82Ì\83A\83\8b\83S\83\8a\83Y\83\80\82ð\8eg\82Á\82Ä\82¢\82Ü\82· : http://www.math.sci.hiroshima-u.ac.jp/~m-mat/MT/TINYMT/index-jp.html */
+};/* tinyMTの32bit版のアルゴリズムを使っています : http://www.math.sci.hiroshima-u.ac.jp/~m-mat/MT/TINYMT/index-jp.html */
static int iColor1[] = {
0x000000, 0xff0000, 0x00ff00, 0xffff00,
--- /dev/null
+#ifndef _HDLOAD_SWITCH
+#define _HDLOAD_SWITCH 1
+
+/*
+ * このファイルを編集することでコンパイルの仕方を変更できます
+ */
+
+
+/*
+ * CPUのアーキテクチャ
+ * 1 : i386
+ */
+#define JITC_ARCNUM 0x0001
+
+/*
+ * 実行環境となるOSの種類
+ * 1 : Win32
+ * 2 : Mac OS
+ * 3 : blike for Linux
+ */
+#define DRV_OSNUM 0x0001
+
+/*
+ * フロントエンドコード->バックエンドコード を実行するsyslib(decorder)ファイルを指定する。
+ * OSECPUの動作にはsyslib.oseが必要。
+ */
+#define SYSLIB_OSE "syslib.ose"
+#define SIGN1 0xe1
+
+
+
+#define USE_DEBUGGER 1
+#define USE_TEK5 0 //元々は1
+
+#define APPSIZ1 1 * 1024 * 1024 /* とりあえず1MBで */
+#define JITSIZ1 1 * 1024 * 1024 /* とりあえず1MBで */
+#define SJITSIZ1 1 * 1024 * 1024 /* とりあえず1MBで */
+#define SYSLIBSIZ1 1 * 1024 * 1024 /* とりあえず1MBで */
+#define SYSTMP0SIZ 1 * 1024 * 1024 /* とりあえず1MBで */
+#define SYSTMP1SIZ 2 * 1024 * 1024 /* とりあえず2MBで */
+
+#define KEYBUFSIZ 4096
+
+#endif
+