Files
mm/tools/ZAPD/lib/libgfxd/uc.c
T
Anghelo Carvajal b6904aa2cc Convert every submodule into subrepo (#170)
* remove ZAPD submodule

* git subrepo clone https://github.com/zeldaret/ZAPD.git tools/ZAPD

subrepo:
  subdir:   "tools/ZAPD"
  merged:   "ca229f19"
upstream:
  origin:   "https://github.com/zeldaret/ZAPD.git"
  branch:   "master"
  commit:   "ca229f19"
git-subrepo:
  version:  "0.4.3"
  origin:   "???"
  commit:   "???"

* git subrepo clone https://github.com/simonlindholm/decomp-permuter.git tools/decomp-permuter

subrepo:
  subdir:   "tools/decomp-permuter"
  merged:   "1e4b85a7"
upstream:
  origin:   "https://github.com/simonlindholm/decomp-permuter.git"
  branch:   "main"
  commit:   "1e4b85a7"
git-subrepo:
  version:  "0.4.3"
  origin:   "???"
  commit:   "???"

* Remove asm-differ

* git subrepo clone https://github.com/simonlindholm/asm-differ.git tools/asm-differ

subrepo:
  subdir:   "tools/asm-differ"
  merged:   "eaf72269"
upstream:
  origin:   "https://github.com/simonlindholm/asm-differ.git"
  branch:   "master"
  commit:   "eaf72269"
git-subrepo:
  version:  "0.4.3"
  origin:   "???"
  commit:   "???"

* remove asm-processor

* git subrepo clone https://github.com/simonlindholm/asm-processor.git tools/asm-processor

subrepo:
  subdir:   "tools/asm-processor"
  merged:   "85288fcd"
upstream:
  origin:   "https://github.com/simonlindholm/asm-processor.git"
  branch:   "master"
  commit:   "85288fcd"
git-subrepo:
  version:  "0.4.3"
  origin:   "???"
  commit:   "???"

* remove .gitmodules file

* Update REAMDE

* Update warnings
2021-06-07 18:31:56 -04:00

55 lines
1.1 KiB
C

#include <inttypes.h>
#include <string.h>
#include <stdint.h>
#include "gbi.h"
#include "gfxd.h"
#include "priv.h"
#include "uc_argfn.c"
#include "uc_argtbl.c"
#include "uc_macrofn.c"
#include "uc_macrotbl.c"
UCFUNC int disas(gfxd_macro_t *m, uint32_t hi, uint32_t lo)
{
int opcode = (hi >> 24) & 0xFF;
for (int i = 0; i < sizeof(macro_tbl) / sizeof(macro_tbl[0]); i++)
{
const gfxd_macro_type_t *t = &macro_tbl[i];
if (t->disas_fn != NULL && t->opcode == opcode)
return t->disas_fn(m, hi, lo);
}
return d_Invalid(m, hi, lo);
}
UCFUNC int combine(gfxd_macro_t *m, int num)
{
int opcode = macro_tbl[m->id].opcode;
for (int i = 0; i < sizeof(macro_tbl) / sizeof(macro_tbl[0]); i++)
{
const gfxd_macro_type_t *t = &macro_tbl[i];
if (t->combine_fn != NULL
&& t->opcode == opcode
&& (t->ext == 0 || config.emit_ext_macro != 0))
{
if (t->combine_fn(m, num) == 0)
return 0;
}
}
return -1;
}
static const struct gfxd_ucode uc =
{
.disas_fn = disas,
.combine_fn = combine,
.arg_tbl = arg_tbl,
.macro_tbl = macro_tbl,
};
const gfxd_ucode_t uc_name = &uc;