Debian Codegraph @

arch/MOS65XX/MOS65XXModule.c

raw symbols SCIP
1 /* Capstone Disassembly Engine */cxx . . $ `<file>/arch/MOS65XX/MOS65XXModule.c`/
2 /* MOS65XX Backend by Sebastian Macke <[email protected]> 2018 */
3
4 #ifdef CAPSTONE_HAS_MOS65XXcxx . . $ `<built-in>:427:9`!
5
6 #include "../../utils.h"cxx . . $ `<file>/utils.h`/
7 #include "../../MCRegisterInfo.h"cxx . . $ `<file>/MCRegisterInfo.h`/
8 #include "MOS65XXDisassembler.h"cxx . . $ `<file>/arch/MOS65XX/MOS65XXDisassembler.h`/
9 #include "MOS65XXDisassemblerInternals.h"cxx . . $ `<file>/arch/MOS65XX/MOS65XXDisassemblerInternals.h`/
10 #include "MOS65XXModule.h"cxx . . $ `<file>/arch/MOS65XX/MOS65XXModule.h`/
11
12 cs_errcxx . . $ cs_err# MOS65XX_global_initcxx . . $ MOS65XX_global_init(2c23641276a36c6e).(cs_structcxx . . $ cs_struct# *ud)
13 {
14 mos65xx_infocxx . . $ mos65xx_info# *info;
15
16 info = cs_mem_malloccxx . . $ cs_mem_malloc.(sizeof(*info));
17 info->hex_prefixcxx . . $ mos65xx_info#hex_prefix. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!;
18 info->cpu_typecxx . . $ mos65xx_info#cpu_type. = MOS65XX_CPU_TYPE_6502cxx . . $ MOS65XX_CPU_TYPE_6502.;
19 info->long_mcxx . . $ mos65xx_info#long_m. = 0;
20 info->long_xcxx . . $ mos65xx_info#long_x. = 0;
21
22
23 ud->printercxx . . $ cs_struct#printer. = MOS65XX_printInstcxx . . $ MOS65XX_printInst(6238f66e5ea10f57).;
24 ud->printer_infocxx . . $ cs_struct#printer_info. = info;
25 ud->insn_idcxx . . $ cs_struct#insn_id. = MOS65XX_get_insn_idcxx . . $ MOS65XX_get_insn_id(b32a94ba649bfb5a).;
26 ud->insn_namecxx . . $ cs_struct#insn_name. = MOS65XX_insn_namecxx . . $ MOS65XX_insn_name(efd1348d9ae5172e).;
27 ud->group_namecxx . . $ cs_struct#group_name. = MOS65XX_group_namecxx . . $ MOS65XX_group_name(efd1348d9ae5172e).;
28 ud->disasmcxx . . $ cs_struct#disasm. = MOS65XX_getInstructioncxx . . $ MOS65XX_getInstruction(fe94ce91eeab61e9).;
29 ud->reg_namecxx . . $ cs_struct#reg_name. = MOS65XX_reg_namecxx . . $ MOS65XX_reg_name(efd1348d9ae5172e).;
30
31 if (ud->modecxx . . $ cs_struct#mode.) {
32 MOS65XX_optioncxx . . $ MOS65XX_option(34dd9365584c51ad).(ud, CS_OPT_MODEcxx . . $ CS_OPT_MODE., ud->modecxx . . $ cs_struct#mode.);
33 }
34
35 return CS_ERR_OKcxx . . $ CS_ERR_OK.;
36 }
37
38 cs_errcxx . . $ cs_err# MOS65XX_optioncxx . . $ MOS65XX_option(34dd9365584c51ad).(cs_structcxx . . $ cs_struct# *handle, cs_opt_typecxx . . $ cs_opt_type# type, size_t value)
39 {
40 mos65xx_infocxx . . $ mos65xx_info# *info = (mos65xx_infocxx . . $ mos65xx_info# *)handle->printer_infocxx . . $ cs_struct#printer_info.;
41 switch(type) {
42 default:
43 break;
44 case CS_OPT_MODEcxx . . $ CS_OPT_MODE.:
45
46 if (value & CS_MODE_MOS65XX_6502cxx . . $ CS_MODE_MOS65XX_6502.)
47 info->cpu_typecxx . . $ mos65xx_info#cpu_type. = MOS65XX_CPU_TYPE_6502cxx . . $ MOS65XX_CPU_TYPE_6502.;
48 if (value & CS_MODE_MOS65XX_65C02cxx . . $ CS_MODE_MOS65XX_65C02.)
49 info->cpu_typecxx . . $ mos65xx_info#cpu_type. = MOS65XX_CPU_TYPE_65C02cxx . . $ MOS65XX_CPU_TYPE_65C02.;
50 if (value & CS_MODE_MOS65XX_W65C02cxx . . $ CS_MODE_MOS65XX_W65C02.)
51 info->cpu_typecxx . . $ mos65xx_info#cpu_type. = MOS65XX_CPU_TYPE_W65C02cxx . . $ MOS65XX_CPU_TYPE_W65C02.;
52 if (value & (CS_MODE_MOS65XX_65816cxx . . $ CS_MODE_MOS65XX_65816.|CS_MODE_MOS65XX_65816_LONG_Mcxx . . $ CS_MODE_MOS65XX_65816_LONG_M.|CS_MODE_MOS65XX_65816_LONG_Xcxx . . $ CS_MODE_MOS65XX_65816_LONG_X.))
53 info->cpu_typecxx . . $ mos65xx_info#cpu_type. = MOS65XX_CPU_TYPE_65816cxx . . $ MOS65XX_CPU_TYPE_65816.;
54
55 info->long_mcxx . . $ mos65xx_info#long_m. = value & CS_MODE_MOS65XX_65816_LONG_Mcxx . . $ CS_MODE_MOS65XX_65816_LONG_M. ? 1 : 0;
56 info->long_xcxx . . $ mos65xx_info#long_x. = value & CS_MODE_MOS65XX_65816_LONG_Xcxx . . $ CS_MODE_MOS65XX_65816_LONG_X. ? 1 : 0;
57
58 handle->modecxx . . $ cs_struct#mode. = (cs_modecxx . . $ cs_mode#)value;
59 break;
60 case CS_OPT_SYNTAXcxx . . $ CS_OPT_SYNTAX.:
61 switch(value) {
62 default:
63 // wrong syntax value
64 handle->errnumcxx . . $ cs_struct#errnum. = CS_ERR_OPTIONcxx . . $ CS_ERR_OPTION.;
65 return CS_ERR_OPTIONcxx . . $ CS_ERR_OPTION.;
66 case CS_OPT_SYNTAX_DEFAULTcxx . . $ CS_OPT_SYNTAX_DEFAULT.:
67 info->hex_prefixcxx . . $ mos65xx_info#hex_prefix. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!;
68 break;
69 case CS_OPT_SYNTAX_MOTOROLAcxx . . $ CS_OPT_SYNTAX_MOTOROLA.:
70 info->hex_prefixcxx . . $ mos65xx_info#hex_prefix. = "$";
71 break;
72 }
73 handle->syntaxcxx . . $ cs_struct#syntax. = (int)value;
74 break;
75 }
76 return CS_ERR_OKcxx . . $ CS_ERR_OK.;
77 }
78
79 #endif