Revision | 97433c0a8cb22d69552482b5a6f58f470495428a (tree) |
---|---|
Time | 2014-07-08 21:50:13 |
Author | hikarupsp <hikarupsp@user...> |
Commiter | hikarupsp |
MALLOC命令を追加。
しかしSMEMがまだないので無意味…
@@ -71,7 +71,7 @@ | ||
71 | 71 | isEnabled = "NO"> |
72 | 72 | </CommandLineArgument> |
73 | 73 | <CommandLineArgument |
74 | - argument = "-bd 30 30 10 1 dst.txt " | |
74 | + argument = "-bd 00 00 10 1 dst.txt " | |
75 | 75 | isEnabled = "YES"> |
76 | 76 | </CommandLineArgument> |
77 | 77 | </CommandLineArguments> |
@@ -247,7 +247,7 @@ int CHNCPU_PrepareBinaryForExecution(CHNCPU_RuntimeEnvironment *env) | ||
247 | 247 | if(op->opCode <= CHNCPU_OPECODE_MAX && opSet->printFuncTable[op->opCode]){ |
248 | 248 | opSet->printFuncTable[op->opCode](env, op, stdout); |
249 | 249 | } else{ |
250 | - printf("Unknown op: 0x%X", op->opCode); | |
250 | + printf("Unknown op: 0x%X\n", op->opCode); | |
251 | 251 | } |
252 | 252 | #endif |
253 | 253 | prefix = 0; |
@@ -16,9 +16,9 @@ | ||
16 | 16 | |
17 | 17 | // DEBUG Flag |
18 | 18 | #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 | |
22 | 22 | #define DEBUG_PRINT_OP_EXECUTING 0 |
23 | 23 | |
24 | 24 | // VM flags |
@@ -231,7 +231,10 @@ int CHNCPU_Op_DATA_Execute(CHNCPU_RuntimeEnvironment *env, CHNCPU_OpTag *op); | ||
231 | 231 | int CHNCPU_Op_DATA_PrintCode(CHNCPU_RuntimeEnvironment *env, CHNCPU_OpTag *op, FILE *file); |
232 | 232 | CHNCPU_Data *CHNCPU_Op_DATA_GetData(CHNCPU_OpTag *op); |
233 | 233 | // |
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 | + | |
235 | 238 | |
236 | 239 | // @bios.c |
237 | 240 | CHNCPU_BIOS *CHNCPU_CreateBIOS(void); |
@@ -92,6 +92,10 @@ int CHNCPU_Op_Init(CHNCPU_OpTableSet *opSet) | ||
92 | 92 | opSet->bindFuncTable[0x2E] = CHNCPU_Op_DATA_BindOperand; |
93 | 93 | opSet->execFuncTable[0x2E] = CHNCPU_Op_DATA_Execute; |
94 | 94 | 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; | |
95 | 99 | return 0; |
96 | 100 | } |
97 | 101 |
@@ -773,7 +777,7 @@ CHNCPU_Data *CHNCPU_Op_DATA_GetData(CHNCPU_OpTag *op) | ||
773 | 777 | // |
774 | 778 | // 32 MALLOC |
775 | 779 | // |
776 | -/* | |
780 | + | |
777 | 781 | int CHNCPU_Op_MALLOC_BindOperand(CHNCPU_RuntimeEnvironment *env, CHNCPU_OpTag *op, unsigned int prefix) |
778 | 782 | { |
779 | 783 | CHNCPU_OpCache_MALLOC *opCache; |
@@ -806,7 +810,7 @@ int CHNCPU_Op_MALLOC_BindOperand(CHNCPU_RuntimeEnvironment *env, CHNCPU_OpTag *o | ||
806 | 810 | |
807 | 811 | int CHNCPU_Op_MALLOC_Execute(CHNCPU_RuntimeEnvironment *env, CHNCPU_OpTag *op) |
808 | 812 | { |
809 | - CHNCPU_OpTag *dataOpTag; | |
813 | + CHNCPU_Data *data; | |
810 | 814 | CHNCPU_OpCache_MALLOC *opCache; |
811 | 815 | ch4_sint type; |
812 | 816 | ch4_uint count; |
@@ -816,20 +820,21 @@ int CHNCPU_Op_MALLOC_Execute(CHNCPU_RuntimeEnvironment *env, CHNCPU_OpTag *op) | ||
816 | 820 | type = env->iReg[opCache->rType]; |
817 | 821 | count = env->iReg[opCache->rCount]; |
818 | 822 | |
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)){ | |
821 | 825 | return -1; |
822 | 826 | } |
823 | 827 | |
828 | + CHNCPU_DATA_AssignDataTagToPReg(env, opCache->p, data); | |
829 | + | |
824 | 830 | return 0; |
825 | 831 | } |
826 | 832 | int CHNCPU_Op_MALLOC_PrintCode(CHNCPU_RuntimeEnvironment *env, CHNCPU_OpTag *op, FILE *file) |
827 | 833 | { |
828 | - CHNCPU_OpCache_LMEM *opCache; | |
834 | + CHNCPU_OpCache_MALLOC *opCache; | |
829 | 835 | |
830 | 836 | 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); | |
832 | 838 | |
833 | 839 | return 0; |
834 | 840 | } |
835 | -*/ | |
\ No newline at end of file |
@@ -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 | |
3 | 5 | 1 1 0 |
4 | -88 c30 90 1 bf 90 | |
6 | +88 c30 c10 1 bf a0 | |
5 | 7 | 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 | |
8 | 10 | 4 bf |
9 | 11 | 3 1 bf |
@@ -52,7 +52,7 @@ void CHNCPU_DumpPReg(CHNCPU_RuntimeEnvironment *env) | ||
52 | 52 | if(env->pReg[i].mindex != CHNCPU_MemoryIndex_INVALID){ |
53 | 53 | printf("P%02X: Type:%2X mem[%d][%d]", i, env->pReg[i].type, env->pReg[i].mindex, env->pReg[i].pindex); |
54 | 54 | } 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); | |
56 | 56 | } |
57 | 57 | putchar('\n'); |
58 | 58 | regs++; |