• 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

Revisiónafbd9e7d9e1b82ec62469069f25c9157b5704a07 (tree)
Tiempo2014-06-29 18:46:11
Autorhikarupsp <hikarupsp@user...>
Commiterhikarupsp

Log Message

オペコードリスト自動生成を追加

Cambiar Resumen

Diferencia incremental

--- a/chncpu.xcodeproj/xcuserdata/hikaru.xcuserdatad/xcschemes/chncpu.xcscheme
+++ b/chncpu.xcodeproj/xcuserdata/hikaru.xcuserdatad/xcschemes/chncpu.xcscheme
@@ -59,9 +59,13 @@
5959 </BuildableProductRunnable>
6060 <CommandLineArguments>
6161 <CommandLineArgument
62- argument = "test.hex"
62+ argument = "-e test.hex"
6363 isEnabled = "YES">
6464 </CommandLineArgument>
65+ <CommandLineArgument
66+ argument = "-f i"
67+ isEnabled = "NO">
68+ </CommandLineArgument>
6569 </CommandLineArguments>
6670 <AdditionalOptions>
6771 </AdditionalOptions>
--- a/chncpu/chncpu.c
+++ b/chncpu/chncpu.c
@@ -8,22 +8,86 @@
88
99 #include "chncpu.h"
1010
11-int main(int argc, const char * argv[])
11+int main(int argc, const char *argv[])
1212 {
1313 CHNCPU_RuntimeEnvironment *env;
14+ CHNCPU_VMArgs *vmArgs;
15+
16+ vmArgs = bindVMArgs(argc, argv);
17+ env = CHNCPU_CreateRuntimeEnvironment(CHNCPU_CreateOpTableSet(), CHNCPU_CreateBIOS());
18+
19+ if(vmArgs->VMFlags & CHNCPU_VM_FLAG_PRINT_OPLIST){
20+ printOpTableWikiDoc(env);
21+ return 0;
22+ }
1423
15- if(argc < 2){
16- puts("chncpu:Usage > chncpu filepath [flags]\n");
17- exit(EXIT_SUCCESS);
18- }
19- env = CHNCPU_CreateRuntimeEnvironment(CHNCPU_CreateOpTableSet(), CHNCPU_CreateBIOS());
20- CHNCPU_LoadBinaryFromHexStringFilePath(env, argv[1]);
24+ CHNCPU_LoadBinaryFromHexStringFilePath(env, vmArgs->appPath);
2125 if(!env->errFlags){
2226 CHNCPU_Execute(env);
2327 }
2428 return 0;
2529 }
2630
31+CHNCPU_VMArgs *bindVMArgs(int argc, const char *argv[])
32+{
33+ int i;
34+ const char *s;
35+ CHNCPU_VMArgs *args = malloc(sizeof(CHNCPU_VMArgs));
36+ if(!args){
37+ puts("bindVMArgs: malloc error.");
38+ exit(EXIT_FAILURE);
39+ }
40+
41+ args->appPath = NULL;
42+ args->VMFlags = 0;
43+
44+ for(i = 0; i < argc; i++){
45+ s = argv[i];
46+ if(strcmp("-e", s) == 0){
47+ i++;
48+ if(i < argc){
49+ args->appPath = argv[i];
50+ } else{
51+ argc = 0;
52+ }
53+ } else if(strcmp("-f", s) == 0){
54+ i++;
55+ if(i < argc){
56+ s = argv[i];
57+ for(;*s != '\0'; s++){
58+ if(*s == 'i'){
59+ args->VMFlags |= CHNCPU_VM_FLAG_PRINT_OPLIST;
60+ } else{
61+ printf("bindVMArgs: unknown flag %c.\n", *s);
62+ argc = 0;
63+ }
64+ }
65+ } else{
66+ argc = 0;
67+ }
68+ }
69+ }
70+
71+ if(argc < 3){
72+ puts("chncpu:Usage > chncpu [-e appPath] [-f flags]");
73+ exit(EXIT_FAILURE);
74+ }
75+
76+ return args;
77+}
78+
79+void printOpTableWikiDoc(CHNCPU_RuntimeEnvironment *env)
80+{
81+ int i;
82+
83+ puts(", mnemonic, OpCode(Hex), OpCode(ch4_uint Hex), +!, +2, +3, +4, +5, +6, +7, code, type");
84+ for(i = 0; i <= CHNCPU_OPECODE_MAX; i++){
85+ if(env->opSet->docFuncTable[i]){
86+ env->opSet->docFuncTable[i](i, stdout);
87+ }
88+ }
89+}
90+
2791 int decodeHexString(char *src0, char *src1, unsigned char *dst0, unsigned char *dst1)
2892 {
2993 // ASCII文字のみ対応
--- a/chncpu/chncpu.h
+++ b/chncpu/chncpu.h
@@ -11,6 +11,7 @@
1111
1212 #include <stdio.h>
1313 #include <stdlib.h>
14+#include <string.h>
1415 #include "ch4.h"
1516
1617 // DEBUG Flag
@@ -18,6 +19,10 @@
1819 #define DEBUG_PRINT_OP_BINDING 0
1920 #define DEBUG_PRINT_OP_EXECUTING 0
2021
22+// VM flags
23+#define CHNCPU_VM_FLAG_PRINT_OPLIST 0x01
24+
25+
2126 // Settings
2227 #define SIZE_TMPDATA (1024 * 1024 * 1)
2328
@@ -83,10 +88,12 @@
8388 typedef struct _CHNCPU_OP_TAG CHNCPU_OpTag;
8489 typedef struct _CHNCPU_BIOS CHNCPU_BIOS;
8590 typedef struct _CHNCPU_OP_TABLE_SET CHNCPU_OpTableSet;
86-typedef struct _CHNCPU_RUN_TIME_ENVIRONMENT CHNCPU_RuntimeEnvironment;
8791 typedef struct _CHNCPU_LABEL_TAG CHNCPU_LabelTag;
8892 typedef struct _CHNCPU_LABEL_SET CHNCPU_LabelSet;
8993 typedef struct _CHNCPU_POINTER_TAG CHNCPU_PointerTag;
94+typedef struct _CHNCPU_RUN_TIME_ENVIRONMENT CHNCPU_RuntimeEnvironment;
95+typedef struct _CHNCPU_VM_ARGS CHNCPU_VMArgs;
96+
9097
9198
9299 struct _CHNCPU_OP_TAG {
@@ -104,6 +111,7 @@ struct _CHNCPU_OP_TABLE_SET {
104111 int (*bindFuncTable[CHNCPU_OPECODE_MAX + 1])(CHNCPU_RuntimeEnvironment *env, CHNCPU_OpTag *op, unsigned int prefix);
105112 int (*execFuncTable[CHNCPU_OPECODE_MAX + 1])(CHNCPU_RuntimeEnvironment *env, CHNCPU_OpTag *op);
106113 int (*printFuncTable[CHNCPU_OPECODE_MAX + 1])(CHNCPU_RuntimeEnvironment *env, CHNCPU_OpTag *op, FILE *file);
114+ int (*docFuncTable[CHNCPU_OPECODE_MAX + 1])(int opCode, FILE *file);
107115 };
108116
109117 struct _CHNCPU_LABEL_TAG {
@@ -138,7 +146,14 @@ struct _CHNCPU_RUN_TIME_ENVIRONMENT {
138146 int currentLabel;
139147 };
140148
149+struct _CHNCPU_VM_ARGS {
150+ const char *appPath;
151+ unsigned int VMFlags;
152+};
153+
141154 // @chncpu.c
155+CHNCPU_VMArgs *bindVMArgs(int argc, const char *argv[]);
156+void printOpTableWikiDoc(CHNCPU_RuntimeEnvironment *env);
142157 int decodeHexString(char *src0, char *src1, unsigned char *dst0, unsigned char *dst1);
143158 CHNCPU_RuntimeEnvironment *CHNCPU_CreateRuntimeEnvironment(CHNCPU_OpTableSet *opSet, CHNCPU_BIOS *bios);
144159 int CHNCPU_LoadBinaryFromHexStringFilePath(CHNCPU_RuntimeEnvironment *env, const char *path);
@@ -152,28 +167,46 @@ int CHNCPU_AdjustValueForBit(CHNCPU_RuntimeEnvironment *env, int *value, ch4_uin
152167 // @opcode.c
153168 CHNCPU_OpTableSet *CHNCPU_CreateOpTableSet(void);
154169 int CHNCPU_Op_Init(CHNCPU_OpTableSet *env);
170+//
171+int CHNCPU_Op_NOP_PrintWikiDoc(int opCode, FILE *file);
172+//
155173 int CHNCPU_Op_LB_BindOperand(CHNCPU_RuntimeEnvironment *env, CHNCPU_OpTag *op, unsigned int prefix);
156174 int CHNCPU_Op_LB_Execute(CHNCPU_RuntimeEnvironment *env, CHNCPU_OpTag *op);
157175 int CHNCPU_Op_LB_PrintCode(CHNCPU_RuntimeEnvironment *env, CHNCPU_OpTag *op, FILE *file);
176+int CHNCPU_Op_LB_PrintWikiDoc(int opCode, FILE *file);
177+//
158178 int CHNCPU_Op_LIMM_BindOperand(CHNCPU_RuntimeEnvironment *env, CHNCPU_OpTag *op, unsigned int prefix);
159179 int CHNCPU_Op_LIMM_Execute(CHNCPU_RuntimeEnvironment *env, CHNCPU_OpTag *op);
160180 int CHNCPU_Op_LIMM_PrintCode(CHNCPU_RuntimeEnvironment *env, CHNCPU_OpTag *op, FILE *file);
181+int CHNCPU_Op_LIMM_PrintWikiDoc(int opCode, FILE *file);
182+//
161183 int CHNCPU_Op_PLIMM_BindOperand(CHNCPU_RuntimeEnvironment *env, CHNCPU_OpTag *op, unsigned int prefix);
162184 int CHNCPU_Op_PLIMM_Execute(CHNCPU_RuntimeEnvironment *env, CHNCPU_OpTag *op);
163185 int CHNCPU_Op_PLIMM_PrintCode(CHNCPU_RuntimeEnvironment *env, CHNCPU_OpTag *op, FILE *file);
186+int CHNCPU_Op_PLIMM_PrintWikiDoc(int opCode, FILE *file);
187+//
164188 int CHNCPU_Op_CND_BindOperand(CHNCPU_RuntimeEnvironment *env, CHNCPU_OpTag *op, unsigned int prefix);
165189 int CHNCPU_Op_CND_Execute(CHNCPU_RuntimeEnvironment *env, CHNCPU_OpTag *op);
166190 int CHNCPU_Op_CND_PrintCode(CHNCPU_RuntimeEnvironment *env, CHNCPU_OpTag *op, FILE *file);
191+int CHNCPU_Op_CND_PrintWikiDoc(int opCode, FILE *file);
192+//
167193 int CHNCPU_Op_CALLBIOS_BindOperand(CHNCPU_RuntimeEnvironment *env, CHNCPU_OpTag *op, unsigned int prefix);
168194 int CHNCPU_Op_CALLBIOS_Execute(CHNCPU_RuntimeEnvironment *env, CHNCPU_OpTag *op);
169195 int CHNCPU_Op_CALLBIOS_PrintCode(CHNCPU_RuntimeEnvironment *env, CHNCPU_OpTag *op, FILE *file);
196+int CHNCPU_Op_CALLBIOS_PrintWikiDoc(int opCode, FILE *file);
197+//
170198 int CHNCPU_Op_TernaryReg_BindOperand(CHNCPU_RuntimeEnvironment *env, CHNCPU_OpTag *op, unsigned int prefix);
171199 int CHNCPU_Op_TernaryRegBitwise_Execute(CHNCPU_RuntimeEnvironment *env, CHNCPU_OpTag *op);
172200 int CHNCPU_Op_TernaryRegArithmetic_Execute(CHNCPU_RuntimeEnvironment *env, CHNCPU_OpTag *op);
173201 int CHNCPU_Op_TernaryReg_PrintCode(CHNCPU_RuntimeEnvironment *env, CHNCPU_OpTag *op, FILE *file);
202+int CHNCPU_Op_TernaryReg_PrintWikiDoc(int opCode, FILE *file);
203+//
174204 int CHNCPU_Op_CompareIReg_BindOperand(CHNCPU_RuntimeEnvironment *env, CHNCPU_OpTag *op, unsigned int prefix);
175205 int CHNCPU_Op_CompareIReg_Execute(CHNCPU_RuntimeEnvironment *env, CHNCPU_OpTag *op);
176206 int CHNCPU_Op_CompareIReg_PrintCode(CHNCPU_RuntimeEnvironment *env, CHNCPU_OpTag *op, FILE *file);
207+int CHNCPU_Op_CompareIReg_PrintWikiDoc(int opCode, FILE *file);
208+//
209+int CHNCPU_Op_Prefix2F_PrintWikiDoc(int opCode, FILE *file);
177210
178211 // @bios.c
179212 CHNCPU_BIOS *CHNCPU_CreateBIOS(void);
--- a/chncpu/opcode.c
+++ b/chncpu/opcode.c
@@ -32,60 +32,89 @@ int CHNCPU_Op_Init(CHNCPU_OpTableSet *opSet)
3232 opSet->bindFuncTable[i] = NULL;
3333 opSet->execFuncTable[i] = NULL;
3434 opSet->printFuncTable[i] = NULL;
35+ opSet->docFuncTable[i] = NULL;
3536 }
3637
38+ // NOP
39+ opSet->docFuncTable[0x00] = CHNCPU_Op_NOP_PrintWikiDoc;
40+
3741 // LB
3842 opSet->bindFuncTable[0x01] = CHNCPU_Op_LB_BindOperand;
3943 opSet->execFuncTable[0x01] = CHNCPU_Op_LB_Execute;
4044 opSet->printFuncTable[0x01] = CHNCPU_Op_LB_PrintCode;
45+ opSet->docFuncTable[0x01] = CHNCPU_Op_LB_PrintWikiDoc;
4146
4247 // LIMM
4348 opSet->bindFuncTable[0x02] = CHNCPU_Op_LIMM_BindOperand;
4449 opSet->execFuncTable[0x02] = CHNCPU_Op_LIMM_Execute;
4550 opSet->printFuncTable[0x02] = CHNCPU_Op_LIMM_PrintCode;
51+ opSet->docFuncTable[0x02] = CHNCPU_Op_LIMM_PrintWikiDoc;
4652
47- // LIMM
53+ // PLIMM
4854 opSet->bindFuncTable[0x03] = CHNCPU_Op_PLIMM_BindOperand;
4955 opSet->execFuncTable[0x03] = CHNCPU_Op_PLIMM_Execute;
5056 opSet->printFuncTable[0x03] = CHNCPU_Op_PLIMM_PrintCode;
57+ opSet->docFuncTable[0x03] = CHNCPU_Op_PLIMM_PrintWikiDoc;
5158
5259 // CND
5360 opSet->bindFuncTable[0x04] = CHNCPU_Op_CND_BindOperand;
5461 opSet->execFuncTable[0x04] = CHNCPU_Op_CND_Execute;
5562 opSet->printFuncTable[0x04] = CHNCPU_Op_CND_PrintCode;
63+ opSet->docFuncTable[0x04] = CHNCPU_Op_CND_PrintWikiDoc;
5664
5765 // CALLBIOS
5866 opSet->bindFuncTable[0x05] = CHNCPU_Op_CALLBIOS_BindOperand;
5967 opSet->execFuncTable[0x05] = CHNCPU_Op_CALLBIOS_Execute;
6068 opSet->printFuncTable[0x05] = CHNCPU_Op_CALLBIOS_PrintCode;
69+ opSet->docFuncTable[0x05] = CHNCPU_Op_CALLBIOS_PrintWikiDoc;
6170
6271 // TernaryRegBitwise
6372 for(i = 0x10; i <= 0x12; i++){
6473 opSet->bindFuncTable[i] = CHNCPU_Op_TernaryReg_BindOperand;
6574 opSet->execFuncTable[i] = CHNCPU_Op_TernaryRegBitwise_Execute;
6675 opSet->printFuncTable[i] = CHNCPU_Op_TernaryReg_PrintCode;
76+ opSet->docFuncTable[i] = CHNCPU_Op_TernaryReg_PrintWikiDoc;
6777 }
6878 // TernaryRegArithmetic
6979 for(i = 0x14; i <= 0x16; i++){
7080 opSet->bindFuncTable[i] = CHNCPU_Op_TernaryReg_BindOperand;
7181 opSet->execFuncTable[i] = CHNCPU_Op_TernaryRegArithmetic_Execute;
7282 opSet->printFuncTable[i] = CHNCPU_Op_TernaryReg_PrintCode;
83+ opSet->docFuncTable[i] = CHNCPU_Op_TernaryReg_PrintWikiDoc;
7384 }
7485 for(i = 0x18; i <= 0x1B; i++){
7586 opSet->bindFuncTable[i] = CHNCPU_Op_TernaryReg_BindOperand;
7687 opSet->execFuncTable[i] = CHNCPU_Op_TernaryRegArithmetic_Execute;
7788 opSet->printFuncTable[i] = CHNCPU_Op_TernaryReg_PrintCode;
89+ opSet->docFuncTable[i] = CHNCPU_Op_TernaryReg_PrintWikiDoc;
7890 }
79- //
91+ // CompareIReg
8092 for(i = 0x20; i <= 0x27; i++){
8193 opSet->bindFuncTable[i] = CHNCPU_Op_CompareIReg_BindOperand;
8294 opSet->execFuncTable[i] = CHNCPU_Op_CompareIReg_Execute;
8395 opSet->printFuncTable[i] = CHNCPU_Op_CompareIReg_PrintCode;
96+ opSet->docFuncTable[i] = CHNCPU_Op_CompareIReg_PrintWikiDoc;
8497 }
98+ // Prefix2F
99+ opSet->docFuncTable[0x2f] = CHNCPU_Op_Prefix2F_PrintWikiDoc;
85100 return 0;
86101 }
87102
88103 //
104+// 00 NOP
105+//
106+int CHNCPU_Op_NOP_PrintWikiDoc(int opCode, FILE *file)
107+{
108+ fprintf(file, ", %s, %02X, %X, %s, %s, %s, %s, %s, %s, %s, %s, %s\n",
109+ "NOP",
110+ 0x00, 0x00,
111+ "", "", "", "", "", "", "",
112+ "No operation", "");
113+
114+ return 0;
115+}
116+
117+//
89118 // 01 LB
90119 //
91120 typedef struct _CHNCPU_OP_CACHE_LB CHNCPU_OpCache_LB;
@@ -135,6 +164,17 @@ int CHNCPU_Op_LB_PrintCode(CHNCPU_RuntimeEnvironment *env, CHNCPU_OpTag *op, FIL
135164 return 0;
136165 }
137166
167+int CHNCPU_Op_LB_PrintWikiDoc(int opCode, FILE *file)
168+{
169+ fprintf(file, ", %s, %02X, %X, %s, %s, %s, %s, %s, %s, %s, %s, %s\n",
170+ "LB",
171+ 0x01, 0x01,
172+ "labelID", "opt", "", "", "", "", "",
173+ "#labelID;", "");
174+
175+ return 0;
176+}
177+
138178 //
139179 // 02 LIMM
140180 //
@@ -195,6 +235,17 @@ int CHNCPU_Op_LIMM_PrintCode(CHNCPU_RuntimeEnvironment *env, CHNCPU_OpTag *op, F
195235 return 0;
196236 }
197237
238+int CHNCPU_Op_LIMM_PrintWikiDoc(int opCode, FILE *file)
239+{
240+ fprintf(file, ", %s, %02X, %X, %s, %s, %s, %s, %s, %s, %s, %s, %s\n",
241+ "LIMM",
242+ 0x02, 0x02,
243+ "(sint)imm", "r", "bit", "", "", "", "",
244+ "reg = imm;", "");
245+
246+ return 0;
247+}
248+
198249 //
199250 // 03 PLIMM
200251 //
@@ -259,6 +310,17 @@ int CHNCPU_Op_PLIMM_PrintCode(CHNCPU_RuntimeEnvironment *env, CHNCPU_OpTag *op,
259310 return 0;
260311 }
261312
313+int CHNCPU_Op_PLIMM_PrintWikiDoc(int opCode, FILE *file)
314+{
315+ fprintf(file, ", %s, %02X, %X, %s, %s, %s, %s, %s, %s, %s, %s, %s\n",
316+ "PLIMM",
317+ 0x03, 0x03,
318+ "labelID", "p", "", "", "", "", "",
319+ "p = #labelID;", "");
320+
321+ return 0;
322+}
323+
262324 //
263325 // 04 CND
264326 //
@@ -309,6 +371,17 @@ int CHNCPU_Op_CND_PrintCode(CHNCPU_RuntimeEnvironment *env, CHNCPU_OpTag *op, FI
309371 return 0;
310372 }
311373
374+int CHNCPU_Op_CND_PrintWikiDoc(int opCode, FILE *file)
375+{
376+ fprintf(file, ", %s, %02X, %X, %s, %s, %s, %s, %s, %s, %s, %s, %s\n",
377+ "CND",
378+ 0x04, 0x04,
379+ "r", "", "", "", "", "", "",
380+ "if((reg0R & 1) == 0){ skip nextOp; }", "Prefix");
381+
382+ return 0;
383+}
384+
312385 //
313386 // 05 CALLBIOS
314387 //
@@ -370,7 +443,16 @@ int CHNCPU_Op_CALLBIOS_PrintCode(CHNCPU_RuntimeEnvironment *env, CHNCPU_OpTag *o
370443 return 0;
371444 }
372445
373-
446+int CHNCPU_Op_CALLBIOS_PrintWikiDoc(int opCode, FILE *file)
447+{
448+ fprintf(file, ", %s, %02X, %X, %s, %s, %s, %s, %s, %s, %s, %s, %s\n",
449+ "CALLBIOS",
450+ 0x05, 0x05,
451+ "fid", "...", "", "", "", "", "",
452+ "", "");
453+
454+ return 0;
455+}
374456
375457 //
376458 // Ternary Register Operation
@@ -521,6 +603,23 @@ char *CHNCPU_Op_TernaryReg_MnemonicList0[12] = {
521603 "DIV",
522604 "MOD"
523605 };
606+
607+char *CHNCPU_Op_TernaryReg_CodeList0[12] = {
608+ // 10 - 1B
609+ "r0 = r1 | r2;",
610+ "r0 = r1 ^ r2;",
611+ "r0 = r1 & r2;",
612+ "",
613+ "r0 = r1 + r2;",
614+ "r0 = r1 - r2;",
615+ "r0 = r1 * r2;",
616+ "",
617+ "r0 = r1 << r2;",
618+ "r0 = r1 >> r2;",
619+ "r0 = r1 / r2;",
620+ "r0 = r1 % r2;"
621+};
622+
524623 int CHNCPU_Op_TernaryReg_PrintCode(CHNCPU_RuntimeEnvironment *env, CHNCPU_OpTag *op, FILE *file)
525624 {
526625 CHNCPU_OpCache_TernaryReg *opCache;
@@ -541,6 +640,25 @@ int CHNCPU_Op_TernaryReg_PrintCode(CHNCPU_RuntimeEnvironment *env, CHNCPU_OpTag
541640 return 0;
542641 }
543642
643+int CHNCPU_Op_TernaryReg_PrintWikiDoc(int opCode, FILE *file)
644+{
645+ fprintf(file, ", %s, %02X, %X, %s, %s, %s, %s, %s, %s, %s, %s, %s\n",
646+ CHNCPU_Op_TernaryReg_MnemonicList0[opCode - 0x10],
647+ opCode, opCode + 0x80,
648+ "r1", "r2", "r0", "bit", "", "", "",
649+ CHNCPU_Op_TernaryReg_CodeList0[opCode - 0x10], "");
650+
651+ if(opCode == 0x10){
652+ fprintf(file, ", %s, %02X, %X, %s, %s, %s, %s, %s, %s, %s, %s, %s\n",
653+ "CP",
654+ opCode, opCode + 0x80,
655+ "r1", "r1", "r0", "bit", "", "", "",
656+ "r0 = r1", "");
657+ }
658+
659+ return 0;
660+}
661+
544662 //
545663 // Compare Integer Register Operation
546664 //
@@ -661,6 +779,20 @@ char *CHNCPU_Op_CompareIReg_MnemonicList0[8] = {
661779 "TSTZ",
662780 "TSTNZ",
663781 };
782+
783+char *CHNCPU_Op_CompareIReg_CodeList0[8] = {
784+ // 20-27
785+ "r0 = (r1 == r2) ? -1 : 0;",
786+ "r0 = (r1 != r2) ? -1 : 0;",
787+ "r0 = (r1 < r2) ? -1 : 0;",
788+ "r0 = (r1 >= r2) ? -1 : 0;",
789+ "r0 = (r1 <= r2) ? -1 : 0;",
790+ "r0 = (r1 > r2) ? -1 : 0;",
791+ "r0 = ((r1 & r2) == 0) ? -1 : 0;",
792+ "r0 = ((r1 & r2) != 0) ? -1 : 0;",
793+};
794+
795+
664796 int CHNCPU_Op_CompareIReg_PrintCode(CHNCPU_RuntimeEnvironment *env, CHNCPU_OpTag *op, FILE *file)
665797 {
666798 CHNCPU_OpCache_CompareIReg *opCache;
@@ -678,4 +810,30 @@ int CHNCPU_Op_CompareIReg_PrintCode(CHNCPU_RuntimeEnvironment *env, CHNCPU_OpTag
678810 return 0;
679811 }
680812
813+int CHNCPU_Op_CompareIReg_PrintWikiDoc(int opCode, FILE *file)
814+{
815+ fprintf(file, ", %s, %02X, %X, %s, %s, %s, %s, %s, %s, %s, %s, %s\n",
816+ CHNCPU_Op_CompareIReg_MnemonicList0[opCode - 0x20],
817+ opCode, opCode + 0x80,
818+ "r1", "r2", "bitDiff", "r0", "bitDst", "", "",
819+ CHNCPU_Op_CompareIReg_CodeList0[opCode - 0x20], "");
820+
821+ return 0;
822+}
823+
824+//
825+// Prefix2F
826+//
827+
828+int CHNCPU_Op_Prefix2F_PrintWikiDoc(int opCode, FILE *file)
829+{
830+ fprintf(file, ", %s, %02X, %X, %s, %s, %s, %s, %s, %s, %s, %s, %s\n",
831+ "Prefix2F-0",
832+ 0x2F, 0x2F + 0x80,
833+ "0", "", "", "", "", "", "",
834+ "DISABLE_BOUND_CHECK;", "");
835+
836+ return 0;
837+}
838+
681839