本文整理汇总了TypeScript中mips-inst.parse函数的典型用法代码示例。如果您正苦于以下问题:TypeScript parse函数的具体用法?TypeScript parse怎么用?TypeScript parse使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了parse函数的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的TypeScript代码示例。
示例1: compileWRITE16
compileWRITE16(code: ICode) {
return parse(`
LUI ${this.REG1} ${this.getAddrUpper(code.addr)}
ORI ${this.REG1} ${this.REG1} ${this.getAddrLower(code.addr)}
ADDIU ${this.REG2} R0 ${code.value}
SH ${this.REG2} 0(${this.REG1})
`);
}
开发者ID:PartyPlanner64,项目名称:PartyPlanner64,代码行数:8,代码来源:compiler.ts
示例2: compileIFNOT16
compileIFNOT16(code: ICode) {
return parse(`
LUI ${this.REG1} ${this.getAddrUpper(code.addr)}
ORI ${this.REG1} ${this.REG1} ${this.getAddrLower(code.addr)}
LH ${this.REG1} 0(${this.REG1})
ADDIU ${this.REG2} R0 ${code.value}
BEQ ${this.REG1} ${this.REG2} 4
`);
}
开发者ID:PartyPlanner64,项目名称:PartyPlanner64,代码行数:9,代码来源:compiler.ts
示例3: findCalls
export function findCalls(dataView: DataView, jalAddr: number) {
const jalInst = parse(`JAL ${jalAddr}`);
const calls = [];
for (let i = 0; i < dataView.byteLength; i += 4) {
const inst = dataView.getUint32(i);
if (inst === jalInst) {
calls.push(i);
}
}
return calls;
}
开发者ID:PartyPlanner64,项目名称:PartyPlanner64,代码行数:11,代码来源:MIPS.ts
示例4: writeHookCode
writeHookCode(romView: DataView) {
const adapter = getROMAdapter();
const MAINFS_READ_ADDR = adapter && adapter.MAINFS_READ_ADDR;
if (!MAINFS_READ_ADDR) {
throw new Error("Cheats were being applied, but the ROM adapter had no MAINFS_READ_ADDR");
}
// The first 4 bytes will be reserved to store the pointer to the cheat routine,
// so we can remember where it is for subsequent frames.
// The hook will immediately follow.
let offset = this.HOOK_ROM_START_OFFSET + 4;
// T9 = saved off V0 value
// S7 = saved off RA value
// A1 = address of cheat routine (either due to reading from cached location, or from the heap call)
// A2 = "ver!" constant that is initially in RAM
// Read the cached cheat routine address
const cachedReadLocs = getRegSetUpperAndLower(this.HOOK_RAM_START_OFFSET);
romView.setUint32(offset, parse(`LUI A1 ${0x8000 | cachedReadLocs[0]}`)); // A1 = 0x800C
romView.setUint32(offset += 4, parse(`ADDIU A1 A1 ${cachedReadLocs[1]}`)); // A1 = 0x800CA900
romView.setUint32(offset += 4, parse("LW A1 0(A1)"));
// Check if the cached cheat routine address is legit. If not, this is the first execution and we need to get it
romView.setUint32(offset += 4, parse(`LUI A2 ${this.HOOK_CACHE_DEFAULT_VALUE >>> 16}`)); // A2 = 0x76650000 "ve"
romView.setUint32(offset += 4, parse(`ADDIU A2 A2 ${this.HOOK_CACHE_DEFAULT_VALUE & 0xFFFF}`)); // A2 = 0x76657221 "ver!"
romView.setUint32(offset += 4, parse(`BNE A1 A2 11`)); // Jump to the JR A1
// Prep to call mainfs read
// Should save off V0 and RA, because they are needed to leave the controller routine properly.
romView.setUint32(offset += 4, parse("ADDU T9 V0 R0")); // T9 <= V0
romView.setUint32(offset += 4, parse("ADDU S7 RA R0")); // S7 <= RA
// Read from MainFS if we don't have cheat buffer (only happens once)
romView.setUint32(offset += 4, parse(`LUI A0 ${this.MAINFS_CHEAT_FILE[0]}`)); // A0 <= [The dir index]xxxx
romView.setUint32(offset += 4, parse(`JAL ${MAINFS_READ_ADDR}`));
romView.setUint32(offset += 4, parse(`ADDIU A0 A0 ${this.MAINFS_CHEAT_FILE[1]}`)); // A0 = [dir index][file index]
// Cache off the cheat location
romView.setUint32(offset += 4, parse(`LUI A1 ${0x8000 | cachedReadLocs[0]}`)); // A1 = 0x800C
romView.setUint32(offset += 4, parse(`ADDIU A1 A1 ${cachedReadLocs[1]}`)); // A1 = 0x800CA900
romView.setUint32(offset += 4, parse("SW V0 0(A1)"));
romView.setUint32(offset += 4, parse("ADDU A1 V0 R0")); // A1 <= V0
// Post-JAL cleanup, restore cached regs
romView.setUint32(offset += 4, parse("ADDU V0 T9 R0")); // V0 <= T9
romView.setUint32(offset += 4, parse("ADDU RA S7 R0")); // RA <= S7
// A1 has the location of the cheat routine... jump to it!
romView.setUint32(offset += 4, parse("JR A1"));
romView.setUint32(offset += 4, 0); // NOP
}
开发者ID:PartyPlanner64,项目名称:PartyPlanner64,代码行数:52,代码来源:HookBase.ts
注:本文中的mips-inst.parse函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论