Exemplo n.º 1
0
class FixupEntry(cmodel.Struct):
    offset = cmodel.LeU32
    #Size of the patch result, not the actual fixup operands (which are always Le32)
    patchtype = cmodel.Enum(cmodel.LeU32, "BYTE", "LE16", "BE16", "LE32", "BE32")
    exprsize = cmodel.LeU32
    expression = cmodel.Array(FixupOpcode, "exprsize", countType = cmodel.BytesCount)
    
    __order__ = ["offset", "patchtype", "exprsize", "expression"]
Exemplo n.º 2
0
class Rgb2Section(cmodel.Struct):
    datasize = cmodel.LeU32
    sectype = cmodel.Enum(cmodel.U8, "BSS", "VRAM", "CODE", "HOME", "HRAM")
    org = cmodel.LeS32
    bank = cmodel.LeS32
    datsec = cmodel.If("sectype", lambda x: x in [2, 3], Rgb2SectionData)

    __order__ = ["datasize", "sectype", "org", "bank", "datsec"]
Exemplo n.º 3
0
class PatchUnion(cmodel.Union):
    __tag__ = cmodel.Enum(cmodel.BitField("cmdLength", 0, 2), "SRC_READ",
                          "TGT_READ", "SRC_COPY", "TGT_COPY")

    SRC_READ = PatchSrcRead
    TGT_READ = PatchTgtRead
    SRC_COPY = PatchCopyCmd
    TGT_COPY = PatchCopyCmd
Exemplo n.º 4
0
class Rgb2PatchExpr(cmodel.Union):
    __tag__ = cmodel.Enum(cmodel.U8, "ADD", "SUB", "MUL", "DIV", "MOD",
                          "NEGATE", "OR", "AND", "XOR", "NOT", "BOOLNOT",
                          "CMPEQ", "CMPNE", "CMPGT", "CMPLT", "CMPGE", "CMPLE",
                          "SHL", "SHR", "BANK", "FORCE_HRAM", "FORCE_TG16_ZP",
                          "RANGECHECK", ("LONG", 0x80), ("SymID", 0x81))

    RANGECHECK = Rgb2LimitExpr
    LONG = cmodel.LeU32
    SymID = cmodel.LeU32
    BANK = cmodel.LeU32
Exemplo n.º 5
0
class FixupOpcode(cmodel.Union):
    __tag__ = cmodel.Enum(cmodel.LeU8, "OBJ_OP_SUB", "OBJ_OP_ADD", "OBJ_OP_XOR",
    "OBJ_OP_OR", "OBJ_OP_AND", "OBJ_OP_SHL", "OBJ_OP_SHR", "OBJ_OP_MUL",
    "OBJ_OP_DIV", "OBJ_OP_MOD", "OBJ_OP_LOGICOR", "OBJ_OP_LOGICAND",
    "OBJ_OP_LOGICNOT", "OBJ_OP_LOGICGE", "OBJ_OP_LOGICGT", "OBJ_OP_LOGICLE",
    "OBJ_OP_LOGICLT", "OBJ_OP_LOGICEQU", "OBJ_OP_LOGICNE", "OBJ_FUNC_LOWLIMIT",
    "OBJ_FUNC_HIGHLIMIT", "OBJ_FUNC_FDIV", "OBJ_FUNC_FMUL", "OBJ_FUNC_ATAN2",
    "OBJ_FUNC_SIN", "OBJ_FUNC_COS", "OBJ_FUNC_TAN", "OBJ_FUNC_ASIN",
    "OBJ_FUNC_ACOS", "OBJ_FUNC_ATAN", "OBJ_CONSTANT", "OBJ_SYMBOL", "OBJ_PCREL",
    "OBJ_FUNC_BANK")
    
    OBJ_CONSTANT = cmodel.LeU32
    OBJ_SYMBOL = cmodel.LeU32
    OBJ_FUNC_BANK = cmodel.LeU32
Exemplo n.º 6
0
class Rgb2Patch(cmodel.Struct):
    srcfile = cmodel.String("ascii")
    srcline = cmodel.LeU32
    patchoffset = cmodel.LeU32
    patchtype = cmodel.Enum(cmodel.U8, "BYTE", "LE16", "LE32", "BE16", "BE32")

    numpatchexprs = cmodel.LeU32
    patchexprs = cmodel.Array(Rgb2PatchExpr,
                              "numpatchexprs",
                              countType=cmodel.BytesCount)

    __order__ = [
        "srcfile", "srcline", "patchoffset", "patchtype", "numpatchexprs",
        "patchexprs"
    ]
Exemplo n.º 7
0
class Symbol(cmodel.Struct):
    name = cmodel.String("ascii")
    symtype = cmodel.Enum(cmodel.LeS32, "EXPORT", "IMPORT", "LOCAL", "LOCALEXPORT", "LOCALIMPORT", ("FLAT_WHAT", -1))
    value = cmodel.If("symtype", lambda x: x in [-1, 0, 2, 3], cmodel.LeS32)
    
    __order__ = ["name", "symtype", "value"]
Exemplo n.º 8
0
class SectionGroup(cmodel.Struct):
    name = cmodel.String("ascii")
    typeid = cmodel.Enum(cmodel.LeU32, "GROUP_TEXT", "GROUP_BSS")
    
    __order__ = ["name", "typeid"]
Exemplo n.º 9
0
class Rgb2Symbol(cmodel.Struct):
    name = cmodel.String("ascii")
    symtype = cmodel.Enum(cmodel.U8, "LOCAL", "IMPORT", "EXPORT")
    value = cmodel.If("symtype", lambda x: x in [0, 2], Rgb2SymValue)

    __order__ = ["name", "symtype", "value"]