• R/O
  • HTTP
  • SSH
  • HTTPS

Commit

Tags
No Tags

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

Commit MetaInfo

Revisão97433c0a8cb22d69552482b5a6f58f470495428a (tree)
Hora2014-07-08 21:50:13
Autorhikarupsp <hikarupsp@user...>
Commiterhikarupsp

Mensagem de Log

MALLOC命令を追加。
しかしSMEMがまだないので無意味…

Mudança Sumário

Diff

--- a/chncpu.xcodeproj/xcuserdata/hikaru.xcuserdatad/xcschemes/chncpu.xcscheme
+++ b/chncpu.xcodeproj/xcuserdata/hikaru.xcuserdatad/xcschemes/chncpu.xcscheme
@@ -71,7 +71,7 @@
7171 isEnabled = "NO">
7272 </CommandLineArgument>
7373 <CommandLineArgument
74- argument = "-bd 30 30 10 1 dst.txt "
74+ argument = "-bd 00 00 10 1 dst.txt "
7575 isEnabled = "YES">
7676 </CommandLineArgument>
7777 </CommandLineArguments>
--- a/chncpu/chncpu.c
+++ b/chncpu/chncpu.c
@@ -247,7 +247,7 @@ int CHNCPU_PrepareBinaryForExecution(CHNCPU_RuntimeEnvironment *env)
247247 if(op->opCode <= CHNCPU_OPECODE_MAX && opSet->printFuncTable[op->opCode]){
248248 opSet->printFuncTable[op->opCode](env, op, stdout);
249249 } else{
250- printf("Unknown op: 0x%X", op->opCode);
250+ printf("Unknown op: 0x%X\n", op->opCode);
251251 }
252252 #endif
253253 prefix = 0;
--- a/chncpu/chncpu.h
+++ b/chncpu/chncpu.h
@@ -16,9 +16,9 @@
1616
1717 // DEBUG Flag
1818 #define DEBUG_PRINT_APPBIN_BEFORE_EXECUTION 0
19-#define DEBUG_PRINT_IREG_AFTER_EXECUTION 0
20-#define DEBUG_PRINT_PREG_AFTER_EXECUTION 0
21-#define DEBUG_PRINT_OP_BINDING 0
19+#define DEBUG_PRINT_IREG_AFTER_EXECUTION 1
20+#define DEBUG_PRINT_PREG_AFTER_EXECUTION 1
21+#define DEBUG_PRINT_OP_BINDING 1
2222 #define DEBUG_PRINT_OP_EXECUTING 0
2323
2424 // VM flags
@@ -231,7 +231,10 @@ int CHNCPU_Op_DATA_Execute(CHNCPU_RuntimeEnvironment *env, CHNCPU_OpTag *op);
231231 int CHNCPU_Op_DATA_PrintCode(CHNCPU_RuntimeEnvironment *env, CHNCPU_OpTag *op, FILE *file);
232232 CHNCPU_Data *CHNCPU_Op_DATA_GetData(CHNCPU_OpTag *op);
233233 //
234-int CHNCPU_Op_Prefix2F_PrintWikiDoc(int opCode, FILE *file);
234+int CHNCPU_Op_MALLOC_BindOperand(CHNCPU_RuntimeEnvironment *env, CHNCPU_OpTag *op, unsigned int prefix);
235+int CHNCPU_Op_MALLOC_Execute(CHNCPU_RuntimeEnvironment *env, CHNCPU_OpTag *op);
236+int CHNCPU_Op_MALLOC_PrintCode(CHNCPU_RuntimeEnvironment *env, CHNCPU_OpTag *op, FILE *file);
237+
235238
236239 // @bios.c
237240 CHNCPU_BIOS *CHNCPU_CreateBIOS(void);
--- a/chncpu/opcode.c
+++ b/chncpu/opcode.c
@@ -92,6 +92,10 @@ int CHNCPU_Op_Init(CHNCPU_OpTableSet *opSet)
9292 opSet->bindFuncTable[0x2E] = CHNCPU_Op_DATA_BindOperand;
9393 opSet->execFuncTable[0x2E] = CHNCPU_Op_DATA_Execute;
9494 opSet->printFuncTable[0x2E] = CHNCPU_Op_DATA_PrintCode;
95+ // MALLOC
96+ opSet->bindFuncTable[0x32] = CHNCPU_Op_MALLOC_BindOperand;
97+ opSet->execFuncTable[0x32] = CHNCPU_Op_MALLOC_Execute;
98+ opSet->printFuncTable[0x32] = CHNCPU_Op_MALLOC_PrintCode;
9599 return 0;
96100 }
97101
@@ -773,7 +777,7 @@ CHNCPU_Data *CHNCPU_Op_DATA_GetData(CHNCPU_OpTag *op)
773777 //
774778 // 32 MALLOC
775779 //
776-/*
780+
777781 int CHNCPU_Op_MALLOC_BindOperand(CHNCPU_RuntimeEnvironment *env, CHNCPU_OpTag *op, unsigned int prefix)
778782 {
779783 CHNCPU_OpCache_MALLOC *opCache;
@@ -806,7 +810,7 @@ int CHNCPU_Op_MALLOC_BindOperand(CHNCPU_RuntimeEnvironment *env, CHNCPU_OpTag *o
806810
807811 int CHNCPU_Op_MALLOC_Execute(CHNCPU_RuntimeEnvironment *env, CHNCPU_OpTag *op)
808812 {
809- CHNCPU_OpTag *dataOpTag;
813+ CHNCPU_Data *data;
810814 CHNCPU_OpCache_MALLOC *opCache;
811815 ch4_sint type;
812816 ch4_uint count;
@@ -816,20 +820,21 @@ int CHNCPU_Op_MALLOC_Execute(CHNCPU_RuntimeEnvironment *env, CHNCPU_OpTag *op)
816820 type = env->iReg[opCache->rType];
817821 count = env->iReg[opCache->rCount];
818822
819- dataOpTag = CHNCPU_Op_DATA_CreateEmptyData();
820- if(CHNCPU_Op_DATA_AllocateRawDataMemory(dataOpTag, type, count, &env->errFlags)){
823+ data = CHNCPU_DATA_CreateEmptyData();
824+ if(CHNCPU_DATA_AllocateRawDataMemory(data, type, count, &env->errFlags)){
821825 return -1;
822826 }
823827
828+ CHNCPU_DATA_AssignDataTagToPReg(env, opCache->p, data);
829+
824830 return 0;
825831 }
826832 int CHNCPU_Op_MALLOC_PrintCode(CHNCPU_RuntimeEnvironment *env, CHNCPU_OpTag *op, FILE *file)
827833 {
828- CHNCPU_OpCache_LMEM *opCache;
834+ CHNCPU_OpCache_MALLOC *opCache;
829835
830836 opCache = op->opCache;
831- fprintf(file, "LMEM(p:0x%02X, pType:0x%X, pDiff:%d, r:%02X, bitDst:%d);\n", opCache->p, opCache->pType, opCache->pDiff, opCache->r, opCache->bitDst);
837+ fprintf(file, "MALLOC(rType:%02X, bitType:%d, rCount:%02X, bitCount:%d, p:%02X);\n", opCache->rType, opCache->bitType, opCache->rCount, opCache->bitCount, opCache->p);
832838
833839 return 0;
834840 }
835-*/
\ No newline at end of file
--- a/chncpu/test.hex
+++ b/chncpu/test.hex
@@ -1,9 +1,11 @@
1-2 0 0 90
2-2 1 1 90
1+2 c10 0 a0
2+c32 0 a0 c30 a0 0
3+2 0 0 a0
4+2 1 1 a0
35 1 1 0
4-88 c30 90 1 bf 90
6+88 c30 c10 1 bf a0
57 5 0 bf
6-94 0 1 0 90
7-a2 0 c30 90 bf 90
8+94 0 1 0 a0
9+a2 0 c30 c20 bf a0
810 4 bf
911 3 1 bf
--- a/debug.c
+++ b/debug.c
@@ -52,7 +52,7 @@ void CHNCPU_DumpPReg(CHNCPU_RuntimeEnvironment *env)
5252 if(env->pReg[i].mindex != CHNCPU_MemoryIndex_INVALID){
5353 printf("P%02X: Type:%2X mem[%d][%d]", i, env->pReg[i].type, env->pReg[i].mindex, env->pReg[i].pindex);
5454 } else{
55- printf("P%02X: Type:%2X %s[%d]", i, env->pReg[i].type, env->pReg[i].data->filePath, env->pReg[i].pindex);
55+ printf("P%02X: Type:%2X %s[%d]\t(Len:%d)", i, env->pReg[i].type, env->pReg[i].data->filePath, env->pReg[i].pindex, env->pReg[i].data->count);
5656 }
5757 putchar('\n');
5858 regs++;