2020-02-28 16:04:28 +00:00
|
|
|
/*
|
|
|
|
DingusPPC - The Experimental PowerPC Macintosh emulator
|
2021-10-23 19:00:31 +00:00
|
|
|
Copyright (C) 2018-21 divingkatae and maximum
|
2020-02-28 16:04:28 +00:00
|
|
|
(theweirdo) spatium
|
|
|
|
|
|
|
|
(Contact divingkatae#1017 or powermax#2286 on Discord for more info)
|
|
|
|
|
|
|
|
This program is free software: you can redistribute it and/or modify
|
|
|
|
it under the terms of the GNU General Public License as published by
|
|
|
|
the Free Software Foundation, either version 3 of the License, or
|
|
|
|
(at your option) any later version.
|
|
|
|
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
GNU General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
|
|
*/
|
|
|
|
|
2020-01-22 11:28:42 +00:00
|
|
|
#ifndef PPCDISASM_H
|
|
|
|
#define PPCDISASM_H
|
|
|
|
|
|
|
|
#include <cinttypes>
|
|
|
|
#include <string>
|
2023-08-07 19:41:29 +00:00
|
|
|
#include <vector>
|
2020-01-22 11:28:42 +00:00
|
|
|
|
|
|
|
typedef struct PPCDisasmContext {
|
2020-05-12 18:55:45 +00:00
|
|
|
uint32_t instr_addr;
|
|
|
|
uint32_t instr_code;
|
2020-01-22 11:28:42 +00:00
|
|
|
std::string instr_str;
|
2020-05-12 18:55:45 +00:00
|
|
|
bool simplified; /* true if we should output simplified mnemonics */
|
2023-08-07 19:41:29 +00:00
|
|
|
std::vector<std::string> regs_in;
|
|
|
|
std::vector<std::string> regs_out;
|
2020-01-22 11:28:42 +00:00
|
|
|
} PPCDisasmContext;
|
|
|
|
|
2020-05-12 18:55:45 +00:00
|
|
|
std::string disassemble_single(PPCDisasmContext* ctx);
|
2020-01-22 11:28:42 +00:00
|
|
|
|
2020-02-12 21:58:24 +00:00
|
|
|
int test_ppc_disasm(void);
|
|
|
|
|
2020-01-22 11:28:42 +00:00
|
|
|
/** sign-extend an integer. */
|
2020-05-12 18:55:45 +00:00
|
|
|
#define SIGNEXT(x, sb) ((x) | (((x) & (1 << (sb))) ? ~((1 << (sb)) - 1) : 0))
|
2020-01-22 11:28:42 +00:00
|
|
|
|
|
|
|
#endif /* PPCDISASM_H */
|