summaryrefslogtreecommitdiff
path: root/src/os9x_asm_cpu.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/os9x_asm_cpu.c')
-rw-r--r--src/os9x_asm_cpu.c310
1 files changed, 155 insertions, 155 deletions
diff --git a/src/os9x_asm_cpu.c b/src/os9x_asm_cpu.c
index bfd2ec5..6376ea5 100644
--- a/src/os9x_asm_cpu.c
+++ b/src/os9x_asm_cpu.c
@@ -16,9 +16,9 @@ START_EXTERN_C
void asm_S9xSetPCBase(uint32 Address)
{
#ifdef __debug_c_setpc__
- printf("spcb\n");
-#endif
- S9xSetPCBase(Address);
+ printf("spcb\n");
+#endif
+ S9xSetPCBase(Address);
}
@@ -32,224 +32,224 @@ void asm_S9xSetPCBase(uint32 Address)
void asm_S9xMainLoop(void)
{
- //S9xPackStatus();
- //printf("asmMainLoop Enter(0x%08x).\n", CPU.Flags);
- asmMainLoop(&CPU);
- //printf("asmMainLoop Exit(0x%08x, %d).\n", CPU.PC - CPU.PCBase, CPU.Cycles);
- //S9xUnpackStatus();
+ //S9xPackStatus();
+ //printf("asmMainLoop Enter(0x%08x).\n", CPU.Flags);
+ asmMainLoop(&CPU);
+ //printf("asmMainLoop Exit(0x%08x, %d).\n", CPU.PC - CPU.PCBase, CPU.Cycles);
+ //S9xUnpackStatus();
}
void asm_S9xDoHBlankProcessing(void)
-{
+{
#ifdef __debug_c_hblank__
- printf("hblank\n");
-#endif
-// S9xUnpackStatus(); // not needed
- S9xDoHBlankProcessing();
-// S9xPackStatus();
+ printf("hblank\n");
+#endif
+ // S9xUnpackStatus(); // not needed
+ S9xDoHBlankProcessing();
+ // S9xPackStatus();
}
uint8 asm_S9xGetByte(uint32 Address)
{
#ifdef __debug_c_io__
- printf("gb\n");
-#endif
- return S9xGetByte(Address);
+ printf("gb\n");
+#endif
+ return S9xGetByte(Address);
}
uint16 asm_S9xGetWord(uint32 Address)
{
#ifdef __debug_c_io__
- printf("gw\n");
-#endif
- return S9xGetWord(Address);
+ printf("gw\n");
+#endif
+ return S9xGetWord(Address);
}
-void asm_S9xSetByte(uint32 Address,uint8 value)
-{
+void asm_S9xSetByte(uint32 Address, uint8 value)
+{
#ifdef __debug_c_io__
- printf("sb\n");
+ printf("sb\n");
#endif
- S9xSetByte(value,Address);
+ S9xSetByte(value, Address);
}
-void asm_S9xSetWord(uint32 Address,uint16 value)
-{
+void asm_S9xSetWord(uint32 Address, uint16 value)
+{
#ifdef __debug_c_io__
- printf("sw\n");
-#endif
- S9xSetWord(value,Address);
+ printf("sw\n");
+#endif
+ S9xSetWord(value, Address);
}
void asm_S9xOpcode_NMI(void)
-{
+{
#ifdef __debug_c_nmi__
- printf("nmi\n");
-#endif
-// S9xUnpackStatus(); // not needed
-
- if (!CheckEmulation())
- {
- PushB (Registers.PB);
- PushW (CPU.PC - CPU.PCBase);
-// S9xPackStatus ();
- PushB (Registers.PL);
- ClearDecimal ();
- SetIRQ ();
-
- Registers.PB = 0;
-// c = 0; // unused
+ printf("nmi\n");
+#endif
+ // S9xUnpackStatus(); // not needed
+
+ if (!CheckEmulation())
+ {
+ PushB(Registers.PB);
+ PushW(CPU.PC - CPU.PCBase);
+ // S9xPackStatus ();
+ PushB(Registers.PL);
+ ClearDecimal();
+ SetIRQ();
+
+ Registers.PB = 0;
+ // c = 0; // unused
#ifdef USE_SA1
- if (Settings.SA1 && (Memory.FillRAM [0x2209] & 0x20))
- S9xSetPCBase (Memory.FillRAM [0x220c] |
- (Memory.FillRAM [0x220d] << 8));
- else
+ if (Settings.SA1 && (Memory.FillRAM [0x2209] & 0x20))
+ S9xSetPCBase(Memory.FillRAM [0x220c] |
+ (Memory.FillRAM [0x220d] << 8));
+ else
#endif
- S9xSetPCBase (S9xGetWord (0xFFEA));
+ S9xSetPCBase(S9xGetWord(0xFFEA));
#ifdef VAR_CYCLES
- CPU.Cycles += TWO_CYCLES;
+ CPU.Cycles += TWO_CYCLES;
#else
- CPU.Cycles += 8;
-#endif
- }
- else
- {
- PushW (CPU.PC - CPU.PCBase);
-// S9xPackStatus (); // not needed
- PushB (Registers.PL);
- ClearDecimal ();
- SetIRQ ();
-
- Registers.PB = 0;
-// ICPU.ShiftedPB = 0; // unused
+ CPU.Cycles += 8;
+#endif
+ }
+ else
+ {
+ PushW(CPU.PC - CPU.PCBase);
+ // S9xPackStatus (); // not needed
+ PushB(Registers.PL);
+ ClearDecimal();
+ SetIRQ();
+
+ Registers.PB = 0;
+ // ICPU.ShiftedPB = 0; // unused
#ifdef USE_SA1
- if (Settings.SA1 && (Memory.FillRAM [0x2209] & 0x20))
- S9xSetPCBase (Memory.FillRAM [0x220c] |
- (Memory.FillRAM [0x220d] << 8));
- else
+ if (Settings.SA1 && (Memory.FillRAM [0x2209] & 0x20))
+ S9xSetPCBase(Memory.FillRAM [0x220c] |
+ (Memory.FillRAM [0x220d] << 8));
+ else
#endif
- S9xSetPCBase (S9xGetWord (0xFFFA));
+ S9xSetPCBase(S9xGetWord(0xFFFA));
#ifdef VAR_CYCLES
- CPU.Cycles += ONE_CYCLE;
+ CPU.Cycles += ONE_CYCLE;
#else
- CPU.Cycles += 6;
+ CPU.Cycles += 6;
#endif
- }
+ }
-// S9xPackStatus(); // not needed
+ // S9xPackStatus(); // not needed
}
void asm_S9xOpcode_IRQ(void)
{
#ifdef __debug_c_irq__
- printf("irq\n");
-#endif
-// S9xUnpackStatus(); // not needed
-
- if (!CheckEmulation())
- {
- PushB (Registers.PB);
- PushW (CPU.PC - CPU.PCBase);
-// S9xPackStatus (); // not needed
- PushB (Registers.PL);
- ClearDecimal ();
- SetIRQ ();
-
- Registers.PB = 0;
-// ICPU.ShiftedPB = 0; // unused
+ printf("irq\n");
+#endif
+ // S9xUnpackStatus(); // not needed
+
+ if (!CheckEmulation())
+ {
+ PushB(Registers.PB);
+ PushW(CPU.PC - CPU.PCBase);
+ // S9xPackStatus (); // not needed
+ PushB(Registers.PL);
+ ClearDecimal();
+ SetIRQ();
+
+ Registers.PB = 0;
+ // ICPU.ShiftedPB = 0; // unused
#ifdef USE_SA1
- if (Settings.SA1 && (Memory.FillRAM [0x2209] & 0x40))
- S9xSetPCBase (Memory.FillRAM [0x220e] |
- (Memory.FillRAM [0x220f] << 8));
- else
+ if (Settings.SA1 && (Memory.FillRAM [0x2209] & 0x40))
+ S9xSetPCBase(Memory.FillRAM [0x220e] |
+ (Memory.FillRAM [0x220f] << 8));
+ else
#endif
- S9xSetPCBase (S9xGetWord (0xFFEE));
+ S9xSetPCBase(S9xGetWord(0xFFEE));
#ifdef VAR_CYCLES
- CPU.Cycles += TWO_CYCLES;
+ CPU.Cycles += TWO_CYCLES;
#else
- CPU.Cycles += 8;
+ CPU.Cycles += 8;
#endif
- }
- else
- {
- PushW (CPU.PC - CPU.PCBase);
-// S9xPackStatus (); // not needed
- PushB (Registers.PL);
- ClearDecimal ();
- SetIRQ ();
-
- Registers.PB = 0;
-// ICPU.ShiftedPB = 0; // unused
+ }
+ else
+ {
+ PushW(CPU.PC - CPU.PCBase);
+ // S9xPackStatus (); // not needed
+ PushB(Registers.PL);
+ ClearDecimal();
+ SetIRQ();
+
+ Registers.PB = 0;
+ // ICPU.ShiftedPB = 0; // unused
#ifdef USE_SA1
- if (Settings.SA1 && (Memory.FillRAM [0x2209] & 0x40))
- S9xSetPCBase (Memory.FillRAM [0x220e] |
- (Memory.FillRAM [0x220f] << 8));
- else
+ if (Settings.SA1 && (Memory.FillRAM [0x2209] & 0x40))
+ S9xSetPCBase(Memory.FillRAM [0x220e] |
+ (Memory.FillRAM [0x220f] << 8));
+ else
#endif
- S9xSetPCBase (S9xGetWord (0xFFFE));
+ S9xSetPCBase(S9xGetWord(0xFFFE));
#ifdef VAR_CYCLES
- CPU.Cycles += ONE_CYCLE;
+ CPU.Cycles += ONE_CYCLE;
#else
- CPU.Cycles += 6;
+ CPU.Cycles += 6;
#endif
- }
-
-// S9xPackStatus(); // not needed
+ }
+
+ // S9xPackStatus(); // not needed
}
#endif
/*
void asm_APU_EXECUTE(int Mode)
{
-#ifdef __debug_c_apuex__
- printf("apuexec\n");
-#endif
- if(CPU.APU_APUExecuting != Mode) return;
-
- if (Settings.asmspc700)
- {
- if(CPU.APU_Cycles < CPU.Cycles) {
- int cycles = CPU.Cycles - CPU.APU_Cycles;
- CPU.APU_Cycles += cycles - spc700_execute(cycles);
- }
- }
- else
- {
- while (CPU.APU_Cycles <= CPU.Cycles)
- {
- CPU.APU_Cycles += S9xAPUCycles [*IAPU.PC];
- (*S9xApuOpcodes[*IAPU.PC]) ();
- }
- }
+#ifdef __debug_c_apuex__
+ printf("apuexec\n");
+#endif
+ if(CPU.APU_APUExecuting != Mode) return;
+
+ if (Settings.asmspc700)
+ {
+ if(CPU.APU_Cycles < CPU.Cycles) {
+ int cycles = CPU.Cycles - CPU.APU_Cycles;
+ CPU.APU_Cycles += cycles - spc700_execute(cycles);
+ }
+ }
+ else
+ {
+ while (CPU.APU_Cycles <= CPU.Cycles)
+ {
+ CPU.APU_Cycles += S9xAPUCycles [*IAPU.PC];
+ (*S9xApuOpcodes[*IAPU.PC]) ();
+ }
+ }
}
void asm_APU_EXECUTE2(void)
{
- if(CPU.APU_APUExecuting != 1) return;
-
- //ICPU.CPUExecuting = FALSE;
- if (Settings.asmspc700)
- {
- if(CPU.APU_Cycles < CPU.NextEvent) {
- int cycles = CPU.NextEvent - CPU.APU_Cycles;
- CPU.APU_Cycles += cycles - spc700_execute(cycles);
- }
- }
- else
- {
- do
- {
- CPU.APU_Cycles += S9xAPUCycles [*IAPU.PC];
- (*S9xApuOpcodes[*IAPU.PC]) ();
- } while (CPU.APU_Cycles < CPU.NextEvent);
- }
- //ICPU.CPUExecuting = TRUE;
+ if(CPU.APU_APUExecuting != 1) return;
+
+ //ICPU.CPUExecuting = FALSE;
+ if (Settings.asmspc700)
+ {
+ if(CPU.APU_Cycles < CPU.NextEvent) {
+ int cycles = CPU.NextEvent - CPU.APU_Cycles;
+ CPU.APU_Cycles += cycles - spc700_execute(cycles);
+ }
+ }
+ else
+ {
+ do
+ {
+ CPU.APU_Cycles += S9xAPUCycles [*IAPU.PC];
+ (*S9xApuOpcodes[*IAPU.PC]) ();
+ } while (CPU.APU_Cycles < CPU.NextEvent);
+ }
+ //ICPU.CPUExecuting = TRUE;
}*/
END_EXTERN_C