📄 cpuops.s
字号:
/*** Renesas SH assembler ***************************************************** SH assembler code partly based on x86 assembler code (c) Copyright 2002 - 2004 Marcus Comstedt (marcus@mc.pp.se)******************************************************************************//****************************************************************************** Snes9x - Portable Super Nintendo Entertainment System (TM) emulator. (c) Copyright 1996 - 2003 Gary Henderson (gary.henderson@ntlworld.com) and Jerremy Koot (jkoot@snes9x.com) (c) Copyright 2002 - 2003 Matthew Kendora and Brad Jorsch (anomie@users.sourceforge.net) C4 x86 assembler and some C emulation code (c) Copyright 2000 - 2003 zsKnight (zsknight@zsnes.com), _Demo_ (_demo_@zsnes.com), and Nach (n-a-c-h@users.sourceforge.net) C4 C++ code (c) Copyright 2003 Brad Jorsch DSP-1 emulator code (c) Copyright 1998 - 2003 Ivar (ivar@snes9x.com), _Demo_, Gary Henderson, John Weidman (jweidman@slip.net), neviksti (neviksti@hotmail.com), and Kris Bleakley (stinkfish@bigpond.com) DSP-2 emulator code (c) Copyright 2003 Kris Bleakley, John Weidman, neviksti, Matthew Kendora, and Lord Nightmare (lord_nightmare@users.sourceforge.net OBC1 emulator code (c) Copyright 2001 - 2003 zsKnight, pagefault (pagefault@zsnes.com) Ported from x86 assembler to C by sanmaiwashi SPC7110 and RTC C++ emulator code (c) Copyright 2002 Matthew Kendora with research by zsKnight, John Weidman, and Dark Force S-RTC C emulator code (c) Copyright 2001 John Weidman Super FX x86 assembler emulator code (c) Copyright 1998 - 2003 zsKnight, _Demo_, and pagefault Super FX C emulator code (c) Copyright 1997 - 1999 Ivar and Gary Henderson. Specific ports contains the works of other authors. See headers in individual files. Snes9x homepage: http://www.snes9x.com Permission to use, copy, modify and distribute Snes9x in both binary and source form, for non-commercial purposes, is hereby granted without fee, providing that this license information and copyright notice appear with all copies and any derived work. This software is provided 'as-is', without any express or implied warranty. In no event shall the authors be held liable for any damages arising from the use of this software. Snes9x is freeware for PERSONAL USE only. Commercial users should seek permission of the copyright holders first. Commercial use includes charging money for Snes9x or software derived from Snes9x. The copyright holders request that bug fixes and improvements to the code should be forwarded to them so everyone can benefit from the modifications in future versions. Super NES and Super Nintendo Entertainment System are trademarks of Nintendo Co., Limited and its subsidiary companies.******************************************************************************/.text#include "asmstruc.h"#include "asmaddr.h"#include "asmops.h"#include "getset.S".macro call_S9xGetByte mov.l S9xGetByte,r3 jsr @r3 nop.endm.macro call_S9xGetWord mov.l S9xGetWord,r3 jsr @r3 nop.endm /* ADC */Op69M1: Immediate8 ADC Adc8 IMM8Op69M0: Immediate16 ADC2 Adc16 IMM16Op65M1: Direct8 ADC2 call_S9xGetByte Adc8 DIR8Op65M0: Direct8 ADC call_S9xGetWord Adc16 DIR16 Op75M1: DirectIndexedX8 ADC call_S9xGetByte Adc8 DIX8Op75M0: DirectIndexedX8 ADC2 call_S9xGetWord Adc16 DIX16Op72M1: DirectIndirect8 ADC call_S9xGetByte Adc8 DI8Op72M0: DirectIndirect8 ADC2 call_S9xGetWord Adc16 DI16Op61M1: DirectIndexedIndirect8 ADC call_S9xGetByte Adc8 DII8Op61M0: DirectIndexedIndirect8 ADC2 call_S9xGetWord Adc16 DII16Op71M1: DirectIndirectIndexed8 ADC call_S9xGetByte Adc8 DIIY8Op71M0: DirectIndirectIndexed8 ADC2 call_S9xGetWord Adc16 DIIY16Op67M1: DirectIndirectLong8 ADC call_S9xGetByte Adc8 DIL8Op67M0: DirectIndirectLong8 ADC2 call_S9xGetWord Adc16 DIL16Op77M1: DirectIndirectIndexedLong8 ADC call_S9xGetByte Adc8 DIIL8Op77M0: DirectIndirectIndexedLong8 ADC2 call_S9xGetWord Adc16 DIIL8Op6DM1: Absolute8 ADC call_S9xGetByte Adc8 ABS8Op6DM0: Absolute8 ADC2 call_S9xGetWord Adc16 ABS16Op7DM1: AbsoluteIndexedX8 ADC call_S9xGetByte Adc8 ABSX8Op7DM0: AbsoluteIndexedX8 ADC2 call_S9xGetWord Adc16 ABSX16Op79M1: AbsoluteIndexedY8 ADC call_S9xGetByte Adc8 ABSY8Op79M0: AbsoluteIndexedY8 ADC2 call_S9xGetWord Adc16 ABSY16Op6FM1: AbsoluteLong8 ADC call_S9xGetByte Adc8 ABSL8Op6FM0: AbsoluteLong8 ADC2 call_S9xGetWord Adc16 ABSL16Op7FM1: AbsoluteLongIndexedX8 ADC call_S9xGetByte Adc8 ALX8Op7FM0: AbsoluteLongIndexedX8 ADC2 call_S9xGetWord Adc16 ALX16Op63M1: StackRelative8 ADC call_S9xGetByte Adc8 SREL8Op63M0: StackRelative8 ADC2 call_S9xGetWord Adc16 SREL16Op73M1: StackRelativeIndirectIndexed8 ADC call_S9xGetByte Adc8 SRII8Op73M0: StackRelativeIndirectIndexed8 ADC2 call_S9xGetWord Adc16 SRII16/* AND */Op29M1: Immediate8 AND And8 IMM8Op29M0: Immediate16 AND And16 IMM16Op25M1: Direct8 AND call_S9xGetByte And8 DIR8Op25M0: Direct8 AND2 call_S9xGetWord And16 DIR16Op35M1: DirectIndexedX8 AND call_S9xGetByte And8 DIX8Op35M0: DirectIndexedX8 AND2 call_S9xGetWord And16 DIX16Op32M1: DirectIndirect8 AND call_S9xGetByte And8 DI8Op32M0: DirectIndirect8 AND2 call_S9xGetWord And16 DI16Op21M1: DirectIndexedIndirect8 AND call_S9xGetByte And8 DII8Op21M0: DirectIndexedIndirect8 AND2 call_S9xGetWord And16 DII16Op31M1: DirectIndirectIndexed8 AND call_S9xGetByte And8 DIIY8Op31M0: DirectIndirectIndexed8 AND2 call_S9xGetWord And16 DIIY16Op27M1: DirectIndirectLong8 AND call_S9xGetByte And8 DIL8Op27M0: DirectIndirectLong8 AND2 call_S9xGetWord And16 DIL16Op37M1: DirectIndirectIndexedLong8 AND call_S9xGetByte And8 DIIL8Op37M0: DirectIndirectIndexedLong8 AND2 call_S9xGetWord And16 DIIL16Op2DM1: Absolute8 AND call_S9xGetByte And8 ABS8Op2DM0: Absolute8 AND2 call_S9xGetWord And16 ABS16Op3DM1: AbsoluteIndexedX8 AND call_S9xGetByte And8 ABSX8Op3DM0: AbsoluteIndexedX8 AND2 call_S9xGetWord And16 ABSX16Op39M1: AbsoluteIndexedY8 AND call_S9xGetByte And8 ABSY8Op39M0: AbsoluteIndexedY8 AND2 call_S9xGetWord And16 ABSY16Op2FM1: AbsoluteLong8 AND call_S9xGetByte And8 ABSL8Op2FM0: AbsoluteLong8 AND2 call_S9xGetWord And16 ABSL16Op3FM1: AbsoluteLongIndexedX8 AND call_S9xGetByte And8 ALX8Op3FM0: AbsoluteLongIndexedX8 AND2 call_S9xGetWord And16 ALX16Op23M1: StackRelative8 AND call_S9xGetByte And8 SREL8Op23M0: StackRelative8 AND2 call_S9xGetWord And16 SREL16Op33M1: StackRelativeIndirectIndexed8 AND call_S9xGetByte And8 SRII8Op33M0: StackRelativeIndirectIndexed8 AND2 call_S9xGetWord And16 SRII16/* ASL */Op0AM1: extu.b A,r1 sub r1,A#ifdef VAR_CYCLES add #6, CYCLES#endif shll r1 extu.b r1,r2 mov #Carry,r0 or r2,A cmp/eq r1,r2 bf/s .Asl8Carry or r0,FLAGS add #-Carry,FLAGS.Asl8Carry: SetZNjmp AOp0AM0: extu.w A,r1#ifdef VAR_CYCLES add #6, CYCLES#endif shll r1 mov #Carry,r0 extu.w r1,A cmp/eq r1,A bf/s .Asl16Carry or r0,FLAGS add #-Carry,FLAGS.Asl16Carry: Set16ZNjmp A Op06M1: Direct8 ASL Asl8 DIR8Op06M0: Direct8 ASL2 Asl16 DIR16Op16M1: DirectIndexedX8 ASL Asl8 DIXOp16M0: DirectIndexedX8 ASL2 Asl16 DIXOp0EM1: Absolute8 ASL Asl8 ABSOp0EM0: Absolute8 ASL2 Asl16 ABSOp1EM1: AbsoluteIndexedX8 ASL Asl8 ABSXOp1EM0: AbsoluteIndexedX8 ASL2 Asl16 ABSX/* BIT */Op89M1: Immediate8 BIT and A, r0 extu.w r7,r3 sub r3,r7 jmp @r13 or r0,r7Op89M0: Immediate16 BIT and A, r0 extu.w r7,r3 sub r3,r7 jmp @r13 or r0,r7Op24M1: Direct8 BIT Bit8 DIROp24M0: Direct8 BIT Bit16 DIROp34M1: DirectIndexedX8 BIT Bit8 DIXOp34M0: DirectIndexedX8 BIT2 Bit16 DIXOp2CM1: Absolute8 BIT Bit8 ABSOp2CM0: Absolute8 BIT2 Bit16 ABSOp3CM1: AbsoluteIndexedX8 BIT Bit8 ABSXOp3CM0: AbsoluteIndexedX8 BIT2 Bit16 ABSX/* CMP */OpC9M1: Immediate8 CMP Cmp8 IMMOpC9M0: Immediate16 CMP Cmp16 IMMOpC5M1: Direct8 CMP call_S9xGetByte Cmp8 DIROpC5M0: Direct8 CMP2 call_S9xGetWord Cmp16 DIROpD5M1: DirectIndexedX8 CMP call_S9xGetByte Cmp8 DIXOpD5M0: DirectIndexedX8 CMP2 call_S9xGetWord Cmp16 DIXOpD2M1: DirectIndirect8 CMP call_S9xGetByte Cmp8 DIOpD2M0: DirectIndirect8 CMP2 call_S9xGetWord Cmp16 DIOpC1M1: DirectIndexedIndirect8 CMP call_S9xGetByte Cmp8 DIIOpC1M0: DirectIndexedIndirect8 CMP2 call_S9xGetWord Cmp16 DIIOpD1M1: DirectIndirectIndexed8 CMP call_S9xGetByte Cmp8 DIIYOpD1M0: DirectIndirectIndexed8 CMP2 call_S9xGetWord Cmp16 DIIYOpC7M1: DirectIndirectLong8 CMP call_S9xGetByte Cmp8 DILOpC7M0: DirectIndirectLong8 CMP2 call_S9xGetWord Cmp16 DILOpD7M1: DirectIndirectIndexedLong8 CMP call_S9xGetByte Cmp8 DIILOpD7M0: DirectIndirectIndexedLong8 CMP2 call_S9xGetWord Cmp16 DIILOpCDM1: Absolute8 CMP call_S9xGetByte Cmp8 ABSOpCDM0: Absolute8 CMP2 call_S9xGetWord Cmp16 ABSOpDDM1: AbsoluteIndexedX8 CMP call_S9xGetByte Cmp8 ABSXOpDDM0: AbsoluteIndexedX8 CMP2 call_S9xGetWord Cmp16 ABSXOpD9M1: AbsoluteIndexedY8 CMP call_S9xGetByte Cmp8 ABSYOpD9M0: AbsoluteIndexedY8 CMP2 call_S9xGetWord Cmp16 ABSYOpCFM1: AbsoluteLong8 CMP call_S9xGetByte Cmp8 ABSLOpCFM0: AbsoluteLong8 CMP2 call_S9xGetWord Cmp16 ABSLOpDFM1: AbsoluteLongIndexedX8 CMP call_S9xGetByte Cmp8 ALXOpDFM0: AbsoluteLongIndexedX8 CMP2 call_S9xGetWord Cmp16 ALXOpC3M1: StackRelative8 CMP call_S9xGetByte Cmp8 SRELOpC3M0: StackRelative8 CMP2 call_S9xGetWord Cmp16 SRELOpD3M1: StackRelativeIndirectIndexed8 CMP call_S9xGetByte Cmp8 SRIIOpD3M0: StackRelativeIndirectIndexed8 CMP2 call_S9xGetWord Cmp16 SRII/* CPX */OpE0X1: Immediate8 CPX Cpx8 IMMOpE0X0: Immediate16 CPX Cpx16 IMMOpE4X1: Direct8 CPX call_S9xGetByte Cpx8 DIROpE4X0: Direct8 CPX2 call_S9xGetWord Cpx16 DIROpECX1: Absolute8 CPX call_S9xGetByte Cpx8 ABSOpECX0: Absolute8 CPX2 call_S9xGetWord Cpx16 ABS/* CPY */OpC0X1: Immediate8 CPY Cpy8 IMMOpC0X0: Immediate16 CPY Cpy16 IMMOpC4X1: Direct8 CPY call_S9xGetByte Cpy8 DIROpC4X0: Direct8 CPY2 call_S9xGetWord Cpy16 DIROpCCX1: Absolute8 CPY call_S9xGetByte Cpy8 ABSOpCCX0: Absolute8 CPY2 call_S9xGetWord Cpy16 ABS/* DEC */Op3AM1: extu.b A,r0#ifdef VAR_CYCLES add #6, CYCLES#endif sub r0,A add #-1,r0#ifdef CPU_SHUTDOWN mov #0,r3#endif extu.b r0,r0#ifdef CPU_SHUTDOWN mov.l r3,WaitAddress#endif or r0,A SetZNjmp r0Op3AM0: add #-1,A#ifdef VAR_CYCLES add #6, CYCLES#endif#ifdef CPU_SHUTDOWN mov #0,r3#endif extu.w A,A#ifdef CPU_SHUTDOWN mov.l r3,WaitAddress#endif Set16ZNjmp AOpC6M1: Direct8 DEC Dec8 DIROpC6M0: Direct8 DEC2 Dec16 DIROpD6M1: DirectIndexedX8 DEC Dec8 DIXOpD6M0: DirectIndexedX8 DEC2 Dec16 DIXOpCEM1: Absolute8 DEC Dec8 ABSOpCEM0: Absolute8 DEC2 Dec16 ABSOpDEM1: AbsoluteIndexedX8 DEC Dec8 ABSXOpDEM0: AbsoluteIndexedX8 DEC2 Dec16 ABSX/* EOR */Op49M1: Immediate8 EOR Eor8 IMMOp49M0: Immediate16 EOR Eor16 IMMOp45M1: Direct8 EOR call_S9xGetByte Eor8 DIROp45M0: Direct8 EOR2 call_S9xGetWord Eor16 DIROp55M1: DirectIndexedX8 EOR call_S9xGetByte Eor8 DIXOp55M0: DirectIndexedX8 EOR2 call_S9xGetWord Eor16 DIXOp52M1: DirectIndirect8 EOR call_S9xGetByte Eor8 DIOp52M0: DirectIndirect8 EOR2 call_S9xGetWord Eor16 DIOp41M1: DirectIndexedIndirect8 EOR call_S9xGetByte Eor8 DIIOp41M0: DirectIndexedIndirect8 EOR2 call_S9xGetWord Eor16 DIIOp51M1: DirectIndirectIndexed8 EOR call_S9xGetByte Eor8 DIIYOp51M0: DirectIndirectIndexed8 EOR2 call_S9xGetWord Eor16 DIIYOp47M1: DirectIndirectLong8 EOR call_S9xGetByte Eor8 DILOp47M0: DirectIndirectLong8 EOR2 call_S9xGetWord Eor16 DILOp57M1: DirectIndirectIndexedLong8 EOR call_S9xGetByte Eor8 DIILOp57M0: DirectIndirectIndexedLong8 EOR2 call_S9xGetWord Eor16 DIILOp4DM1: Absolute8 EOR call_S9xGetByte Eor8 ABSOp4DM0: Absolute8 EOR2 call_S9xGetWord Eor16 ABSOp5DM1: AbsoluteIndexedX8 EOR call_S9xGetByte Eor8 ABSXOp5DM0: AbsoluteIndexedX8 EOR2 call_S9xGetWord Eor16 ABSXOp59M1: AbsoluteIndexedY8 EOR call_S9xGetByte Eor8 ABSYOp59M0: AbsoluteIndexedY8 EOR2 call_S9xGetWord Eor16 ABSYOp4FM1: AbsoluteLong8 EOR call_S9xGetByte Eor8 ABSLOp4FM0: AbsoluteLong8 EOR2 call_S9xGetWord Eor16 ABSLOp5FM1: AbsoluteLongIndexedX8 EOR call_S9xGetByte Eor8 ALXOp5FM0: AbsoluteLongIndexedX8 EOR2 call_S9xGetWord Eor16 ALXOp43M1: StackRelative8 EOR call_S9xGetByte Eor8 SRELOp43M0: StackRelative8 EOR2 call_S9xGetWord Eor16 SRELOp53M1: StackRelativeIndirectIndexed8 EOR call_S9xGetByte Eor8 SRIIOp53M0: StackRelativeIndirectIndexed8 EOR2 call_S9xGetWord Eor16 SRII/* INC */Op1AM1: extu.b A,r0#ifdef VAR_CYCLES add #6, CYCLES#endif sub r0,A add #1,r0#ifdef CPU_SHUTDOWN mov #0,r3#endif extu.b r0,r0#ifdef CPU_SHUTDOWN mov.l r3,WaitAddress#endif or r0,A SetZNjmp r0Op1AM0: add #1,A#ifdef VAR_CYCLES add #6, CYCLES#endif#ifdef CPU_SHUTDOWN mov #0,r3#endif#ifdef CPU_SHUTDOWN mov.l r3,WaitAddress#endif extu.w A,A Set16ZNjmp AOpE6M1: Direct8 INC Inc8 DIROpE6M0: Direct8 INC2 Inc16 DIR OpF6M1: DirectIndexedX8 INC Inc8 DIXOpF6M0: DirectIndexedX8 INC2 Inc16 DIXOpEEM1: Absolute8 INC
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -