rabbitizer/r5900test.c
Anghelo Carvajal 136fb7a09a
Add R5900 support (#5)
* starting r5900 stuff

* operands of pmaddh

* expose R5900 to python

* fix merge issues

* move to subtables

* mmi0 and mmi3

* the rest of mmi instructions

* normal, special, regimm and cop0

* fpu_s

* cop2 special1

* starting cop2 special2

* the rest of special2

* operands for normal, special, mmi and mmi0

* mmi1 and mmi2

* Fix mmi

* sync.p

* mmi3 and cop1

* add r5900 opcodes to InstrId.pyi

* add invalid bits to unknown instruction comment

* progress on cop2 special1

* kinda finish cop2 special1

* cop2 special2 progress

* Special case for R5900 cvt.w.s -> trunc.w.s

* R5900 c.olt.s and c.ole.s

* Fix a bunch of VU0 instructions

* I'm getting tired of this bullshit

* vlqi, vsqi, vlqd, vsqd

* fix some operands

* fix div1

* lqc2 and sqc2

* sqrt.s and mult

* fix mtsa and bc2

* Remove redundant .instrType=RABBITIZER_INSTR_TYPE_UNKNOWN

* RabbitizerInstrSuffix

* Impleme instr suffix type

* add instr suffix to remaining instructions

* ifdef out xyzw suffix from registers

* format

* fix warnings

* uncomment stuff on InstrId.pyi

* readme
2022-08-27 12:22:48 -04:00

48 lines
1.1 KiB
C

/* SPDX-FileCopyrightText: © 2022 Decompollaborate */
/* SPDX-License-Identifier: MIT */
#include "instructions/RabbitizerInstructionR5900.h"
#include <assert.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
int main() {
uint32_t word;
RabbitizerInstruction instr;
char *buffer;
int extraLJust = 5;
#if 1
uint32_t validbits;
#endif
word = 0x4BE1634B;
RabbitizerInstructionR5900_init(&instr, word, 0x00100000);
RabbitizerInstructionR5900_processUniqueId(&instr);
buffer = malloc(RabbitizerInstruction_getSizeForBuffer(&instr, 0, extraLJust) + 1);
assert(buffer != NULL);
RabbitizerInstruction_disassemble(&instr, buffer, NULL, 0, extraLJust);
printf("%08X: %s\n", word, buffer);
#if 1
validbits = RabbitizerInstruction_getValidBits(&instr);
printf("word: %08X\n", instr.word);
printf("mandatory bits: %08X\n", instr._mandatorybits);
printf("valid bits: %08X\n", validbits);
printf("invalid bits: %08X\n", (~validbits) & instr.word);
#endif
free(buffer);
RabbitizerInstructionR5900_destroy(&instr);
return 0;
}