⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 sa1ops.s

📁 著名SFC模拟器Snes9x的源代码。
💻 S
📖 第 1 页 / 共 4 页
字号:
/* * Snes9x - Portable Super Nintendo Entertainment System (TM) emulator. * * (c) Copyright 1996 - 2001 Gary Henderson (gary@daniver.demon.co.uk) and *                           Jerremy Koot (jkoot@snes9x.com) * * Super FX C emulator code  * (c) Copyright 1997 - 1999 Ivar (Ivar@snes9x.com) and *                           Gary Henderson. * Super FX assembler emulator code (c) Copyright 1998 zsKnight and _Demo_. * * DSP1 emulator code (c) Copyright 1998 Ivar, _Demo_ and Gary Henderson. * C4 asm and some C emulation code (c) Copyright 2000 zsKnight and _Demo_. * C4 C code (c) Copyright 2001 Gary Henderson (gary@daniver.demon.co.uk). * * DOS port code contains the works of other authors. See headers in * individual files. * * Snes9x homepage: 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. */#define Registers SA1Registers#undef VAR_CYCLES#include "sa1struc.h"#if 0#define PCS SA1PCS#define PB SA1PB#define PP SA1PP#define PL SA1PL#define PH SA1PH#define AA SA1AA#define AL SA1AL#define AH SA1AH#define DD SA1DD#define DL SA1DL#define DH SA1DH#define SS SA1SS#define SL SA1SL#define SH SA1SH#define XX SA1XX#define XL SA1XL#define XH SA1XH#define YY SA1YY#define YL SA1YL#define YH SA1YH#endif#undef _Carry#define _Carry SA1_Carry#undef _Zero#define _Zero SA1_Zero#undef _Negative#define _Negative SA1_Negative#undef _Overflow#define _Overflow SA1_Overflow#include "sa1addr.h"#include "sa1ops.h"#include "sa1gs.S".data.zzz:.string "*** IRQ\n".text.globl S9xSA1MainLoopS9xSA1MainLoop:	LOAD_REGISTERS	testl $IRQ_PENDING_FLAG, SA1Flags	jz .nosa1irq2	testb $0xff, SA1IRQActive	jz .nosa1irq1	testb $IRQ, FLAGS	jnz .nosa1irq2	cmpb $0, WaitingForInterrupt	je .nosa1wait	incl PC	movb $0, WaitingForInterrupt.nosa1wait:	call S9xSA1Opcode_IRQ	jmp .nosa1irq2.nosa1irq1:	andl $~IRQ_PENDING_FLAG, SA1Flags	.nosa1irq2:	movl $3, %eax.instruction_loop:	testb $0xff, SA1Executing	jz .exit	pushl %eax#ifdef DEBUGGER	testb $TRACE_FLAG, SA1Flags	jz .NO_SA1_TRACE	STORE_REGISTERS	ccall S9xSA1Trace	LOAD_REGISTERS.NO_SA1_TRACE:#endif	xorl %eax, %eax	movl SA1Opcodes, %ecx#ifdef CPU_SHUTDOWN        movl PC, SA1PCAtOpcodeStart#endif	movb (PC), %al	incl PC	jmp *(%ecx,%eax,4).globl S9xSA1MainAsmLoopS9xSA1MainAsmLoop:	popl %eax	decl %eax	jnz .instruction_loop.exit:	STORE_REGISTERS	ret/* ADC */Op69M1:	Immediate8 ADC	Adc8 IMM8Op69M0:	Immediate16 ADC2	Adc16 IMM16Op65M1:	Direct8 ADC2	call S9xSA1GetByte	Adc8 DIR8Op65M0:	Direct8 ADC	call S9xSA1GetWord	Adc16 DIR16	Op75M1:	DirectIndexedX8 ADC	call S9xSA1GetByte	Adc8 DIX8Op75M0:	DirectIndexedX8 ADC2	call S9xSA1GetWord	Adc16 DIX16Op72M1:	DirectIndirect8 ADC	call S9xSA1GetByte	Adc8 DI8Op72M0:	DirectIndirect8 ADC2	call S9xSA1GetWord	Adc16 DI16Op61M1:	DirectIndexedIndirect8 ADC	call S9xSA1GetByte	Adc8 DII8Op61M0:	DirectIndexedIndirect8 ADC2	call S9xSA1GetWord	Adc16 DII16Op71M1:	DirectIndirectIndexed8 ADC	call S9xSA1GetByte	Adc8 DIIY8Op71M0:	DirectIndirectIndexed8 ADC2	call S9xSA1GetWord	Adc16 DIIY16Op67M1:	DirectIndirectLong8 ADC	call S9xSA1GetByte	Adc8 DIL8Op67M0:	DirectIndirectLong8 ADC2	call S9xSA1GetWord	Adc16 DIL16Op77M1:	DirectIndirectIndexedLong8 ADC	call S9xSA1GetByte	Adc8 DIIL8Op77M0:	DirectIndirectIndexedLong8 ADC2	call S9xSA1GetWord	Adc16 DIIL8Op6DM1:	Absolute8 ADC	call S9xSA1GetByte	Adc8 ABS8Op6DM0:	Absolute8 ADC2	call S9xSA1GetWord	Adc16 ABS16Op7DM1:	AbsoluteIndexedX8 ADC	call S9xSA1GetByte	Adc8 ABSX8Op7DM0:	AbsoluteIndexedX8 ADC2	call S9xSA1GetWord	Adc16 ABSX16Op79M1:	AbsoluteIndexedY8 ADC	call S9xSA1GetByte	Adc8 ABSY8Op79M0:	AbsoluteIndexedY8 ADC2	call S9xSA1GetWord	Adc16 ABSY16Op6FM1:	AbsoluteLong8 ADC	call S9xSA1GetByte	Adc8 ABSL8Op6FM0:	AbsoluteLong8 ADC2	call S9xSA1GetWord	Adc16 ABSL16Op7FM1:	AbsoluteLongIndexedX8 ADC	call S9xSA1GetByte	Adc8 ALX8Op7FM0:	AbsoluteLongIndexedX8 ADC2	call S9xSA1GetWord	Adc16 ALX16Op63M1:	StackRelative8 ADC	call S9xSA1GetByte	Adc8 SREL8Op63M0:	StackRelative8 ADC2	call S9xSA1GetWord	Adc16 SREL16Op73M1:	StackRelativeIndirectIndexed8 ADC	call S9xSA1GetByte	Adc8 SRII8Op73M0:	StackRelativeIndirectIndexed8 ADC2	call S9xSA1GetWord	Adc16 SRII16/* AND */Op29M1:	Immediate8 AND	And8 IMM8Op29M0:	Immediate16 AND	And16 IMM16Op25M1:	Direct8 AND	call S9xSA1GetByte	And8 DIR8Op25M0:	Direct8 AND2	call S9xSA1GetWord	And16 DIR16Op35M1:	DirectIndexedX8 AND	call S9xSA1GetByte	And8 DIX8Op35M0:	DirectIndexedX8 AND2	call S9xSA1GetWord	And16 DIX16Op32M1:	DirectIndirect8 AND	call S9xSA1GetByte	And8 DI8Op32M0:	DirectIndirect8 AND2	call S9xSA1GetWord	And16 DI16Op21M1:	DirectIndexedIndirect8 AND	call S9xSA1GetByte	And8 DII8Op21M0:	DirectIndexedIndirect8 AND2	call S9xSA1GetWord	And16 DII16Op31M1:	DirectIndirectIndexed8 AND	call S9xSA1GetByte	And8 DIIY8Op31M0:	DirectIndirectIndexed8 AND2	call S9xSA1GetWord	And16 DIIY16Op27M1:	DirectIndirectLong8 AND	call S9xSA1GetByte	And8 DIL8Op27M0:	DirectIndirectLong8 AND2	call S9xSA1GetWord	And16 DIL16Op37M1:	DirectIndirectIndexedLong8 AND	call S9xSA1GetByte	And8 DIIL8Op37M0:	DirectIndirectIndexedLong8 AND2	call S9xSA1GetWord	And16 DIIL16Op2DM1:	Absolute8 AND	call S9xSA1GetByte	And8 ABS8Op2DM0:	Absolute8 AND2	call S9xSA1GetWord	And16 ABS16Op3DM1:	AbsoluteIndexedX8 AND	call S9xSA1GetByte	And8 ABSX8Op3DM0:	AbsoluteIndexedX8 AND2	call S9xSA1GetWord	And16 ABSX16Op39M1:	AbsoluteIndexedY8 AND	call S9xSA1GetByte	And8 ABSY8Op39M0:	AbsoluteIndexedY8 AND2	call S9xSA1GetWord	And16 ABSY16Op2FM1:	AbsoluteLong8 AND	call S9xSA1GetByte	And8 ABSL8Op2FM0:	AbsoluteLong8 AND2	call S9xSA1GetWord	And16 ABSL16Op3FM1:	AbsoluteLongIndexedX8 AND	call S9xSA1GetByte	And8 ALX8Op3FM0:	AbsoluteLongIndexedX8 AND2	call S9xSA1GetWord	And16 ALX16Op23M1:	StackRelative8 AND	call S9xSA1GetByte	And8 SREL8Op23M0:	StackRelative8 AND2	call S9xSA1GetWord	And16 SREL16Op33M1:	StackRelativeIndirectIndexed8 AND	call S9xSA1GetByte	And8 SRII8Op33M0:	StackRelativeIndirectIndexed8 AND2	call S9xSA1GetWord	And16 SRII16/* ASL */Op0AM1:	movb AL, %al	salb %al	movb %al, AL	SetZNC	jmp S9xSA1MainAsmLoopOp0AM0:	movw AA, %ax	salw %ax	movw %ax, AA	setnz SA1_Zero	setc SA1_Carry	movb %ah, SA1_Negative	jmp S9xSA1MainAsmLoop	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	andb AL, %al	movb %al, SA1_Zero	jmp S9xSA1MainAsmLoopOp89M0:	Immediate16 BIT	andw AA, %ax	setnz SA1_Zero	jmp S9xSA1MainAsmLoopOp24M1:	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 S9xSA1GetByte	Cmp8 DIROpC5M0:	Direct8 CMP2	call S9xSA1GetWord	Cmp16 DIROpD5M1:	DirectIndexedX8 CMP	call S9xSA1GetByte	Cmp8 DIXOpD5M0:	DirectIndexedX8 CMP2	call S9xSA1GetWord	Cmp16 DIXOpD2M1:	DirectIndirect8 CMP	call S9xSA1GetByte	Cmp8 DIOpD2M0:	DirectIndirect8 CMP2	call S9xSA1GetWord	Cmp16 DIOpC1M1:	DirectIndexedIndirect8 CMP	call S9xSA1GetByte	Cmp8 DIIOpC1M0:	DirectIndexedIndirect8 CMP2	call S9xSA1GetWord	Cmp16 DIIOpD1M1:	DirectIndirectIndexed8 CMP	call S9xSA1GetByte	Cmp8 DIIYOpD1M0:	DirectIndirectIndexed8 CMP2	call S9xSA1GetWord	Cmp16 DIIYOpC7M1:	DirectIndirectLong8 CMP	call S9xSA1GetByte	Cmp8 DILOpC7M0:	DirectIndirectLong8 CMP2	call S9xSA1GetWord	Cmp16 DILOpD7M1:	DirectIndirectIndexedLong8 CMP	call S9xSA1GetByte	Cmp8 DIILOpD7M0:	DirectIndirectIndexedLong8 CMP2	call S9xSA1GetWord	Cmp16 DIILOpCDM1:	Absolute8 CMP	call S9xSA1GetByte	Cmp8 ABSOpCDM0:	Absolute8 CMP2	call S9xSA1GetWord	Cmp16 ABSOpDDM1:	AbsoluteIndexedX8 CMP	call S9xSA1GetByte	Cmp8 ABSXOpDDM0:	AbsoluteIndexedX8 CMP2	call S9xSA1GetWord	Cmp16 ABSXOpD9M1:	AbsoluteIndexedY8 CMP	call S9xSA1GetByte	Cmp8 ABSYOpD9M0:	AbsoluteIndexedY8 CMP2	call S9xSA1GetWord	Cmp16 ABSYOpCFM1:	AbsoluteLong8 CMP	call S9xSA1GetByte	Cmp8 ABSLOpCFM0:	AbsoluteLong8 CMP2	call S9xSA1GetWord	Cmp16 ABSLOpDFM1:	AbsoluteLongIndexedX8 CMP	call S9xSA1GetByte	Cmp8 ALXOpDFM0:	AbsoluteLongIndexedX8 CMP2	call S9xSA1GetWord	Cmp16 ALXOpC3M1:	StackRelative8 CMP	call S9xSA1GetByte	Cmp8 SRELOpC3M0:	StackRelative8 CMP2	call S9xSA1GetWord	Cmp16 SRELOpD3M1:	StackRelativeIndirectIndexed8 CMP	call S9xSA1GetByte	Cmp8 SRIIOpD3M0:	StackRelativeIndirectIndexed8 CMP2	call S9xSA1GetWord	Cmp16 SRII/* CPX */OpE0X1:	Immediate8 CPX	Cpx8 IMMOpE0X0:	Immediate16 CPX	Cpx16 IMMOpE4X1:	Direct8 CPX	call S9xSA1GetByte	Cpx8 DIROpE4X0:	Direct8 CPX2	call S9xSA1GetWord	Cpx16 DIROpECX1:	Absolute8 CPX	call S9xSA1GetByte	Cpx8 ABSOpECX0:	Absolute8 CPX2	call S9xSA1GetWord	Cpx16 ABS/* CPY */OpC0X1:	Immediate8 CPY	Cpy8 IMMOpC0X0:	Immediate16 CPY	Cpy16 IMMOpC4X1:	Direct8 CPY	call S9xSA1GetByte	Cpy8 DIROpC4X0:	Direct8 CPY2	call S9xSA1GetWord	Cpy16 DIROpCCX1:	Absolute8 CPY	call S9xSA1GetByte	Cpy8 ABSOpCCX0:	Absolute8 CPY2	call S9xSA1GetWord	Cpy16 ABS/* DEC */Op3AM1:	movb AL, %al	decb %al	movb %al, AL	SetZN	jmp S9xSA1MainAsmLoopOp3AM0:	decw AA	setnz SA1_Zero	movb AH, %al	movb %al, SA1_Negative	jmp S9xSA1MainAsmLoopOpC6M1:	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 S9xSA1GetByte	Eor8 DIROp45M0:	Direct8 EOR2	call S9xSA1GetWord	Eor16 DIROp55M1:	DirectIndexedX8 EOR	call S9xSA1GetByte	Eor8 DIXOp55M0:	DirectIndexedX8 EOR2	call S9xSA1GetWord	Eor16 DIXOp52M1:	DirectIndirect8 EOR	call S9xSA1GetByte	Eor8 DIOp52M0:	DirectIndirect8 EOR2	call S9xSA1GetWord	Eor16 DIOp41M1:	DirectIndexedIndirect8 EOR	call S9xSA1GetByte	Eor8 DIIOp41M0:	DirectIndexedIndirect8 EOR2	call S9xSA1GetWord	Eor16 DIIOp51M1:	DirectIndirectIndexed8 EOR	call S9xSA1GetByte	Eor8 DIIYOp51M0:	DirectIndirectIndexed8 EOR2	call S9xSA1GetWord	Eor16 DIIYOp47M1:	DirectIndirectLong8 EOR	call S9xSA1GetByte	Eor8 DILOp47M0:	DirectIndirectLong8 EOR2	call S9xSA1GetWord	Eor16 DILOp57M1:	DirectIndirectIndexedLong8 EOR	call S9xSA1GetByte	Eor8 DIILOp57M0:	DirectIndirectIndexedLong8 EOR2	call S9xSA1GetWord	Eor16 DIILOp4DM1:	Absolute8 EOR	call S9xSA1GetByte	Eor8 ABSOp4DM0:	Absolute8 EOR2	call S9xSA1GetWord	Eor16 ABSOp5DM1:	AbsoluteIndexedX8 EOR	call S9xSA1GetByte	Eor8 ABSXOp5DM0:	AbsoluteIndexedX8 EOR2	call S9xSA1GetWord	Eor16 ABSXOp59M1:	AbsoluteIndexedY8 EOR	call S9xSA1GetByte	Eor8 ABSYOp59M0:	AbsoluteIndexedY8 EOR2	call S9xSA1GetWord	Eor16 ABSYOp4FM1:	AbsoluteLong8 EOR	call S9xSA1GetByte	Eor8 ABSLOp4FM0:	AbsoluteLong8 EOR2	call S9xSA1GetWord	Eor16 ABSLOp5FM1:	AbsoluteLongIndexedX8 EOR	call S9xSA1GetByte	Eor8 ALXOp5FM0:	AbsoluteLongIndexedX8 EOR2	call S9xSA1GetWord	Eor16 ALXOp43M1:	StackRelative8 EOR	call S9xSA1GetByte	Eor8 SRELOp43M0:	StackRelative8 EOR2	call S9xSA1GetWord	Eor16 SRELOp53M1:	StackRelativeIndirectIndexed8 EOR	call S9xSA1GetByte	Eor8 SRIIOp53M0:	StackRelativeIndirectIndexed8 EOR2	call S9xSA1GetWord	Eor16 SRII/* INC */Op1AM1:	movb AL, %al	incb %al	movb %al, AL	SetZN	jmp S9xSA1MainAsmLoopOp1AM0:	incw AA	setnz SA1_Zero	movb AH, %ah	movb %ah, SA1_Negative	jmp S9xSA1MainAsmLoopOpE6M1:	Direct8 INC	Inc8 DIROpE6M0:	Direct8 INC2	Inc16 DIR	OpF6M1:	DirectIndexedX8 INC	Inc8 DIXOpF6M0:	DirectIndexedX8 INC2	Inc16 DIXOpEEM1:	Absolute8 INC	Inc8 ABSOpEEM0:	Absolute8 INC2	Inc16 ABSOpFEM1:	AbsoluteIndexedX8 INC	Inc8 ABSXOpFEM0:	AbsoluteIndexedX8 INC2	Inc16 ABSX/* LDA */OpA9M1:	Immediate8 LDA	Lda8 IMMOpA9M0:	Immediate16 LDA	Lda16 IMMOpA5M1:	Direct8 LDA	call S9xSA1GetByte	Lda8 DIROpA5M0:	Direct8 LDA2	call S9xSA1GetWord	Lda16 DIROpB5M1:	DirectIndexedX8 LDA	call S9xSA1GetByte	Lda8 DIXOpB5M0:	DirectIndexedX8 LDA2	call S9xSA1GetWord	Lda16 DIXOpB2M1:	DirectIndirect8 LDA	call S9xSA1GetByte	Lda8 DIOpB2M0:	DirectIndirect8 LDA2	call S9xSA1GetWord	Lda16 DIOpA1M1:	DirectIndexedIndirect8 LDA	call S9xSA1GetByte	Lda8 DII

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -